diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index c1066beea257b..53e77c36fa42a 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -476,6 +476,7 @@ com.azure.resourcemanager:azure-resourcemanager-computeschedule;1.0.0-beta.1;1.0 com.azure.resourcemanager:azure-resourcemanager-trustedsigning;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-iotoperations;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-containerorchestratorruntime;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-cosmos-generated;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.2.0-beta.1 com.azure.tools:azure-sdk-build-tool;1.0.0;1.1.0-beta.1 io.clientcore:clientcore-parent;1.0.0-beta.1;1.0.0-beta.1 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..6a9ed8d996cd1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 1.0.0-beta.1 (2024-10-22) + +- 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-2024-11-15. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +### Features Added + +- Initial release for the azure-resourcemanager-cosmos-generated Java SDK. 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..04aa588c41f40 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/README.md @@ -0,0 +1,104 @@ +# 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-2024-11-15. 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] and [Azure Core Netty HTTP][azure_core_http_netty] packages provide the default implementation. + +### Authentication + +Microsoft Entra ID token authentication relies on the [credential class][azure_identity_credentials] from [Azure Identity][azure_identity] package. + +Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. + +Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the 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][cg]. + +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact with any additional questions or comments. + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://learn.microsoft.com/azure/developer/java/fundamentals/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/identity/azure-identity#credentials +[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 +[cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fcosmos%2Fazure-resourcemanager-cosmos-generated%2FREADME.png) 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..c7259ee2b976a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/SAMPLE.md @@ -0,0 +1,5978 @@ +# Code snippets and samples + + +## CassandraClusters + +- [CreateUpdate](#cassandraclusters_createupdate) +- [Deallocate](#cassandraclusters_deallocate) +- [Delete](#cassandraclusters_delete) +- [GetByResourceGroup](#cassandraclusters_getbyresourcegroup) +- [InvokeCommand](#cassandraclusters_invokecommand) +- [List](#cassandraclusters_list) +- [ListByResourceGroup](#cassandraclusters_listbyresourcegroup) +- [Start](#cassandraclusters_start) +- [Status](#cassandraclusters_status) +- [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) +- [DeleteCassandraKeyspace](#cassandraresources_deletecassandrakeyspace) +- [DeleteCassandraTable](#cassandraresources_deletecassandratable) +- [GetCassandraKeyspace](#cassandraresources_getcassandrakeyspace) +- [GetCassandraKeyspaceThroughput](#cassandraresources_getcassandrakeyspacethroughput) +- [GetCassandraTable](#cassandraresources_getcassandratable) +- [GetCassandraTableThroughput](#cassandraresources_getcassandratablethroughput) +- [ListCassandraKeyspaces](#cassandraresources_listcassandrakeyspaces) +- [ListCassandraTables](#cassandraresources_listcassandratables) +- [MigrateCassandraKeyspaceToAutoscale](#cassandraresources_migratecassandrakeyspacetoautoscale) +- [MigrateCassandraKeyspaceToManualThroughput](#cassandraresources_migratecassandrakeyspacetomanualthroughput) +- [MigrateCassandraTableToAutoscale](#cassandraresources_migratecassandratabletoautoscale) +- [MigrateCassandraTableToManualThroughput](#cassandraresources_migratecassandratabletomanualthroughput) +- [UpdateCassandraKeyspaceThroughput](#cassandraresources_updatecassandrakeyspacethroughput) +- [UpdateCassandraTableThroughput](#cassandraresources_updatecassandratablethroughput) + +## 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) + +## 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) +- [RetrieveContinuousBackupInformation](#gremlinresources_retrievecontinuousbackupinformation) +- [UpdateGremlinDatabaseThroughput](#gremlinresources_updategremlindatabasethroughput) +- [UpdateGremlinGraphThroughput](#gremlinresources_updategremlingraphthroughput) + +## Locations + +- [Get](#locations_get) +- [List](#locations_list) + +## MongoDBResources + +- [CreateUpdateMongoDBCollection](#mongodbresources_createupdatemongodbcollection) +- [CreateUpdateMongoDBDatabase](#mongodbresources_createupdatemongodbdatabase) +- [CreateUpdateMongoRoleDefinition](#mongodbresources_createupdatemongoroledefinition) +- [CreateUpdateMongoUserDefinition](#mongodbresources_createupdatemongouserdefinition) +- [DeleteMongoDBCollection](#mongodbresources_deletemongodbcollection) +- [DeleteMongoDBDatabase](#mongodbresources_deletemongodbdatabase) +- [DeleteMongoRoleDefinition](#mongodbresources_deletemongoroledefinition) +- [DeleteMongoUserDefinition](#mongodbresources_deletemongouserdefinition) +- [GetMongoDBCollection](#mongodbresources_getmongodbcollection) +- [GetMongoDBCollectionThroughput](#mongodbresources_getmongodbcollectionthroughput) +- [GetMongoDBDatabase](#mongodbresources_getmongodbdatabase) +- [GetMongoDBDatabaseThroughput](#mongodbresources_getmongodbdatabasethroughput) +- [GetMongoRoleDefinition](#mongodbresources_getmongoroledefinition) +- [GetMongoUserDefinition](#mongodbresources_getmongouserdefinition) +- [ListMongoDBCollections](#mongodbresources_listmongodbcollections) +- [ListMongoDBDatabases](#mongodbresources_listmongodbdatabases) +- [ListMongoRoleDefinitions](#mongodbresources_listmongoroledefinitions) +- [ListMongoUserDefinitions](#mongodbresources_listmongouserdefinitions) +- [MigrateMongoDBCollectionToAutoscale](#mongodbresources_migratemongodbcollectiontoautoscale) +- [MigrateMongoDBCollectionToManualThroughput](#mongodbresources_migratemongodbcollectiontomanualthroughput) +- [MigrateMongoDBDatabaseToAutoscale](#mongodbresources_migratemongodbdatabasetoautoscale) +- [MigrateMongoDBDatabaseToManualThroughput](#mongodbresources_migratemongodbdatabasetomanualthroughput) +- [RetrieveContinuousBackupInformation](#mongodbresources_retrievecontinuousbackupinformation) +- [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) + +## RestorableDatabaseAccounts + +- [GetByLocation](#restorabledatabaseaccounts_getbylocation) +- [List](#restorabledatabaseaccounts_list) +- [ListByLocation](#restorabledatabaseaccounts_listbylocation) + +## RestorableGremlinDatabases + +- [List](#restorablegremlindatabases_list) + +## RestorableGremlinGraphs + +- [List](#restorablegremlingraphs_list) + +## RestorableGremlinResources + +- [List](#restorablegremlinresources_list) + +## RestorableMongodbCollections + +- [List](#restorablemongodbcollections_list) + +## RestorableMongodbDatabases + +- [List](#restorablemongodbdatabases_list) + +## RestorableMongodbResources + +- [List](#restorablemongodbresources_list) + +## RestorableSqlContainers + +- [List](#restorablesqlcontainers_list) + +## RestorableSqlDatabases + +- [List](#restorablesqldatabases_list) + +## RestorableSqlResources + +- [List](#restorablesqlresources_list) + +## RestorableTableResources + +- [List](#restorabletableresources_list) + +## RestorableTables + +- [List](#restorabletables_list) + +## Service + +- [Create](#service_create) +- [Delete](#service_delete) +- [Get](#service_get) +- [List](#service_list) + +## SqlResources + +- [CreateUpdateClientEncryptionKey](#sqlresources_createupdateclientencryptionkey) +- [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) +- [GetClientEncryptionKey](#sqlresources_getclientencryptionkey) +- [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) +- [ListClientEncryptionKeys](#sqlresources_listclientencryptionkeys) +- [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) +- [RetrieveContinuousBackupInformation](#tableresources_retrievecontinuousbackupinformation) +- [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/stable/2024-11-15/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("fakeTokenPlaceholder") + .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"))) + .withHoursBetweenBackups(24)) + .create(); + } + + // Use "Map.of" if available + @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_Deallocate + +```java +/** + * Samples for CassandraClusters Deallocate. + */ +public final class CassandraClustersDeallocateSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBManagedCassandraClusterDeallocate.json + */ + /** + * Sample code: CosmosDBManagedCassandraClusterDeallocate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + cosmosDBManagedCassandraClusterDeallocate(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.cassandraClusters().deallocate("cassandra-prod-rg", "cassandra-prod", com.azure.core.util.Context.NONE); + } +} +``` + +### CassandraClusters_Delete + +```java +/** + * Samples for CassandraClusters Delete. + */ +public final class CassandraClustersDeleteSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### CassandraClusters_GetByResourceGroup + +```java +/** + * Samples for CassandraClusters GetByResourceGroup. + */ +public final class CassandraClustersGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### CassandraClusters_InvokeCommand + +```java +import com.azure.resourcemanager.cosmos.generated.models.CommandPostBody; + +/** + * Samples for CassandraClusters InvokeCommand. + */ +public final class CassandraClustersInvokeCommandSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBManagedCassandraCommand.json + */ + /** + * Sample code: CosmosDBManagedCassandraCommand. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + cosmosDBManagedCassandraCommand(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.cassandraClusters() + .invokeCommand("cassandra-prod-rg", "cassandra-prod", + new CommandPostBody().withCommand("nodetool status").withHost("10.0.1.12"), + com.azure.core.util.Context.NONE); + } +} +``` + +### CassandraClusters_List + +```java +/** + * Samples for CassandraClusters List. + */ +public final class CassandraClustersListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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(com.azure.core.util.Context.NONE); + } +} +``` + +### CassandraClusters_ListByResourceGroup + +```java +/** + * Samples for CassandraClusters ListByResourceGroup. + */ +public final class CassandraClustersListByResourceGroupSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### CassandraClusters_Start + +```java +/** + * Samples for CassandraClusters Start. + */ +public final class CassandraClustersStartSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBManagedCassandraClusterStart.json + */ + /** + * Sample code: CosmosDBManagedCassandraClusterStart. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + cosmosDBManagedCassandraClusterStart(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.cassandraClusters().start("cassandra-prod-rg", "cassandra-prod", com.azure.core.util.Context.NONE); + } +} +``` + +### CassandraClusters_Status + +```java +/** + * Samples for CassandraClusters Status. + */ +public final class CassandraClustersStatusSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBManagedCassandraStatus.json + */ + /** + * Sample code: CosmosDBManagedCassandraStatus. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + cosmosDBManagedCassandraStatus(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.cassandraClusters() + .statusWithResponse("cassandra-prod-rg", "cassandra-prod", com.azure.core.util.Context.NONE); + } +} +``` + +### CassandraClusters_Update + +```java +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/stable/2024-11-15/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", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("owner", "mike")) + .withProperties(new ClusterResourceProperties().withAuthenticationMethod(AuthenticationMethod.NONE) + .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"))) + .withHoursBetweenBackups(12)) + .apply(); + } + + // Use "Map.of" if available + @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/stable/2024-11-15/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("fakeTokenPlaceholder")) + .create(); + } +} +``` + +### CassandraDataCenters_Delete + +```java +/** + * Samples for CassandraDataCenters Delete. + */ +public final class CassandraDataCentersDeleteSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### CassandraDataCenters_Get + +```java +/** + * Samples for CassandraDataCenters Get. + */ +public final class CassandraDataCentersGetSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### CassandraDataCenters_List + +```java +/** + * Samples for CassandraDataCenters List. + */ +public final class CassandraDataCentersListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### CassandraDataCenters_Update + +```java +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/stable/2024-11-15/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", com.azure.core.util.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("fakeTokenPlaceholder")) + .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/stable/2024-11-15/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(); + } + + // Use "Map.of" if available + @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/stable/2024-11-15/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"))))) + .withTags(mapOf()) + .withOptions(new CreateUpdateOptions()) + .create(); + } + + // Use "Map.of" if available + @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 +/** + * Samples for CassandraResources DeleteCassandraKeyspace. + */ +public final class CassandraResourcesDeleteCassandraKeyspaceSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### CassandraResources_DeleteCassandraTable + +```java +/** + * Samples for CassandraResources DeleteCassandraTable. + */ +public final class CassandraResourcesDeleteCassandraTableSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### CassandraResources_GetCassandraKeyspace + +```java +/** + * Samples for CassandraResources GetCassandraKeyspace. + */ +public final class CassandraResourcesGetCassandraKeyspaceSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### CassandraResources_GetCassandraKeyspaceThroughput + +```java +/** + * Samples for CassandraResources GetCassandraKeyspaceThroughput. + */ +public final class CassandraResourcesGetCassandraKeyspaceThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.Context.NONE); + } +} +``` + +### CassandraResources_GetCassandraTable + +```java +/** + * Samples for CassandraResources GetCassandraTable. + */ +public final class CassandraResourcesGetCassandraTableSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.Context.NONE); + } +} +``` + +### CassandraResources_GetCassandraTableThroughput + +```java +/** + * Samples for CassandraResources GetCassandraTableThroughput. + */ +public final class CassandraResourcesGetCassandraTableThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.Context.NONE); + } +} +``` + +### CassandraResources_ListCassandraKeyspaces + +```java +/** + * Samples for CassandraResources ListCassandraKeyspaces. + */ +public final class CassandraResourcesListCassandraKeyspacesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### CassandraResources_ListCassandraTables + +```java +/** + * Samples for CassandraResources ListCassandraTables. + */ +public final class CassandraResourcesListCassandraTablesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### CassandraResources_MigrateCassandraKeyspaceToAutoscale + +```java +/** + * Samples for CassandraResources MigrateCassandraKeyspaceToAutoscale. + */ +public final class CassandraResourcesMigrateCassandraKeyspaceToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### CassandraResources_MigrateCassandraKeyspaceToManualThroughput + +```java +/** + * Samples for CassandraResources MigrateCassandraKeyspaceToManualThroughput. + */ +public final class CassandraResourcesMigrateCassandraKeyspaceToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.Context.NONE); + } +} +``` + +### CassandraResources_MigrateCassandraTableToAutoscale + +```java +/** + * Samples for CassandraResources MigrateCassandraTableToAutoscale. + */ +public final class CassandraResourcesMigrateCassandraTableToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.Context.NONE); + } +} +``` + +### CassandraResources_MigrateCassandraTableToManualThroughput + +```java +/** + * Samples for CassandraResources MigrateCassandraTableToManualThroughput. + */ +public final class CassandraResourcesMigrateCassandraTableToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.Context.NONE); + } +} +``` + +### CassandraResources_UpdateCassandraKeyspaceThroughput + +```java +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/stable/2024-11-15/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)), + com.azure.core.util.Context.NONE); + } + + // Use "Map.of" if available + @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.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/stable/2024-11-15/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)), + com.azure.core.util.Context.NONE); + } + + // Use "Map.of" if available + @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 +/** + * Samples for Collection ListMetricDefinitions. + */ +public final class CollectionListMetricDefinitionsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### Collection_ListMetrics + +```java +/** + * Samples for Collection ListMetrics. + */ +public final class CollectionListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.Context.NONE); + } +} +``` + +### Collection_ListUsages + +```java +/** + * Samples for Collection ListUsages. + */ +public final class CollectionListUsagesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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'", + com.azure.core.util.Context.NONE); + } +} +``` + +### CollectionPartition_ListMetrics + +```java +/** + * Samples for CollectionPartition ListMetrics. + */ +public final class CollectionPartitionListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.Context.NONE); + } +} +``` + +### CollectionPartition_ListUsages + +```java +/** + * Samples for CollectionPartition ListUsages. + */ +public final class CollectionPartitionListUsagesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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'", + com.azure.core.util.Context.NONE); + } +} +``` + +### CollectionPartitionRegion_ListMetrics + +```java +/** + * Samples for CollectionPartitionRegion ListMetrics. + */ +public final class CollectionPartitionRegionListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.Context.NONE); + } +} +``` + +### CollectionRegion_ListMetrics + +```java +/** + * Samples for CollectionRegion ListMetrics. + */ +public final class CollectionRegionListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.Context.NONE); + } +} +``` + +### Database_ListMetricDefinitions + +```java +/** + * Samples for Database ListMetricDefinitions. + */ +public final class DatabaseListMetricDefinitionsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### Database_ListMetrics + +```java +/** + * Samples for Database ListMetrics. + */ +public final class DatabaseListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.Context.NONE); + } +} +``` + +### Database_ListUsages + +```java +/** + * Samples for Database ListUsages. + */ +public final class DatabaseListUsagesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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'", + com.azure.core.util.Context.NONE); + } +} +``` + +### DatabaseAccountRegion_ListMetrics + +```java +/** + * Samples for DatabaseAccountRegion ListMetrics. + */ +public final class DatabaseAccountRegionListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.Context.NONE); + } +} +``` + +### DatabaseAccounts_CheckNameExists + +```java +/** + * Samples for DatabaseAccounts CheckNameExists. + */ +public final class DatabaseAccountsCheckNameExistsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### DatabaseAccounts_CreateOrUpdate + +```java +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.Capacity; +import com.azure.resourcemanager.cosmos.generated.models.ConsistencyPolicy; +import com.azure.resourcemanager.cosmos.generated.models.ContinuousModeBackupPolicy; +import com.azure.resourcemanager.cosmos.generated.models.ContinuousModeProperties; +import com.azure.resourcemanager.cosmos.generated.models.ContinuousTier; +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.DatabaseRestoreResource; +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.MinimalTlsVersion; +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/stable/2024-11-15/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))) + .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) + .withCreateMode(CreateMode.RESTORE) + .withBackupPolicy(new ContinuousModeBackupPolicy() + .withContinuousModeProperties(new ContinuousModeProperties().withTier(ContinuousTier.CONTINUOUS30DAYS))) + .withRestoreParameters(new RestoreParameters().withRestoreSource( + "/subscriptions/subid/providers/Microsoft.DocumentDB/locations/westus/restorableDatabaseAccounts/1a97b4bb-f6a0-430e-ade1-638d781830cc") + .withRestoreTimestampInUtc(OffsetDateTime.parse("2021-03-11T22:05:09Z")) + .withRestoreWithTtlDisabled(false) + .withRestoreMode(RestoreMode.POINT_IN_TIME) + .withDatabasesToRestore(Arrays.asList( + new DatabaseRestoreResource().withDatabaseName("db1") + .withCollectionNames(Arrays.asList("collection1", "collection2")), + new DatabaseRestoreResource().withDatabaseName("db2") + .withCollectionNames(Arrays.asList("collection3", "collection4"))))) + .withMinimalTlsVersion(MinimalTlsVersion.TLS) + .create(); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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))) + .withTags(mapOf()) + .withKind(DatabaseAccountKind.MONGO_DB) + .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))) + .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)) + .withCreateMode(CreateMode.DEFAULT) + .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")) + .withCapacity(new Capacity().withTotalThroughputLimit(2000)) + .withMinimalTlsVersion(MinimalTlsVersion.TLS12) + .withEnableBurstCapacity(true) + .withEnablePerRegionPerPartitionAutoscale(true) + .create(); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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(); + } + + // Use "Map.of" if available + @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 +/** + * Samples for DatabaseAccounts Delete. + */ +public final class DatabaseAccountsDeleteSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### DatabaseAccounts_FailoverPriorityChange + +```java +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/stable/2024-11-15/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))), + com.azure.core.util.Context.NONE); + } +} +``` + +### DatabaseAccounts_GetByResourceGroup + +```java +/** + * Samples for DatabaseAccounts GetByResourceGroup. + */ +public final class DatabaseAccountsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### DatabaseAccounts_GetReadOnlyKeys + +```java +/** + * Samples for DatabaseAccounts GetReadOnlyKeys. + */ +public final class DatabaseAccountsGetReadOnlyKeysSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### DatabaseAccounts_List + +```java +/** + * Samples for DatabaseAccounts List. + */ +public final class DatabaseAccountsListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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(com.azure.core.util.Context.NONE); + } +} +``` + +### DatabaseAccounts_ListByResourceGroup + +```java +/** + * Samples for DatabaseAccounts ListByResourceGroup. + */ +public final class DatabaseAccountsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### DatabaseAccounts_ListConnectionStrings + +```java +/** + * Samples for DatabaseAccounts ListConnectionStrings. + */ +public final class DatabaseAccountsListConnectionStringsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### DatabaseAccounts_ListKeys + +```java +/** + * Samples for DatabaseAccounts ListKeys. + */ +public final class DatabaseAccountsListKeysSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### DatabaseAccounts_ListMetricDefinitions + +```java +/** + * Samples for DatabaseAccounts ListMetricDefinitions. + */ +public final class DatabaseAccountsListMetricDefinitionsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### DatabaseAccounts_ListMetrics + +```java +/** + * Samples for DatabaseAccounts ListMetrics. + */ +public final class DatabaseAccountsListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.Context.NONE); + } +} +``` + +### DatabaseAccounts_ListReadOnlyKeys + +```java +/** + * Samples for DatabaseAccounts ListReadOnlyKeys. + */ +public final class DatabaseAccountsListReadOnlyKeysSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### DatabaseAccounts_ListUsages + +```java +/** + * Samples for DatabaseAccounts ListUsages. + */ +public final class DatabaseAccountsListUsagesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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'", com.azure.core.util.Context.NONE); + } +} +``` + +### DatabaseAccounts_OfflineRegion + +```java +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/stable/2024-11-15/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().withRegion("North Europe"), + com.azure.core.util.Context.NONE); + } +} +``` + +### DatabaseAccounts_OnlineRegion + +```java +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/stable/2024-11-15/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().withRegion("North Europe"), + com.azure.core.util.Context.NONE); + } +} +``` + +### DatabaseAccounts_RegenerateKey + +```java +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/stable/2024-11-15/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), + com.azure.core.util.Context.NONE); + } +} +``` + +### DatabaseAccounts_Update + +```java +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.Capacity; +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.IpAddressOrRange; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentity; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentityUserAssignedIdentities; +import com.azure.resourcemanager.cosmos.generated.models.MinimalTlsVersion; +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/stable/2024-11-15/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", com.azure.core.util.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.LOCAL))) + .withNetworkAclBypass(NetworkAclBypass.AZURE_SERVICES) + .withNetworkAclBypassResourceIds(Arrays.asList( + "/subscriptions/subId/resourcegroups/rgName/providers/Microsoft.Synapse/workspaces/workspaceName")) + .withCapacity(new Capacity().withTotalThroughputLimit(2000)) + .withEnablePartitionMerge(true) + .withMinimalTlsVersion(MinimalTlsVersion.TLS) + .withEnableBurstCapacity(true) + .withEnablePerRegionPerPartitionAutoscale(true) + .apply(); + } + + // Use "Map.of" if available + @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_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/stable/2024-11-15/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(); + } + + // Use "Map.of" if available + @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/stable/2024-11-15/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(); + } + + // Use "Map.of" if available + @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 +/** + * Samples for GremlinResources DeleteGremlinDatabase. + */ +public final class GremlinResourcesDeleteGremlinDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### GremlinResources_DeleteGremlinGraph + +```java +/** + * Samples for GremlinResources DeleteGremlinGraph. + */ +public final class GremlinResourcesDeleteGremlinGraphSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### GremlinResources_GetGremlinDatabase + +```java +/** + * Samples for GremlinResources GetGremlinDatabase. + */ +public final class GremlinResourcesGetGremlinDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### GremlinResources_GetGremlinDatabaseThroughput + +```java +/** + * Samples for GremlinResources GetGremlinDatabaseThroughput. + */ +public final class GremlinResourcesGetGremlinDatabaseThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### GremlinResources_GetGremlinGraph + +```java +/** + * Samples for GremlinResources GetGremlinGraph. + */ +public final class GremlinResourcesGetGremlinGraphSamples { + /* + * x-ms-original-file: + * specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.Context.NONE); + } +} +``` + +### GremlinResources_GetGremlinGraphThroughput + +```java +/** + * Samples for GremlinResources GetGremlinGraphThroughput. + */ +public final class GremlinResourcesGetGremlinGraphThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.Context.NONE); + } +} +``` + +### GremlinResources_ListGremlinDatabases + +```java +/** + * Samples for GremlinResources ListGremlinDatabases. + */ +public final class GremlinResourcesListGremlinDatabasesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### GremlinResources_ListGremlinGraphs + +```java +/** + * Samples for GremlinResources ListGremlinGraphs. + */ +public final class GremlinResourcesListGremlinGraphsSamples { + /* + * x-ms-original-file: + * specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### GremlinResources_MigrateGremlinDatabaseToAutoscale + +```java +/** + * Samples for GremlinResources MigrateGremlinDatabaseToAutoscale. + */ +public final class GremlinResourcesMigrateGremlinDatabaseToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### GremlinResources_MigrateGremlinDatabaseToManualThroughput + +```java +/** + * Samples for GremlinResources MigrateGremlinDatabaseToManualThroughput. + */ +public final class GremlinResourcesMigrateGremlinDatabaseToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### GremlinResources_MigrateGremlinGraphToAutoscale + +```java +/** + * Samples for GremlinResources MigrateGremlinGraphToAutoscale. + */ +public final class GremlinResourcesMigrateGremlinGraphToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.Context.NONE); + } +} +``` + +### GremlinResources_MigrateGremlinGraphToManualThroughput + +```java +/** + * Samples for GremlinResources MigrateGremlinGraphToManualThroughput. + */ +public final class GremlinResourcesMigrateGremlinGraphToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.Context.NONE); + } +} +``` + +### GremlinResources_RetrieveContinuousBackupInformation + +```java +import com.azure.resourcemanager.cosmos.generated.models.ContinuousBackupRestoreLocation; + +/** + * Samples for GremlinResources RetrieveContinuousBackupInformation. + */ +public final class GremlinResourcesRetrieveContinuousBackupInformationSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBGremlinGraphBackupInformation.json + */ + /** + * Sample code: CosmosDBGremlinGraphBackupInformation. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + cosmosDBGremlinGraphBackupInformation(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.gremlinResources() + .retrieveContinuousBackupInformation("rgName", "ddb1", "databaseName", "graphName", + new ContinuousBackupRestoreLocation().withLocation("North Europe"), com.azure.core.util.Context.NONE); + } +} +``` + +### GremlinResources_UpdateGremlinDatabaseThroughput + +```java +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/stable/2024-11-15/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)), + com.azure.core.util.Context.NONE); + } + + // Use "Map.of" if available + @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.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/stable/2024-11-15/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)), + com.azure.core.util.Context.NONE); + } + + // Use "Map.of" if available + @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; + } +} +``` + +### Locations_Get + +```java +/** + * Samples for Locations Get. + */ +public final class LocationsGetSamples { + /* + * x-ms-original-file: + * specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBLocationGet.json + */ + /** + * Sample code: CosmosDBLocationGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBLocationGet(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.locations().getWithResponse("westus", com.azure.core.util.Context.NONE); + } +} +``` + +### Locations_List + +```java +/** + * Samples for Locations List. + */ +public final class LocationsListSamples { + /* + * x-ms-original-file: + * specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBLocationList. + * json + */ + /** + * Sample code: CosmosDBLocationList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBLocationList(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.locations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### 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/stable/2024-11-15/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", "fakeTokenPlaceholder")) + .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")))))) + .withTags(mapOf()) + .withOptions(new CreateUpdateOptions()) + .create(); + } + + // Use "Map.of" if available + @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/stable/2024-11-15/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(); + } + + // Use "Map.of" if available + @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_CreateUpdateMongoRoleDefinition + +```java +import com.azure.resourcemanager.cosmos.generated.models.Privilege; +import com.azure.resourcemanager.cosmos.generated.models.PrivilegeResource; +import com.azure.resourcemanager.cosmos.generated.models.Role; +import java.util.Arrays; + +/** + * Samples for MongoDBResources CreateUpdateMongoRoleDefinition. + */ +public final class MongoDBResourcesCreateUpdateMongoRoleDefinitionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBMongoDBRoleDefinitionCreateUpdate.json + */ + /** + * Sample code: CosmosDBMongoDBRoleDefinitionCreateUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + cosmosDBMongoDBRoleDefinitionCreateUpdate(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.mongoDBResources() + .defineUpdateMongoRoleDefinition("myMongoRoleDefinitionId") + .withExistingDatabaseAccount("myResourceGroupName", "myAccountName") + .withRoleName("myRoleName") + .withDatabaseName("sales") + .withPrivileges(Arrays + .asList(new Privilege().withResource(new PrivilegeResource().withDb("sales").withCollection("sales")) + .withActions(Arrays.asList("insert", "find")))) + .withRoles(Arrays.asList(new Role().withDb("sales").withRole("myInheritedRole"))) + .create(); + } +} +``` + +### MongoDBResources_CreateUpdateMongoUserDefinition + +```java +import com.azure.resourcemanager.cosmos.generated.models.Role; +import java.util.Arrays; + +/** + * Samples for MongoDBResources CreateUpdateMongoUserDefinition. + */ +public final class MongoDBResourcesCreateUpdateMongoUserDefinitionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBMongoDBUserDefinitionCreateUpdate.json + */ + /** + * Sample code: CosmosDBMongoDBUserDefinitionCreateUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + cosmosDBMongoDBUserDefinitionCreateUpdate(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.mongoDBResources() + .defineUpdateMongoUserDefinition("myMongoUserDefinitionId") + .withExistingDatabaseAccount("myResourceGroupName", "myAccountName") + .withUsername("myUserName") + .withPassword("myPassword") + .withDatabaseName("sales") + .withCustomData("My custom data") + .withRoles(Arrays.asList(new Role().withDb("sales").withRole("myReadRole"))) + .withMechanisms("SCRAM-SHA-256") + .create(); + } +} +``` + +### MongoDBResources_DeleteMongoDBCollection + +```java +/** + * Samples for MongoDBResources DeleteMongoDBCollection. + */ +public final class MongoDBResourcesDeleteMongoDBCollectionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### MongoDBResources_DeleteMongoDBDatabase + +```java +/** + * Samples for MongoDBResources DeleteMongoDBDatabase. + */ +public final class MongoDBResourcesDeleteMongoDBDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### MongoDBResources_DeleteMongoRoleDefinition + +```java +/** + * Samples for MongoDBResources DeleteMongoRoleDefinition. + */ +public final class MongoDBResourcesDeleteMongoRoleDefinitionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBMongoDBRoleDefinitionDelete.json + */ + /** + * Sample code: CosmosDBMongoDBRoleDefinitionDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + cosmosDBMongoDBRoleDefinitionDelete(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.mongoDBResources() + .deleteMongoRoleDefinition("myMongoRoleDefinitionId", "myResourceGroupName", "myAccountName", + com.azure.core.util.Context.NONE); + } +} +``` + +### MongoDBResources_DeleteMongoUserDefinition + +```java +/** + * Samples for MongoDBResources DeleteMongoUserDefinition. + */ +public final class MongoDBResourcesDeleteMongoUserDefinitionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBMongoDBUserDefinitionDelete.json + */ + /** + * Sample code: CosmosDBMongoDBUserDefinitionDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + cosmosDBMongoDBUserDefinitionDelete(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.mongoDBResources() + .deleteMongoUserDefinition("myMongoUserDefinitionId", "myResourceGroupName", "myAccountName", + com.azure.core.util.Context.NONE); + } +} +``` + +### MongoDBResources_GetMongoDBCollection + +```java +/** + * Samples for MongoDBResources GetMongoDBCollection. + */ +public final class MongoDBResourcesGetMongoDBCollectionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.Context.NONE); + } +} +``` + +### MongoDBResources_GetMongoDBCollectionThroughput + +```java +/** + * Samples for MongoDBResources GetMongoDBCollectionThroughput. + */ +public final class MongoDBResourcesGetMongoDBCollectionThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.Context.NONE); + } +} +``` + +### MongoDBResources_GetMongoDBDatabase + +```java +/** + * Samples for MongoDBResources GetMongoDBDatabase. + */ +public final class MongoDBResourcesGetMongoDBDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### MongoDBResources_GetMongoDBDatabaseThroughput + +```java +/** + * Samples for MongoDBResources GetMongoDBDatabaseThroughput. + */ +public final class MongoDBResourcesGetMongoDBDatabaseThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### MongoDBResources_GetMongoRoleDefinition + +```java +/** + * Samples for MongoDBResources GetMongoRoleDefinition. + */ +public final class MongoDBResourcesGetMongoRoleDefinitionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBMongoDBRoleDefinitionGet.json + */ + /** + * Sample code: CosmosDBMongoRoleDefinitionGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + cosmosDBMongoRoleDefinitionGet(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.mongoDBResources() + .getMongoRoleDefinitionWithResponse("myMongoRoleDefinitionId", "myResourceGroupName", "myAccountName", + com.azure.core.util.Context.NONE); + } +} +``` + +### MongoDBResources_GetMongoUserDefinition + +```java +/** + * Samples for MongoDBResources GetMongoUserDefinition. + */ +public final class MongoDBResourcesGetMongoUserDefinitionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBMongoDBUserDefinitionGet.json + */ + /** + * Sample code: CosmosDBMongoDBUserDefinitionGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + cosmosDBMongoDBUserDefinitionGet(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.mongoDBResources() + .getMongoUserDefinitionWithResponse("myMongoUserDefinitionId", "myResourceGroupName", "myAccountName", + com.azure.core.util.Context.NONE); + } +} +``` + +### MongoDBResources_ListMongoDBCollections + +```java +/** + * Samples for MongoDBResources ListMongoDBCollections. + */ +public final class MongoDBResourcesListMongoDBCollectionsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### MongoDBResources_ListMongoDBDatabases + +```java +/** + * Samples for MongoDBResources ListMongoDBDatabases. + */ +public final class MongoDBResourcesListMongoDBDatabasesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### MongoDBResources_ListMongoRoleDefinitions + +```java +/** + * Samples for MongoDBResources ListMongoRoleDefinitions. + */ +public final class MongoDBResourcesListMongoRoleDefinitionsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBMongoDBRoleDefinitionList.json + */ + /** + * Sample code: CosmosDBMongoDBRoleDefinitionList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + cosmosDBMongoDBRoleDefinitionList(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.mongoDBResources() + .listMongoRoleDefinitions("myResourceGroupName", "myAccountName", com.azure.core.util.Context.NONE); + } +} +``` + +### MongoDBResources_ListMongoUserDefinitions + +```java +/** + * Samples for MongoDBResources ListMongoUserDefinitions. + */ +public final class MongoDBResourcesListMongoUserDefinitionsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBMongoDBUserDefinitionList.json + */ + /** + * Sample code: CosmosDBMongoDBUserDefinitionList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + cosmosDBMongoDBUserDefinitionList(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.mongoDBResources() + .listMongoUserDefinitions("myResourceGroupName", "myAccountName", com.azure.core.util.Context.NONE); + } +} +``` + +### MongoDBResources_MigrateMongoDBCollectionToAutoscale + +```java +/** + * Samples for MongoDBResources MigrateMongoDBCollectionToAutoscale. + */ +public final class MongoDBResourcesMigrateMongoDBCollectionToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.Context.NONE); + } +} +``` + +### MongoDBResources_MigrateMongoDBCollectionToManualThroughput + +```java +/** + * Samples for MongoDBResources MigrateMongoDBCollectionToManualThroughput. + */ +public final class MongoDBResourcesMigrateMongoDBCollectionToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.Context.NONE); + } +} +``` + +### MongoDBResources_MigrateMongoDBDatabaseToAutoscale + +```java +/** + * Samples for MongoDBResources MigrateMongoDBDatabaseToAutoscale. + */ +public final class MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### MongoDBResources_MigrateMongoDBDatabaseToManualThroughput + +```java +/** + * Samples for MongoDBResources MigrateMongoDBDatabaseToManualThroughput. + */ +public final class MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### MongoDBResources_RetrieveContinuousBackupInformation + +```java +import com.azure.resourcemanager.cosmos.generated.models.ContinuousBackupRestoreLocation; + +/** + * Samples for MongoDBResources RetrieveContinuousBackupInformation. + */ +public final class MongoDBResourcesRetrieveContinuousBackupInformationSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBMongoDBCollectionBackupInformation.json + */ + /** + * Sample code: CosmosDBMongoDBCollectionBackupInformation. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + cosmosDBMongoDBCollectionBackupInformation(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.mongoDBResources() + .retrieveContinuousBackupInformation("rgName", "ddb1", "databaseName", "collectionName", + new ContinuousBackupRestoreLocation().withLocation("North Europe"), com.azure.core.util.Context.NONE); + } +} +``` + +### MongoDBResources_UpdateMongoDBCollectionThroughput + +```java +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/stable/2024-11-15/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)), + com.azure.core.util.Context.NONE); + } + + // Use "Map.of" if available + @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.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/stable/2024-11-15/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)), + com.azure.core.util.Context.NONE); + } + + // Use "Map.of" if available + @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/stable/2024-11-15/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.resourcemanager.cosmos.generated.models.NotebookWorkspaceName; + +/** + * Samples for NotebookWorkspaces Delete. + */ +public final class NotebookWorkspacesDeleteSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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, com.azure.core.util.Context.NONE); + } +} +``` + +### NotebookWorkspaces_Get + +```java +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/stable/2024-11-15/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, com.azure.core.util.Context.NONE); + } +} +``` + +### NotebookWorkspaces_ListByDatabaseAccount + +```java +/** + * Samples for NotebookWorkspaces ListByDatabaseAccount. + */ +public final class NotebookWorkspacesListByDatabaseAccountSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### NotebookWorkspaces_ListConnectionInfo + +```java +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/stable/2024-11-15/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, + com.azure.core.util.Context.NONE); + } +} +``` + +### NotebookWorkspaces_RegenerateAuthToken + +```java +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/stable/2024-11-15/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, com.azure.core.util.Context.NONE); + } +} +``` + +### NotebookWorkspaces_Start + +```java +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/stable/2024-11-15/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, com.azure.core.util.Context.NONE); + } +} +``` + +### Operations_List + +```java +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: + * specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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(com.azure.core.util.Context.NONE); + } +} +``` + +### PartitionKeyRangeId_ListMetrics + +```java +/** + * Samples for PartitionKeyRangeId ListMetrics. + */ +public final class PartitionKeyRangeIdListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.Context.NONE); + } +} +``` + +### PartitionKeyRangeIdRegion_ListMetrics + +```java +/** + * Samples for PartitionKeyRangeIdRegion ListMetrics. + */ +public final class PartitionKeyRangeIdRegionListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.Context.NONE); + } +} +``` + +### Percentile_ListMetrics + +```java +/** + * Samples for Percentile ListMetrics. + */ +public final class PercentileListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.Context.NONE); + } +} +``` + +### PercentileSourceTarget_ListMetrics + +```java +/** + * Samples for PercentileSourceTarget ListMetrics. + */ +public final class PercentileSourceTargetListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.Context.NONE); + } +} +``` + +### PercentileTarget_ListMetrics + +```java +/** + * Samples for PercentileTarget ListMetrics. + */ +public final class PercentileTargetListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.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/stable/2024-11-15/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 +/** + * Samples for PrivateEndpointConnections Delete. + */ +public final class PrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### PrivateEndpointConnections_Get + +```java +/** + * Samples for PrivateEndpointConnections Get. + */ +public final class PrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### PrivateEndpointConnections_ListByDatabaseAccount + +```java +/** + * Samples for PrivateEndpointConnections ListByDatabaseAccount. + */ +public final class PrivateEndpointConnectionsListByDatabaseAccountSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### PrivateLinkResources_Get + +```java +/** + * Samples for PrivateLinkResources Get. + */ +public final class PrivateLinkResourcesGetSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### PrivateLinkResources_ListByDatabaseAccount + +```java +/** + * Samples for PrivateLinkResources ListByDatabaseAccount. + */ +public final class PrivateLinkResourcesListByDatabaseAccountSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### RestorableDatabaseAccounts_GetByLocation + +```java +/** + * Samples for RestorableDatabaseAccounts GetByLocation. + */ +public final class RestorableDatabaseAccountsGetByLocationSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.Context.NONE); + } +} +``` + +### RestorableDatabaseAccounts_List + +```java +/** + * Samples for RestorableDatabaseAccounts List. + */ +public final class RestorableDatabaseAccountsListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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(com.azure.core.util.Context.NONE); + } +} +``` + +### RestorableDatabaseAccounts_ListByLocation + +```java +/** + * Samples for RestorableDatabaseAccounts ListByLocation. + */ +public final class RestorableDatabaseAccountsListByLocationSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### RestorableGremlinDatabases_List + +```java +/** + * Samples for RestorableGremlinDatabases List. + */ +public final class RestorableGremlinDatabasesListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBRestorableGremlinDatabaseList.json + */ + /** + * Sample code: CosmosDBRestorableGremlinDatabaseList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + cosmosDBRestorableGremlinDatabaseList(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.restorableGremlinDatabases() + .list("WestUS", "d9b26648-2f53-4541-b3d8-3044f4f9810d", com.azure.core.util.Context.NONE); + } +} +``` + +### RestorableGremlinGraphs_List + +```java +/** + * Samples for RestorableGremlinGraphs List. + */ +public final class RestorableGremlinGraphsListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBRestorableGremlinGraphList.json + */ + /** + * Sample code: CosmosDBRestorableGremlinGraphList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + cosmosDBRestorableGremlinGraphList(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.restorableGremlinGraphs() + .list("WestUS", "98a570f2-63db-4117-91f0-366327b7b353", "PD5DALigDgw=", null, null, + com.azure.core.util.Context.NONE); + } +} +``` + +### RestorableGremlinResources_List + +```java +/** + * Samples for RestorableGremlinResources List. + */ +public final class RestorableGremlinResourcesListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBRestorableGremlinResourceList.json + */ + /** + * Sample code: CosmosDBRestorableGremlinResourceList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + cosmosDBRestorableGremlinResourceList(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.restorableGremlinResources() + .list("WestUS", "d9b26648-2f53-4541-b3d8-3044f4f9810d", "WestUS", "06/01/2022 4:56", + com.azure.core.util.Context.NONE); + } +} +``` + +### RestorableMongodbCollections_List + +```java +/** + * Samples for RestorableMongodbCollections List. + */ +public final class RestorableMongodbCollectionsListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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=", null, null, + com.azure.core.util.Context.NONE); + } +} +``` + +### RestorableMongodbDatabases_List + +```java +/** + * Samples for RestorableMongodbDatabases List. + */ +public final class RestorableMongodbDatabasesListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### RestorableMongodbResources_List + +```java +/** + * Samples for RestorableMongodbResources List. + */ +public final class RestorableMongodbResourcesListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", "06/01/2022 4:56", + com.azure.core.util.Context.NONE); + } +} +``` + +### RestorableSqlContainers_List + +```java +/** + * Samples for RestorableSqlContainers List. + */ +public final class RestorableSqlContainersListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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, + com.azure.core.util.Context.NONE); + } +} +``` + +### RestorableSqlDatabases_List + +```java +/** + * Samples for RestorableSqlDatabases List. + */ +public final class RestorableSqlDatabasesListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### RestorableSqlResources_List + +```java +/** + * Samples for RestorableSqlResources List. + */ +public final class RestorableSqlResourcesListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", "06/01/2022 4:56", + com.azure.core.util.Context.NONE); + } +} +``` + +### RestorableTableResources_List + +```java +/** + * Samples for RestorableTableResources List. + */ +public final class RestorableTableResourcesListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBRestorableTableResourceList.json + */ + /** + * Sample code: CosmosDBRestorableTableResourceList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + cosmosDBRestorableTableResourceList(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.restorableTableResources() + .list("WestUS", "d9b26648-2f53-4541-b3d8-3044f4f9810d", "WestUS", "06/01/2022 4:56", + com.azure.core.util.Context.NONE); + } +} +``` + +### RestorableTables_List + +```java +/** + * Samples for RestorableTables List. + */ +public final class RestorableTablesListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBRestorableTableList.json + */ + /** + * Sample code: CosmosDBRestorableTableList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBRestorableTableList(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.restorableTables() + .list("WestUS", "98a570f2-63db-4117-91f0-366327b7b353", null, null, com.azure.core.util.Context.NONE); + } +} +``` + +### Service_Create + +```java +import com.azure.resourcemanager.cosmos.generated.models.DataTransferServiceResourceCreateUpdateProperties; +import com.azure.resourcemanager.cosmos.generated.models.DedicatedGatewayType; +import com.azure.resourcemanager.cosmos.generated.models.GraphApiComputeServiceResourceCreateUpdateProperties; +import com.azure.resourcemanager.cosmos.generated.models.MaterializedViewsBuilderServiceResourceCreateUpdateProperties; +import com.azure.resourcemanager.cosmos.generated.models.ServiceSize; +import com.azure.resourcemanager.cosmos.generated.models.SqlDedicatedGatewayServiceResourceCreateUpdateProperties; + +/** + * Samples for Service Create. + */ +public final class ServiceCreateSamples { + /* + * x-ms-original-file: + * specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/services/ + * sqldedicatedgateway/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") + .withProperties( + new SqlDedicatedGatewayServiceResourceCreateUpdateProperties().withInstanceSize(ServiceSize.COSMOS_D4S) + .withInstanceCount(1) + .withDedicatedGatewayType(DedicatedGatewayType.INTEGRATED_CACHE)) + .create(); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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") + .withProperties( + new DataTransferServiceResourceCreateUpdateProperties().withInstanceSize(ServiceSize.COSMOS_D4S) + .withInstanceCount(1)) + .create(); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBMaterializedViewsBuilderServiceCreate.json + */ + /** + * Sample code: MaterializedViewsBuilderServiceCreate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + materializedViewsBuilderServiceCreate(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.services() + .define("MaterializedViewsBuilder") + .withExistingDatabaseAccount("rg1", "ddb1") + .withProperties(new MaterializedViewsBuilderServiceResourceCreateUpdateProperties() + .withInstanceSize(ServiceSize.COSMOS_D4S) + .withInstanceCount(1)) + .create(); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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") + .withProperties( + new GraphApiComputeServiceResourceCreateUpdateProperties().withInstanceSize(ServiceSize.COSMOS_D4S) + .withInstanceCount(1)) + .create(); + } +} +``` + +### Service_Delete + +```java +/** + * Samples for Service Delete. + */ +public final class ServiceDeleteSamples { + /* + * x-ms-original-file: + * specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/services/ + * sqldedicatedgateway/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", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBMaterializedViewsBuilderServiceDelete.json + */ + /** + * Sample code: MaterializedViewsBuilderServiceDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + materializedViewsBuilderServiceDelete(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.services().delete("rg1", "ddb1", "MaterializedViewsBuilder", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### Service_Get + +```java +/** + * Samples for Service Get. + */ +public final class ServiceGetSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/services/ + * sqldedicatedgateway/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", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBMaterializedViewsBuilderServiceGet.json + */ + /** + * Sample code: MaterializedViewsBuilderServiceGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + materializedViewsBuilderServiceGet(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.services().getWithResponse("rg1", "ddb1", "MaterializedViewsBuilder", com.azure.core.util.Context.NONE); + } +} +``` + +### Service_List + +```java +/** + * Samples for Service List. + */ +public final class ServiceListSamples { + /* + * x-ms-original-file: + * specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlResources_CreateUpdateClientEncryptionKey + +```java +import com.azure.resourcemanager.cosmos.generated.models.ClientEncryptionKeyResource; +import com.azure.resourcemanager.cosmos.generated.models.KeyWrapMetadata; + +/** + * Samples for SqlResources CreateUpdateClientEncryptionKey. + */ +public final class SqlResourcesCreateUpdateClientEncryptionKeySamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBSqlClientEncryptionKeyCreateUpdate.json + */ + /** + * Sample code: CosmosDBClientEncryptionKeyCreateUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + cosmosDBClientEncryptionKeyCreateUpdate(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.sqlResources() + .defineUpdateClientEncryptionKey("cekName") + .withExistingSqlDatabase("rgName", "accountName", "databaseName") + .withResource(new ClientEncryptionKeyResource().withId("cekName") + .withEncryptionAlgorithm("AEAD_AES_256_CBC_HMAC_SHA256") + .withWrappedDataEncryptionKey("U3dhZ2dlciByb2Nrcw==".getBytes()) + .withKeyWrapMetadata(new KeyWrapMetadata().withName("customerManagedKey") + .withType("AzureKeyVault") + .withValue("AzureKeyVault Key URL") + .withAlgorithm("RSA-OAEP"))) + .create(); + } +} +``` + +### SqlResources_CreateUpdateSqlContainer + +```java +import com.azure.resourcemanager.cosmos.generated.models.ClientEncryptionIncludedPath; +import com.azure.resourcemanager.cosmos.generated.models.ClientEncryptionPolicy; +import com.azure.resourcemanager.cosmos.generated.models.ComputedProperty; +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/stable/2024-11-15/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")) + .withClientEncryptionPolicy(new ClientEncryptionPolicy() + .withIncludedPaths(Arrays.asList(new ClientEncryptionIncludedPath().withPath("/path") + .withClientEncryptionKeyId("fakeTokenPlaceholder") + .withEncryptionType("Deterministic") + .withEncryptionAlgorithm("AEAD_AES_256_CBC_HMAC_SHA256"))) + .withPolicyFormatVersion(2)) + .withComputedProperties(Arrays.asList( + new ComputedProperty().withName("cp_lowerName").withQuery("SELECT VALUE LOWER(c.name) FROM c")))) + .withTags(mapOf()) + .withOptions(new CreateUpdateOptions()) + .create(); + } + + // Use "Map.of" if available + @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/stable/2024-11-15/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(); + } + + // Use "Map.of" if available + @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/stable/2024-11-15/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/stable/2024-11-15/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/stable/2024-11-15/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/stable/2024-11-15/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/stable/2024-11-15/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 +/** + * Samples for SqlResources DeleteSqlContainer. + */ +public final class SqlResourcesDeleteSqlContainerSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlResources_DeleteSqlDatabase + +```java +/** + * Samples for SqlResources DeleteSqlDatabase. + */ +public final class SqlResourcesDeleteSqlDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlResources_DeleteSqlRoleAssignment + +```java +/** + * Samples for SqlResources DeleteSqlRoleAssignment. + */ +public final class SqlResourcesDeleteSqlRoleAssignmentSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.Context.NONE); + } +} +``` + +### SqlResources_DeleteSqlRoleDefinition + +```java +/** + * Samples for SqlResources DeleteSqlRoleDefinition. + */ +public final class SqlResourcesDeleteSqlRoleDefinitionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.Context.NONE); + } +} +``` + +### SqlResources_DeleteSqlStoredProcedure + +```java +/** + * Samples for SqlResources DeleteSqlStoredProcedure. + */ +public final class SqlResourcesDeleteSqlStoredProcedureSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.Context.NONE); + } +} +``` + +### SqlResources_DeleteSqlTrigger + +```java +/** + * Samples for SqlResources DeleteSqlTrigger. + */ +public final class SqlResourcesDeleteSqlTriggerSamples { + /* + * x-ms-original-file: + * specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.Context.NONE); + } +} +``` + +### SqlResources_DeleteSqlUserDefinedFunction + +```java +/** + * Samples for SqlResources DeleteSqlUserDefinedFunction. + */ +public final class SqlResourcesDeleteSqlUserDefinedFunctionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.Context.NONE); + } +} +``` + +### SqlResources_GetClientEncryptionKey + +```java +/** + * Samples for SqlResources GetClientEncryptionKey. + */ +public final class SqlResourcesGetClientEncryptionKeySamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBSqlClientEncryptionKeyGet.json + */ + /** + * Sample code: CosmosDBClientEncryptionKeyGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + cosmosDBClientEncryptionKeyGet(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.sqlResources() + .getClientEncryptionKeyWithResponse("rgName", "accountName", "databaseName", "cekName", + com.azure.core.util.Context.NONE); + } +} +``` + +### SqlResources_GetSqlContainer + +```java +/** + * Samples for SqlResources GetSqlContainer. + */ +public final class SqlResourcesGetSqlContainerSamples { + /* + * x-ms-original-file: + * specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.Context.NONE); + } +} +``` + +### SqlResources_GetSqlContainerThroughput + +```java +/** + * Samples for SqlResources GetSqlContainerThroughput. + */ +public final class SqlResourcesGetSqlContainerThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.Context.NONE); + } +} +``` + +### SqlResources_GetSqlDatabase + +```java +/** + * Samples for SqlResources GetSqlDatabase. + */ +public final class SqlResourcesGetSqlDatabaseSamples { + /* + * x-ms-original-file: + * specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlResources_GetSqlDatabaseThroughput + +```java +/** + * Samples for SqlResources GetSqlDatabaseThroughput. + */ +public final class SqlResourcesGetSqlDatabaseThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlResources_GetSqlRoleAssignment + +```java +/** + * Samples for SqlResources GetSqlRoleAssignment. + */ +public final class SqlResourcesGetSqlRoleAssignmentSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.Context.NONE); + } +} +``` + +### SqlResources_GetSqlRoleDefinition + +```java +/** + * Samples for SqlResources GetSqlRoleDefinition. + */ +public final class SqlResourcesGetSqlRoleDefinitionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.Context.NONE); + } +} +``` + +### SqlResources_GetSqlStoredProcedure + +```java +/** + * Samples for SqlResources GetSqlStoredProcedure. + */ +public final class SqlResourcesGetSqlStoredProcedureSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.Context.NONE); + } +} +``` + +### SqlResources_GetSqlTrigger + +```java +/** + * Samples for SqlResources GetSqlTrigger. + */ +public final class SqlResourcesGetSqlTriggerSamples { + /* + * x-ms-original-file: + * specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.Context.NONE); + } +} +``` + +### SqlResources_GetSqlUserDefinedFunction + +```java +/** + * Samples for SqlResources GetSqlUserDefinedFunction. + */ +public final class SqlResourcesGetSqlUserDefinedFunctionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlResources_ListClientEncryptionKeys + +```java +/** + * Samples for SqlResources ListClientEncryptionKeys. + */ +public final class SqlResourcesListClientEncryptionKeysSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBSqlClientEncryptionKeysList.json + */ + /** + * Sample code: CosmosDBClientEncryptionKeysList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + cosmosDBClientEncryptionKeysList(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.sqlResources() + .listClientEncryptionKeys("rgName", "accountName", "databaseName", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlResources_ListSqlContainers + +```java +/** + * Samples for SqlResources ListSqlContainers. + */ +public final class SqlResourcesListSqlContainersSamples { + /* + * x-ms-original-file: + * specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlResources_ListSqlDatabases + +```java +/** + * Samples for SqlResources ListSqlDatabases. + */ +public final class SqlResourcesListSqlDatabasesSamples { + /* + * x-ms-original-file: + * specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlResources_ListSqlRoleAssignments + +```java +/** + * Samples for SqlResources ListSqlRoleAssignments. + */ +public final class SqlResourcesListSqlRoleAssignmentsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlResources_ListSqlRoleDefinitions + +```java +/** + * Samples for SqlResources ListSqlRoleDefinitions. + */ +public final class SqlResourcesListSqlRoleDefinitionsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlResources_ListSqlStoredProcedures + +```java +/** + * Samples for SqlResources ListSqlStoredProcedures. + */ +public final class SqlResourcesListSqlStoredProceduresSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.Context.NONE); + } +} +``` + +### SqlResources_ListSqlTriggers + +```java +/** + * Samples for SqlResources ListSqlTriggers. + */ +public final class SqlResourcesListSqlTriggersSamples { + /* + * x-ms-original-file: + * specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlResources_ListSqlUserDefinedFunctions + +```java +/** + * Samples for SqlResources ListSqlUserDefinedFunctions. + */ +public final class SqlResourcesListSqlUserDefinedFunctionsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.Context.NONE); + } +} +``` + +### SqlResources_MigrateSqlContainerToAutoscale + +```java +/** + * Samples for SqlResources MigrateSqlContainerToAutoscale. + */ +public final class SqlResourcesMigrateSqlContainerToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.Context.NONE); + } +} +``` + +### SqlResources_MigrateSqlContainerToManualThroughput + +```java +/** + * Samples for SqlResources MigrateSqlContainerToManualThroughput. + */ +public final class SqlResourcesMigrateSqlContainerToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.Context.NONE); + } +} +``` + +### SqlResources_MigrateSqlDatabaseToAutoscale + +```java +/** + * Samples for SqlResources MigrateSqlDatabaseToAutoscale. + */ +public final class SqlResourcesMigrateSqlDatabaseToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlResources_MigrateSqlDatabaseToManualThroughput + +```java +/** + * Samples for SqlResources MigrateSqlDatabaseToManualThroughput. + */ +public final class SqlResourcesMigrateSqlDatabaseToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlResources_RetrieveContinuousBackupInformation + +```java +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/stable/2024-11-15/examples/ + * CosmosDBSqlContainerBackupInformation.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"), com.azure.core.util.Context.NONE); + } +} +``` + +### SqlResources_UpdateSqlContainerThroughput + +```java +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/stable/2024-11-15/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)), + com.azure.core.util.Context.NONE); + } + + // Use "Map.of" if available + @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.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/stable/2024-11-15/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)), + com.azure.core.util.Context.NONE); + } + + // Use "Map.of" if available + @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/stable/2024-11-15/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(); + } + + // Use "Map.of" if available + @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 +/** + * Samples for TableResources DeleteTable. + */ +public final class TableResourcesDeleteTableSamples { + /* + * x-ms-original-file: + * specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### TableResources_GetTable + +```java +/** + * Samples for TableResources GetTable. + */ +public final class TableResourcesGetTableSamples { + /* + * x-ms-original-file: + * specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### TableResources_GetTableThroughput + +```java +/** + * Samples for TableResources GetTableThroughput. + */ +public final class TableResourcesGetTableThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### TableResources_ListTables + +```java +/** + * Samples for TableResources ListTables. + */ +public final class TableResourcesListTablesSamples { + /* + * x-ms-original-file: + * specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### TableResources_MigrateTableToAutoscale + +```java +/** + * Samples for TableResources MigrateTableToAutoscale. + */ +public final class TableResourcesMigrateTableToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### TableResources_MigrateTableToManualThroughput + +```java +/** + * Samples for TableResources MigrateTableToManualThroughput. + */ +public final class TableResourcesMigrateTableToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} +``` + +### TableResources_RetrieveContinuousBackupInformation + +```java +import com.azure.resourcemanager.cosmos.generated.models.ContinuousBackupRestoreLocation; + +/** + * Samples for TableResources RetrieveContinuousBackupInformation. + */ +public final class TableResourcesRetrieveContinuousBackupInformationSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBTableBackupInformation.json + */ + /** + * Sample code: CosmosDBTableCollectionBackupInformation. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + cosmosDBTableCollectionBackupInformation(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.tableResources() + .retrieveContinuousBackupInformation("rgName", "ddb1", "tableName1", + new ContinuousBackupRestoreLocation().withLocation("North Europe"), com.azure.core.util.Context.NONE); + } +} +``` + +### TableResources_UpdateTableThroughput + +```java +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/stable/2024-11-15/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)), + com.azure.core.util.Context.NONE); + } + + // Use "Map.of" if available + @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..4112a62f7d186 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/pom.xml @@ -0,0 +1,63 @@ + + + 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-2024-11-15. + 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 + 0 + 0 + true + false + + + + com.azure + azure-core + 1.53.0 + + + com.azure + azure-core-management + 1.15.4 + + + 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..38045b45b07c2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/CosmosDBManager.java @@ -0,0 +1,872 @@ +// Copyright (c) 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.AddHeadersFromContextPolicy; +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.RetryOptions; +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.GremlinResourcesImpl; +import com.azure.resourcemanager.cosmos.generated.implementation.LocationsImpl; +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.RestorableDatabaseAccountsImpl; +import com.azure.resourcemanager.cosmos.generated.implementation.RestorableGremlinDatabasesImpl; +import com.azure.resourcemanager.cosmos.generated.implementation.RestorableGremlinGraphsImpl; +import com.azure.resourcemanager.cosmos.generated.implementation.RestorableGremlinResourcesImpl; +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.RestorableTableResourcesImpl; +import com.azure.resourcemanager.cosmos.generated.implementation.RestorableTablesImpl; +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.GremlinResources; +import com.azure.resourcemanager.cosmos.generated.models.Locations; +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.RestorableDatabaseAccounts; +import com.azure.resourcemanager.cosmos.generated.models.RestorableGremlinDatabases; +import com.azure.resourcemanager.cosmos.generated.models.RestorableGremlinGraphs; +import com.azure.resourcemanager.cosmos.generated.models.RestorableGremlinResources; +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.RestorableTableResources; +import com.azure.resourcemanager.cosmos.generated.models.RestorableTables; +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 SqlResources sqlResources; + + private MongoDBResources mongoDBResources; + + private TableResources tableResources; + + private CassandraResources cassandraResources; + + private GremlinResources gremlinResources; + + private Locations locations; + + private CassandraClusters cassandraClusters; + + private CassandraDataCenters cassandraDataCenters; + + 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 RestorableGremlinDatabases restorableGremlinDatabases; + + private RestorableGremlinGraphs restorableGremlinGraphs; + + private RestorableGremlinResources restorableGremlinResources; + + private RestorableTables restorableTables; + + private RestorableTableResources restorableTableResources; + + 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); + } + + /** + * Creates an instance of CosmosDB service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the CosmosDB service API instance. + */ + public static CosmosDBManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new CosmosDBManager(httpPipeline, profile, null); + } + + /** + * 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 static 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 RetryOptions retryOptions; + 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 retry options for the HTTP pipeline retry policy. + *

+ * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' 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, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' 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) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + 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); + } + } + + /** + * Gets the resource collection API of DatabaseAccounts. It manages DatabaseAccountGetResults. + * + * @return Resource collection API of DatabaseAccounts. + */ + public DatabaseAccounts databaseAccounts() { + if (this.databaseAccounts == null) { + this.databaseAccounts = new DatabaseAccountsImpl(clientObject.getDatabaseAccounts(), this); + } + return databaseAccounts; + } + + /** + * Gets the resource collection API of Operations. + * + * @return Resource collection API of Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * Gets the resource collection API of Databases. + * + * @return Resource collection API of Databases. + */ + public Databases databases() { + if (this.databases == null) { + this.databases = new DatabasesImpl(clientObject.getDatabases(), this); + } + return databases; + } + + /** + * Gets the resource collection API of Collections. + * + * @return Resource collection API of Collections. + */ + public Collections collections() { + if (this.collections == null) { + this.collections = new CollectionsImpl(clientObject.getCollections(), this); + } + return collections; + } + + /** + * Gets the resource collection API of CollectionRegions. + * + * @return Resource collection API of CollectionRegions. + */ + public CollectionRegions collectionRegions() { + if (this.collectionRegions == null) { + this.collectionRegions = new CollectionRegionsImpl(clientObject.getCollectionRegions(), this); + } + return collectionRegions; + } + + /** + * Gets the resource collection API of DatabaseAccountRegions. + * + * @return Resource collection API of DatabaseAccountRegions. + */ + public DatabaseAccountRegions databaseAccountRegions() { + if (this.databaseAccountRegions == null) { + this.databaseAccountRegions + = new DatabaseAccountRegionsImpl(clientObject.getDatabaseAccountRegions(), this); + } + return databaseAccountRegions; + } + + /** + * Gets the resource collection API of PercentileSourceTargets. + * + * @return Resource collection API of PercentileSourceTargets. + */ + public PercentileSourceTargets percentileSourceTargets() { + if (this.percentileSourceTargets == null) { + this.percentileSourceTargets + = new PercentileSourceTargetsImpl(clientObject.getPercentileSourceTargets(), this); + } + return percentileSourceTargets; + } + + /** + * Gets the resource collection API of PercentileTargets. + * + * @return Resource collection API of PercentileTargets. + */ + public PercentileTargets percentileTargets() { + if (this.percentileTargets == null) { + this.percentileTargets = new PercentileTargetsImpl(clientObject.getPercentileTargets(), this); + } + return percentileTargets; + } + + /** + * Gets the resource collection API of Percentiles. + * + * @return Resource collection API of Percentiles. + */ + public Percentiles percentiles() { + if (this.percentiles == null) { + this.percentiles = new PercentilesImpl(clientObject.getPercentiles(), this); + } + return percentiles; + } + + /** + * Gets the resource collection API of CollectionPartitionRegions. + * + * @return Resource collection API of CollectionPartitionRegions. + */ + public CollectionPartitionRegions collectionPartitionRegions() { + if (this.collectionPartitionRegions == null) { + this.collectionPartitionRegions + = new CollectionPartitionRegionsImpl(clientObject.getCollectionPartitionRegions(), this); + } + return collectionPartitionRegions; + } + + /** + * Gets the resource collection API of CollectionPartitions. + * + * @return Resource collection API of CollectionPartitions. + */ + public CollectionPartitions collectionPartitions() { + if (this.collectionPartitions == null) { + this.collectionPartitions = new CollectionPartitionsImpl(clientObject.getCollectionPartitions(), this); + } + return collectionPartitions; + } + + /** + * Gets the resource collection API of PartitionKeyRangeIds. + * + * @return Resource collection API of PartitionKeyRangeIds. + */ + public PartitionKeyRangeIds partitionKeyRangeIds() { + if (this.partitionKeyRangeIds == null) { + this.partitionKeyRangeIds = new PartitionKeyRangeIdsImpl(clientObject.getPartitionKeyRangeIds(), this); + } + return partitionKeyRangeIds; + } + + /** + * Gets the resource collection API of PartitionKeyRangeIdRegions. + * + * @return Resource collection API of PartitionKeyRangeIdRegions. + */ + public PartitionKeyRangeIdRegions partitionKeyRangeIdRegions() { + if (this.partitionKeyRangeIdRegions == null) { + this.partitionKeyRangeIdRegions + = new PartitionKeyRangeIdRegionsImpl(clientObject.getPartitionKeyRangeIdRegions(), this); + } + return partitionKeyRangeIdRegions; + } + + /** + * Gets the resource collection API of SqlResources. It manages SqlDatabaseGetResults, SqlContainerGetResults, + * ClientEncryptionKeyGetResults, SqlStoredProcedureGetResults, SqlUserDefinedFunctionGetResults, + * SqlTriggerGetResults, SqlRoleDefinitionGetResults, SqlRoleAssignmentGetResults. + * + * @return Resource collection API of SqlResources. + */ + public SqlResources sqlResources() { + if (this.sqlResources == null) { + this.sqlResources = new SqlResourcesImpl(clientObject.getSqlResources(), this); + } + return sqlResources; + } + + /** + * Gets the resource collection API of MongoDBResources. It manages MongoDBDatabaseGetResults, + * MongoDBCollectionGetResults, MongoRoleDefinitionGetResults, MongoUserDefinitionGetResults. + * + * @return Resource collection API of MongoDBResources. + */ + public MongoDBResources mongoDBResources() { + if (this.mongoDBResources == null) { + this.mongoDBResources = new MongoDBResourcesImpl(clientObject.getMongoDBResources(), this); + } + return mongoDBResources; + } + + /** + * Gets the resource collection API of TableResources. It manages TableGetResults. + * + * @return Resource collection API of TableResources. + */ + public TableResources tableResources() { + if (this.tableResources == null) { + this.tableResources = new TableResourcesImpl(clientObject.getTableResources(), this); + } + return tableResources; + } + + /** + * Gets the resource collection API of CassandraResources. It manages CassandraKeyspaceGetResults, + * CassandraTableGetResults. + * + * @return Resource collection API of CassandraResources. + */ + public CassandraResources cassandraResources() { + if (this.cassandraResources == null) { + this.cassandraResources = new CassandraResourcesImpl(clientObject.getCassandraResources(), this); + } + return cassandraResources; + } + + /** + * Gets the resource collection API of GremlinResources. It manages GremlinDatabaseGetResults, + * GremlinGraphGetResults. + * + * @return Resource collection API of GremlinResources. + */ + public GremlinResources gremlinResources() { + if (this.gremlinResources == null) { + this.gremlinResources = new GremlinResourcesImpl(clientObject.getGremlinResources(), this); + } + return gremlinResources; + } + + /** + * Gets the resource collection API of Locations. + * + * @return Resource collection API of Locations. + */ + public Locations locations() { + if (this.locations == null) { + this.locations = new LocationsImpl(clientObject.getLocations(), this); + } + return locations; + } + + /** + * Gets the resource collection API of CassandraClusters. It manages ClusterResource. + * + * @return Resource collection API of CassandraClusters. + */ + public CassandraClusters cassandraClusters() { + if (this.cassandraClusters == null) { + this.cassandraClusters = new CassandraClustersImpl(clientObject.getCassandraClusters(), this); + } + return cassandraClusters; + } + + /** + * Gets the resource collection API of CassandraDataCenters. It manages DataCenterResource. + * + * @return Resource collection API of CassandraDataCenters. + */ + public CassandraDataCenters cassandraDataCenters() { + if (this.cassandraDataCenters == null) { + this.cassandraDataCenters = new CassandraDataCentersImpl(clientObject.getCassandraDataCenters(), this); + } + return cassandraDataCenters; + } + + /** + * Gets the resource collection API of NotebookWorkspaces. It manages NotebookWorkspace. + * + * @return Resource collection API of NotebookWorkspaces. + */ + public NotebookWorkspaces notebookWorkspaces() { + if (this.notebookWorkspaces == null) { + this.notebookWorkspaces = new NotebookWorkspacesImpl(clientObject.getNotebookWorkspaces(), this); + } + return notebookWorkspaces; + } + + /** + * Gets the resource collection API of PrivateEndpointConnections. It manages PrivateEndpointConnection. + * + * @return Resource collection API of PrivateEndpointConnections. + */ + public PrivateEndpointConnections privateEndpointConnections() { + if (this.privateEndpointConnections == null) { + this.privateEndpointConnections + = new PrivateEndpointConnectionsImpl(clientObject.getPrivateEndpointConnections(), this); + } + return privateEndpointConnections; + } + + /** + * Gets the resource collection API of PrivateLinkResources. + * + * @return Resource collection API of PrivateLinkResources. + */ + public PrivateLinkResources privateLinkResources() { + if (this.privateLinkResources == null) { + this.privateLinkResources = new PrivateLinkResourcesImpl(clientObject.getPrivateLinkResources(), this); + } + return privateLinkResources; + } + + /** + * Gets the resource collection API of RestorableDatabaseAccounts. + * + * @return Resource collection API of RestorableDatabaseAccounts. + */ + public RestorableDatabaseAccounts restorableDatabaseAccounts() { + if (this.restorableDatabaseAccounts == null) { + this.restorableDatabaseAccounts + = new RestorableDatabaseAccountsImpl(clientObject.getRestorableDatabaseAccounts(), this); + } + return restorableDatabaseAccounts; + } + + /** + * Gets the resource collection API of RestorableSqlDatabases. + * + * @return Resource collection API of RestorableSqlDatabases. + */ + public RestorableSqlDatabases restorableSqlDatabases() { + if (this.restorableSqlDatabases == null) { + this.restorableSqlDatabases + = new RestorableSqlDatabasesImpl(clientObject.getRestorableSqlDatabases(), this); + } + return restorableSqlDatabases; + } + + /** + * Gets the resource collection API of RestorableSqlContainers. + * + * @return Resource collection API of RestorableSqlContainers. + */ + public RestorableSqlContainers restorableSqlContainers() { + if (this.restorableSqlContainers == null) { + this.restorableSqlContainers + = new RestorableSqlContainersImpl(clientObject.getRestorableSqlContainers(), this); + } + return restorableSqlContainers; + } + + /** + * Gets the resource collection API of RestorableSqlResources. + * + * @return Resource collection API of RestorableSqlResources. + */ + public RestorableSqlResources restorableSqlResources() { + if (this.restorableSqlResources == null) { + this.restorableSqlResources + = new RestorableSqlResourcesImpl(clientObject.getRestorableSqlResources(), this); + } + return restorableSqlResources; + } + + /** + * Gets the resource collection API of RestorableMongodbDatabases. + * + * @return Resource collection API of RestorableMongodbDatabases. + */ + public RestorableMongodbDatabases restorableMongodbDatabases() { + if (this.restorableMongodbDatabases == null) { + this.restorableMongodbDatabases + = new RestorableMongodbDatabasesImpl(clientObject.getRestorableMongodbDatabases(), this); + } + return restorableMongodbDatabases; + } + + /** + * Gets the resource collection API of RestorableMongodbCollections. + * + * @return Resource collection API of RestorableMongodbCollections. + */ + public RestorableMongodbCollections restorableMongodbCollections() { + if (this.restorableMongodbCollections == null) { + this.restorableMongodbCollections + = new RestorableMongodbCollectionsImpl(clientObject.getRestorableMongodbCollections(), this); + } + return restorableMongodbCollections; + } + + /** + * Gets the resource collection API of RestorableMongodbResources. + * + * @return Resource collection API of RestorableMongodbResources. + */ + public RestorableMongodbResources restorableMongodbResources() { + if (this.restorableMongodbResources == null) { + this.restorableMongodbResources + = new RestorableMongodbResourcesImpl(clientObject.getRestorableMongodbResources(), this); + } + return restorableMongodbResources; + } + + /** + * Gets the resource collection API of RestorableGremlinDatabases. + * + * @return Resource collection API of RestorableGremlinDatabases. + */ + public RestorableGremlinDatabases restorableGremlinDatabases() { + if (this.restorableGremlinDatabases == null) { + this.restorableGremlinDatabases + = new RestorableGremlinDatabasesImpl(clientObject.getRestorableGremlinDatabases(), this); + } + return restorableGremlinDatabases; + } + + /** + * Gets the resource collection API of RestorableGremlinGraphs. + * + * @return Resource collection API of RestorableGremlinGraphs. + */ + public RestorableGremlinGraphs restorableGremlinGraphs() { + if (this.restorableGremlinGraphs == null) { + this.restorableGremlinGraphs + = new RestorableGremlinGraphsImpl(clientObject.getRestorableGremlinGraphs(), this); + } + return restorableGremlinGraphs; + } + + /** + * Gets the resource collection API of RestorableGremlinResources. + * + * @return Resource collection API of RestorableGremlinResources. + */ + public RestorableGremlinResources restorableGremlinResources() { + if (this.restorableGremlinResources == null) { + this.restorableGremlinResources + = new RestorableGremlinResourcesImpl(clientObject.getRestorableGremlinResources(), this); + } + return restorableGremlinResources; + } + + /** + * Gets the resource collection API of RestorableTables. + * + * @return Resource collection API of RestorableTables. + */ + public RestorableTables restorableTables() { + if (this.restorableTables == null) { + this.restorableTables = new RestorableTablesImpl(clientObject.getRestorableTables(), this); + } + return restorableTables; + } + + /** + * Gets the resource collection API of RestorableTableResources. + * + * @return Resource collection API of RestorableTableResources. + */ + public RestorableTableResources restorableTableResources() { + if (this.restorableTableResources == null) { + this.restorableTableResources + = new RestorableTableResourcesImpl(clientObject.getRestorableTableResources(), this); + } + return restorableTableResources; + } + + /** + * Gets the resource collection API of Services. It manages ServiceResource. + * + * @return Resource collection API of Services. + */ + public Services services() { + if (this.services == null) { + this.services = new ServicesImpl(clientObject.getServices(), this); + } + return services; + } + + /** + * Gets wrapped service client CosmosDBManagementClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + * + * @return Wrapped service client CosmosDBManagementClient. + */ + 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..1d3cd694ed9d9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CassandraClustersClient.java @@ -0,0 +1,485 @@ +// Copyright (c) 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.CassandraClusterPublicStatusInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ClusterResourceInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.CommandOutputInner; +import com.azure.resourcemanager.cosmos.generated.models.CommandPostBody; + +/** + * 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String clusterName, + 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); + + /** + * 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 {@link SyncPoller} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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); + + /** + * Invoke a command like nodetool for cassandra maintenance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body Specification which command to run where. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of response of /command api. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CommandOutputInner> beginInvokeCommand(String resourceGroupName, + String clusterName, CommandPostBody body); + + /** + * Invoke a command like nodetool for cassandra maintenance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body Specification which command to run where. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of response of /command api. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CommandOutputInner> beginInvokeCommand(String resourceGroupName, + String clusterName, CommandPostBody body, Context context); + + /** + * Invoke a command like nodetool for cassandra maintenance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body Specification which command to run where. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of /command api. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CommandOutputInner invokeCommand(String resourceGroupName, String clusterName, CommandPostBody body); + + /** + * Invoke a command like nodetool for cassandra maintenance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body Specification which command to run where. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of /command api. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CommandOutputInner invokeCommand(String resourceGroupName, String clusterName, CommandPostBody body, + Context context); + + /** + * Deallocate the Managed Cassandra Cluster and Associated Data Centers. Deallocation will deallocate the host + * virtual machine of this cluster, and reserved the data disk. This won't do anything on an already deallocated + * cluster. Use Start to restart the 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeallocate(String resourceGroupName, String clusterName); + + /** + * Deallocate the Managed Cassandra Cluster and Associated Data Centers. Deallocation will deallocate the host + * virtual machine of this cluster, and reserved the data disk. This won't do anything on an already deallocated + * cluster. Use Start to restart the 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeallocate(String resourceGroupName, String clusterName, Context context); + + /** + * Deallocate the Managed Cassandra Cluster and Associated Data Centers. Deallocation will deallocate the host + * virtual machine of this cluster, and reserved the data disk. This won't do anything on an already deallocated + * cluster. Use Start to restart the 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 deallocate(String resourceGroupName, String clusterName); + + /** + * Deallocate the Managed Cassandra Cluster and Associated Data Centers. Deallocation will deallocate the host + * virtual machine of this cluster, and reserved the data disk. This won't do anything on an already deallocated + * cluster. Use Start to restart the 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 deallocate(String resourceGroupName, String clusterName, Context context); + + /** + * Start the Managed Cassandra Cluster and Associated Data Centers. Start will start the host virtual machine of + * this cluster with reserved data disk. This won't do anything on an already running cluster. Use Deallocate to + * deallocate the 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginStart(String resourceGroupName, String clusterName); + + /** + * Start the Managed Cassandra Cluster and Associated Data Centers. Start will start the host virtual machine of + * this cluster with reserved data disk. This won't do anything on an already running cluster. Use Deallocate to + * deallocate the 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginStart(String resourceGroupName, String clusterName, Context context); + + /** + * Start the Managed Cassandra Cluster and Associated Data Centers. Start will start the host virtual machine of + * this cluster with reserved data disk. This won't do anything on an already running cluster. Use Deallocate to + * deallocate the 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 start(String resourceGroupName, String clusterName); + + /** + * Start the Managed Cassandra Cluster and Associated Data Centers. Start will start the host virtual machine of + * this cluster with reserved data disk. This won't do anything on an already running cluster. Use Deallocate to + * deallocate the 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 start(String resourceGroupName, String clusterName, Context context); + + /** + * Gets the CPU, memory, and disk usage statistics for each Cassandra node in a 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 CPU, memory, and disk usage statistics for each Cassandra node in a cluster along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response statusWithResponse(String resourceGroupName, String clusterName, + Context context); + + /** + * Gets the CPU, memory, and disk usage statistics for each Cassandra node in a 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 CPU, memory, and disk usage statistics for each Cassandra node in a cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CassandraClusterPublicStatusInner status(String resourceGroupName, String clusterName); +} 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..d81f1196ec2b2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CassandraDataCentersClient.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.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 as paginated response with + * {@link PagedIterable}. + */ + @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 as paginated response with + * {@link PagedIterable}. + */ + @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String clusterName, + String dataCenterName, 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); + + /** + * 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 {@link SyncPoller} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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..6af5df0b0615c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CassandraResourcesClient.java @@ -0,0 +1,902 @@ +// Copyright (c) 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.ThroughputSettingsGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.CassandraKeyspaceCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.CassandraTableCreateUpdateParameters; +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 as paginated + * response with {@link PagedIterable}. + */ + @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 as paginated + * response with {@link PagedIterable}. + */ + @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getCassandraKeyspaceWithResponse(String resourceGroupName, + String accountName, String keyspaceName, 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); + + /** + * 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 {@link SyncPoller} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getCassandraKeyspaceThroughputWithResponse(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); + + /** + * 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 as paginated + * response with {@link PagedIterable}. + */ + @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 as paginated + * response with {@link PagedIterable}. + */ + @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getCassandraTableWithResponse(String resourceGroupName, String accountName, + String keyspaceName, String tableName, 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); + + /** + * 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 {@link SyncPoller} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getCassandraTableThroughputWithResponse(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); + + /** + * 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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); +} 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..8734277869d64 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CollectionPartitionRegionsClient.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; + +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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..407a1a0a5f73c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CollectionPartitionsClient.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.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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..c1564008e4cfb --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CollectionRegionsClient.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; + +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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..e72c78d8b7b4d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CollectionsClient.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; + +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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..34205d5452b24 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CosmosDBManagementClient.java @@ -0,0 +1,307 @@ +// Copyright (c) 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 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 LocationsClient object to access its operations. + * + * @return the LocationsClient object. + */ + LocationsClient getLocations(); + + /** + * 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 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 RestorableGremlinDatabasesClient object to access its operations. + * + * @return the RestorableGremlinDatabasesClient object. + */ + RestorableGremlinDatabasesClient getRestorableGremlinDatabases(); + + /** + * Gets the RestorableGremlinGraphsClient object to access its operations. + * + * @return the RestorableGremlinGraphsClient object. + */ + RestorableGremlinGraphsClient getRestorableGremlinGraphs(); + + /** + * Gets the RestorableGremlinResourcesClient object to access its operations. + * + * @return the RestorableGremlinResourcesClient object. + */ + RestorableGremlinResourcesClient getRestorableGremlinResources(); + + /** + * Gets the RestorableTablesClient object to access its operations. + * + * @return the RestorableTablesClient object. + */ + RestorableTablesClient getRestorableTables(); + + /** + * Gets the RestorableTableResourcesClient object to access its operations. + * + * @return the RestorableTableResourcesClient object. + */ + RestorableTableResourcesClient getRestorableTableResources(); + + /** + * 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..096046da7037d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/DatabaseAccountRegionsClient.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.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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..4245b9f6e20be --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/DatabaseAccountsClient.java @@ -0,0 +1,766 @@ +// Copyright (c) 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, + String accountName, 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 com.azure.core.management.exception.ManagementException thrown if the 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); + + /** + * 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 {@link SyncPoller} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @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 as paginated + * response with {@link PagedIterable}. + */ + @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 as paginated + * response with {@link PagedIterable}. + */ + @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 as paginated + * response with {@link PagedIterable}. + */ + @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 as paginated + * response with {@link PagedIterable}. + */ + @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listKeysWithResponse(String resourceGroupName, String accountName, + 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 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response + listConnectionStringsWithResponse(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); + + /** + * 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 {@link SyncPoller} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + @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 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listReadOnlyKeysWithResponse(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); + + /** + * 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 {@link SyncPoller} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkNameExistsWithResponse(String accountName, 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); + + /** + * 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..00146cfe0c5bf --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/DatabasesClient.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.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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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/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..b6ac0d672b11d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/GremlinResourcesClient.java @@ -0,0 +1,966 @@ +// Copyright (c) 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.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.ContinuousBackupRestoreLocation; +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 as paginated + * response with {@link PagedIterable}. + */ + @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 as paginated + * response with {@link PagedIterable}. + */ + @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getGremlinDatabaseWithResponse(String resourceGroupName, + String accountName, String databaseName, 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); + + /** + * 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 {@link SyncPoller} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getGremlinDatabaseThroughputWithResponse(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); + + /** + * 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 as paginated response with + * {@link PagedIterable}. + */ + @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 as paginated response with + * {@link PagedIterable}. + */ + @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getGremlinGraphWithResponse(String resourceGroupName, String accountName, + String databaseName, String graphName, 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); + + /** + * 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 {@link SyncPoller} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 + * along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getGremlinGraphThroughputWithResponse(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); + + /** + * 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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); + + /** + * Retrieves continuous backup information for a 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 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 the {@link SyncPoller} for polling of backup information of a resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, BackupInformationInner> beginRetrieveContinuousBackupInformation( + String resourceGroupName, String accountName, String databaseName, String graphName, + ContinuousBackupRestoreLocation location); + + /** + * Retrieves continuous backup information for a 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 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 the {@link SyncPoller} for polling of backup information of a resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, BackupInformationInner> beginRetrieveContinuousBackupInformation( + String resourceGroupName, String accountName, String databaseName, String graphName, + ContinuousBackupRestoreLocation location, Context context); + + /** + * Retrieves continuous backup information for a 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 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 graphName, ContinuousBackupRestoreLocation location); + + /** + * Retrieves continuous backup information for a 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 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 graphName, ContinuousBackupRestoreLocation location, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/LocationsClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/LocationsClient.java new file mode 100644 index 0000000000000..1580f7c57aafc --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/LocationsClient.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.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 LocationsClient. + */ +public interface LocationsClient { + /** + * 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 as paginated response + * with {@link PagedIterable}. + */ + @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 as paginated response + * with {@link PagedIterable}. + */ + @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String location, 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 get(String location); +} 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..677b63c73b00d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/MongoDBResourcesClient.java @@ -0,0 +1,1358 @@ +// Copyright (c) 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.MongoDBCollectionGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MongoDBDatabaseGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MongoRoleDefinitionGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MongoUserDefinitionGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ThroughputSettingsGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.ContinuousBackupRestoreLocation; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBCollectionCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBDatabaseCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.MongoRoleDefinitionCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.MongoUserDefinitionCreateUpdateParameters; +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 as paginated + * response with {@link PagedIterable}. + */ + @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 as paginated + * response with {@link PagedIterable}. + */ + @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getMongoDBDatabaseWithResponse(String resourceGroupName, + String accountName, String databaseName, 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); + + /** + * 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 {@link SyncPoller} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getMongoDBDatabaseThroughputWithResponse(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); + + /** + * 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 as paginated + * response with {@link PagedIterable}. + */ + @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 as paginated + * response with {@link PagedIterable}. + */ + @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getMongoDBCollectionWithResponse(String resourceGroupName, + String accountName, String databaseName, String collectionName, 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); + + /** + * 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 {@link SyncPoller} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getMongoDBCollectionThroughputWithResponse(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); + + /** + * 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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); + + /** + * Retrieves the properties of an existing Azure Cosmos DB Mongo Role Definition with the given Id. + * + * @param mongoRoleDefinitionId The ID for the Role Definition {dbName.roleName}. + * @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 Mongo Role Definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getMongoRoleDefinitionWithResponse(String mongoRoleDefinitionId, + String resourceGroupName, String accountName, Context context); + + /** + * Retrieves the properties of an existing Azure Cosmos DB Mongo Role Definition with the given Id. + * + * @param mongoRoleDefinitionId The ID for the Role Definition {dbName.roleName}. + * @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 Mongo Role Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MongoRoleDefinitionGetResultsInner getMongoRoleDefinition(String mongoRoleDefinitionId, String resourceGroupName, + String accountName); + + /** + * Creates or updates an Azure Cosmos DB Mongo Role Definition. + * + * @param mongoRoleDefinitionId The ID for the Role Definition {dbName.roleName}. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateMongoRoleDefinitionParameters 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 the {@link SyncPoller} for polling of an Azure Cosmos DB Mongo Role Definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, MongoRoleDefinitionGetResultsInner> + beginCreateUpdateMongoRoleDefinition(String mongoRoleDefinitionId, String resourceGroupName, String accountName, + MongoRoleDefinitionCreateUpdateParameters createUpdateMongoRoleDefinitionParameters); + + /** + * Creates or updates an Azure Cosmos DB Mongo Role Definition. + * + * @param mongoRoleDefinitionId The ID for the Role Definition {dbName.roleName}. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateMongoRoleDefinitionParameters 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 the {@link SyncPoller} for polling of an Azure Cosmos DB Mongo Role Definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, MongoRoleDefinitionGetResultsInner> + beginCreateUpdateMongoRoleDefinition(String mongoRoleDefinitionId, String resourceGroupName, String accountName, + MongoRoleDefinitionCreateUpdateParameters createUpdateMongoRoleDefinitionParameters, Context context); + + /** + * Creates or updates an Azure Cosmos DB Mongo Role Definition. + * + * @param mongoRoleDefinitionId The ID for the Role Definition {dbName.roleName}. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateMongoRoleDefinitionParameters 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 Mongo Role Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MongoRoleDefinitionGetResultsInner createUpdateMongoRoleDefinition(String mongoRoleDefinitionId, + String resourceGroupName, String accountName, + MongoRoleDefinitionCreateUpdateParameters createUpdateMongoRoleDefinitionParameters); + + /** + * Creates or updates an Azure Cosmos DB Mongo Role Definition. + * + * @param mongoRoleDefinitionId The ID for the Role Definition {dbName.roleName}. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateMongoRoleDefinitionParameters 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 Mongo Role Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MongoRoleDefinitionGetResultsInner createUpdateMongoRoleDefinition(String mongoRoleDefinitionId, + String resourceGroupName, String accountName, + MongoRoleDefinitionCreateUpdateParameters createUpdateMongoRoleDefinitionParameters, Context context); + + /** + * Deletes an existing Azure Cosmos DB Mongo Role Definition. + * + * @param mongoRoleDefinitionId The ID for the Role Definition {dbName.roleName}. + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteMongoRoleDefinition(String mongoRoleDefinitionId, + String resourceGroupName, String accountName); + + /** + * Deletes an existing Azure Cosmos DB Mongo Role Definition. + * + * @param mongoRoleDefinitionId The ID for the Role Definition {dbName.roleName}. + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteMongoRoleDefinition(String mongoRoleDefinitionId, + String resourceGroupName, String accountName, Context context); + + /** + * Deletes an existing Azure Cosmos DB Mongo Role Definition. + * + * @param mongoRoleDefinitionId The ID for the Role Definition {dbName.roleName}. + * @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 deleteMongoRoleDefinition(String mongoRoleDefinitionId, String resourceGroupName, String accountName); + + /** + * Deletes an existing Azure Cosmos DB Mongo Role Definition. + * + * @param mongoRoleDefinitionId The ID for the Role Definition {dbName.roleName}. + * @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 deleteMongoRoleDefinition(String mongoRoleDefinitionId, String resourceGroupName, String accountName, + Context context); + + /** + * Retrieves the list of all Azure Cosmos DB Mongo 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 Mongo Role Definitions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMongoRoleDefinitions(String resourceGroupName, + String accountName); + + /** + * Retrieves the list of all Azure Cosmos DB Mongo 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 Mongo Role Definitions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMongoRoleDefinitions(String resourceGroupName, + String accountName, Context context); + + /** + * Retrieves the properties of an existing Azure Cosmos DB Mongo User Definition with the given Id. + * + * @param mongoUserDefinitionId The ID for the User Definition {dbName.userName}. + * @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 User Definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getMongoUserDefinitionWithResponse(String mongoUserDefinitionId, + String resourceGroupName, String accountName, Context context); + + /** + * Retrieves the properties of an existing Azure Cosmos DB Mongo User Definition with the given Id. + * + * @param mongoUserDefinitionId The ID for the User Definition {dbName.userName}. + * @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 User Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MongoUserDefinitionGetResultsInner getMongoUserDefinition(String mongoUserDefinitionId, String resourceGroupName, + String accountName); + + /** + * Creates or updates an Azure Cosmos DB Mongo User Definition. + * + * @param mongoUserDefinitionId The ID for the User Definition {dbName.userName}. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateMongoUserDefinitionParameters The properties required to create or update a User 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 the {@link SyncPoller} for polling of an Azure Cosmos DB User Definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, MongoUserDefinitionGetResultsInner> + beginCreateUpdateMongoUserDefinition(String mongoUserDefinitionId, String resourceGroupName, String accountName, + MongoUserDefinitionCreateUpdateParameters createUpdateMongoUserDefinitionParameters); + + /** + * Creates or updates an Azure Cosmos DB Mongo User Definition. + * + * @param mongoUserDefinitionId The ID for the User Definition {dbName.userName}. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateMongoUserDefinitionParameters The properties required to create or update a User 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 the {@link SyncPoller} for polling of an Azure Cosmos DB User Definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, MongoUserDefinitionGetResultsInner> + beginCreateUpdateMongoUserDefinition(String mongoUserDefinitionId, String resourceGroupName, String accountName, + MongoUserDefinitionCreateUpdateParameters createUpdateMongoUserDefinitionParameters, Context context); + + /** + * Creates or updates an Azure Cosmos DB Mongo User Definition. + * + * @param mongoUserDefinitionId The ID for the User Definition {dbName.userName}. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateMongoUserDefinitionParameters The properties required to create or update a User 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 User Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MongoUserDefinitionGetResultsInner createUpdateMongoUserDefinition(String mongoUserDefinitionId, + String resourceGroupName, String accountName, + MongoUserDefinitionCreateUpdateParameters createUpdateMongoUserDefinitionParameters); + + /** + * Creates or updates an Azure Cosmos DB Mongo User Definition. + * + * @param mongoUserDefinitionId The ID for the User Definition {dbName.userName}. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateMongoUserDefinitionParameters The properties required to create or update a User 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 User Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MongoUserDefinitionGetResultsInner createUpdateMongoUserDefinition(String mongoUserDefinitionId, + String resourceGroupName, String accountName, + MongoUserDefinitionCreateUpdateParameters createUpdateMongoUserDefinitionParameters, Context context); + + /** + * Deletes an existing Azure Cosmos DB Mongo User Definition. + * + * @param mongoUserDefinitionId The ID for the User Definition {dbName.userName}. + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteMongoUserDefinition(String mongoUserDefinitionId, + String resourceGroupName, String accountName); + + /** + * Deletes an existing Azure Cosmos DB Mongo User Definition. + * + * @param mongoUserDefinitionId The ID for the User Definition {dbName.userName}. + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteMongoUserDefinition(String mongoUserDefinitionId, + String resourceGroupName, String accountName, Context context); + + /** + * Deletes an existing Azure Cosmos DB Mongo User Definition. + * + * @param mongoUserDefinitionId The ID for the User Definition {dbName.userName}. + * @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 deleteMongoUserDefinition(String mongoUserDefinitionId, String resourceGroupName, String accountName); + + /** + * Deletes an existing Azure Cosmos DB Mongo User Definition. + * + * @param mongoUserDefinitionId The ID for the User Definition {dbName.userName}. + * @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 deleteMongoUserDefinition(String mongoUserDefinitionId, String resourceGroupName, String accountName, + Context context); + + /** + * Retrieves the list of all Azure Cosmos DB Mongo User 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 relevant User Definition as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMongoUserDefinitions(String resourceGroupName, + String accountName); + + /** + * Retrieves the list of all Azure Cosmos DB Mongo User 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 relevant User Definition as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMongoUserDefinitions(String resourceGroupName, + String accountName, Context context); + + /** + * Retrieves continuous backup information for a 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 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 the {@link SyncPoller} for polling of backup information of a resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, BackupInformationInner> beginRetrieveContinuousBackupInformation( + String resourceGroupName, String accountName, String databaseName, String collectionName, + ContinuousBackupRestoreLocation location); + + /** + * Retrieves continuous backup information for a 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 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 the {@link SyncPoller} for polling of backup information of a resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, BackupInformationInner> beginRetrieveContinuousBackupInformation( + String resourceGroupName, String accountName, String databaseName, String collectionName, + ContinuousBackupRestoreLocation location, Context context); + + /** + * Retrieves continuous backup information for a 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 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 collectionName, ContinuousBackupRestoreLocation location); + + /** + * Retrieves continuous backup information for a 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 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 collectionName, ContinuousBackupRestoreLocation location, 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..252ccba73db6c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/NotebookWorkspacesClient.java @@ -0,0 +1,361 @@ +// Copyright (c) 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 as paginated response with + * {@link PagedIterable}. + */ + @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 as paginated response with + * {@link PagedIterable}. + */ + @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String accountName, + NotebookWorkspaceName notebookWorkspaceName, 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); + + /** + * 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 {@link SyncPoller} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listConnectionInfoWithResponse(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); + + /** + * 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 {@link SyncPoller} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @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..91a49c6614f3d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/OperationsClient.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.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 as paginated response with + * {@link PagedIterable}. + */ + @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 as paginated response with + * {@link PagedIterable}. + */ + @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..2c7b32367cd39 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PartitionKeyRangeIdRegionsClient.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; + +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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..f64a29525bb14 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PartitionKeyRangeIdsClient.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; + +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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..ee82b7b7d477a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PercentileSourceTargetsClient.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.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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..b71f556c728af --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PercentileTargetsClient.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; + +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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..eb79f8a05157e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PercentilesClient.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.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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..9212aae777a5e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PrivateEndpointConnectionsClient.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.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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String accountName, + String privateEndpointConnectionName, 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); + + /** + * 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 The parameters parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of 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 The parameters parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of 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 The parameters parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 The parameters parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 {@link SyncPoller} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @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..ed89770653c98 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PrivateLinkResourcesClient.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; + +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 as paginated response with + * {@link PagedIterable}. + */ + @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 as paginated response with + * {@link PagedIterable}. + */ + @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String accountName, String groupName, + 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); +} 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..6aca5c2977807 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableDatabaseAccountsClient.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.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 as + * paginated response with {@link PagedIterable}. + */ + @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 as + * paginated response with {@link PagedIterable}. + */ + @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 as + * paginated response with {@link PagedIterable}. + */ + @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 as + * paginated response with {@link PagedIterable}. + */ + @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByLocationWithResponse(String location, String instanceId, + 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); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableGremlinDatabasesClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableGremlinDatabasesClient.java new file mode 100644 index 0000000000000..2770489f07862 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableGremlinDatabasesClient.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.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.RestorableGremlinDatabaseGetResultInner; + +/** + * An instance of this class provides access to all the operations defined in RestorableGremlinDatabasesClient. + */ +public interface RestorableGremlinDatabasesClient { + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB Gremlin 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 Gremlin database events and their properties as paginated + * response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String location, String instanceId); + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB Gremlin 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 Gremlin database events and their properties as paginated + * response with {@link PagedIterable}. + */ + @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/RestorableGremlinGraphsClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableGremlinGraphsClient.java new file mode 100644 index 0000000000000..fab1f0b3ddbaf --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableGremlinGraphsClient.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.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.RestorableGremlinGraphGetResultInner; + +/** + * An instance of this class provides access to all the operations defined in RestorableGremlinGraphsClient. + */ +public interface RestorableGremlinGraphsClient { + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB Gremlin graphs 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 Gremlin graph events and their properties as paginated + * response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String location, String instanceId); + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB Gremlin graphs 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 restorableGremlinDatabaseRid The resource ID of the Gremlin database. + * @param startTime Restorable Gremlin graphs event feed start time. + * @param endTime Restorable Gremlin graphs event feed end time. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 graph events and their properties as paginated + * response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String location, String instanceId, + String restorableGremlinDatabaseRid, String startTime, String endTime, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableGremlinResourcesClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableGremlinResourcesClient.java new file mode 100644 index 0000000000000..4b9bbf06358db --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableGremlinResourcesClient.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.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.RestorableGremlinResourcesGetResultInner; + +/** + * An instance of this class provides access to all the operations defined in RestorableGremlinResourcesClient. + */ +public interface RestorableGremlinResourcesClient { + /** + * Return a list of gremlin database and graphs 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 Gremlin resources as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String location, String instanceId); + + /** + * Return a list of gremlin database and graphs 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 Gremlin resources as paginated response with + * {@link PagedIterable}. + */ + @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/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..545dc301a8ee6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableMongodbCollectionsClient.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.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 as + * paginated response with {@link PagedIterable}. + */ + @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 startTime Restorable MongoDB collections event feed start time. + * @param endTime Restorable MongoDB collections event feed end time. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 as + * paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String location, String instanceId, + String restorableMongodbDatabaseRid, String startTime, String endTime, 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..36ec88bcec84f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableMongodbDatabasesClient.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.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 as paginated + * response with {@link PagedIterable}. + */ + @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 as paginated + * response with {@link PagedIterable}. + */ + @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..2b05fc62eff77 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableMongodbResourcesClient.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.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.RestorableMongodbResourcesGetResultInner; + +/** + * 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 as paginated response with + * {@link PagedIterable}. + */ + @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 as paginated response with + * {@link PagedIterable}. + */ + @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..7a58577efca12 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableSqlContainersClient.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.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 as paginated + * response with {@link PagedIterable}. + */ + @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 Restorable Sql containers event feed start time. + * @param endTime Restorable Sql containers event feed end time. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 as paginated + * response with {@link PagedIterable}. + */ + @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..58b718207bf69 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableSqlDatabasesClient.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.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 as paginated + * response with {@link PagedIterable}. + */ + @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 as paginated + * response with {@link PagedIterable}. + */ + @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..5192e96adeb24 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableSqlResourcesClient.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.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.RestorableSqlResourcesGetResultInner; + +/** + * 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 as paginated response with + * {@link PagedIterable}. + */ + @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 as paginated response with + * {@link PagedIterable}. + */ + @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/RestorableTableResourcesClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableTableResourcesClient.java new file mode 100644 index 0000000000000..abc82f035bb60 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableTableResourcesClient.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.RestorableTableResourcesGetResultInner; + +/** + * An instance of this class provides access to all the operations defined in RestorableTableResourcesClient. + */ +public interface RestorableTableResourcesClient { + /** + * Return a list of tables 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 list of restorable table names as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String location, String instanceId); + + /** + * Return a list of tables 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 list of restorable table names as paginated response with {@link PagedIterable}. + */ + @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/RestorableTablesClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableTablesClient.java new file mode 100644 index 0000000000000..c1b8d9304d288 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableTablesClient.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.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.RestorableTableGetResultInner; + +/** + * An instance of this class provides access to all the operations defined in RestorableTablesClient. + */ +public interface RestorableTablesClient { + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB Tables. This helps in scenario where table + * 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 Table events and their properties as paginated response + * with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String location, String instanceId); + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB Tables. This helps in scenario where table + * 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 startTime Restorable Tables event feed start time. + * @param endTime Restorable Tables event feed end time. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 events and their properties as paginated response + * with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String location, String instanceId, String startTime, + String endTime, 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..4b938b2b7526e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/ServicesClient.java @@ -0,0 +1,201 @@ +// Copyright (c) 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String accountName, String serviceName, + 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); + + /** + * 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 {@link SyncPoller} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @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..3beb971dadb0b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/SqlResourcesClient.java @@ -0,0 +1,2150 @@ +// Copyright (c) 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.ClientEncryptionKeyGetResultsInner; +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.ClientEncryptionKeyCreateUpdateParameters; +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 as paginated response + * with {@link PagedIterable}. + */ + @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 as paginated response + * with {@link PagedIterable}. + */ + @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getSqlDatabaseWithResponse(String resourceGroupName, String accountName, + String databaseName, 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); + + /** + * 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 {@link SyncPoller} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getSqlDatabaseThroughputWithResponse(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); + + /** + * 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 as paginated response with + * {@link PagedIterable}. + */ + @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 as paginated response with + * {@link PagedIterable}. + */ + @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getSqlContainerWithResponse(String resourceGroupName, String accountName, + String databaseName, String containerName, 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); + + /** + * 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 {@link SyncPoller} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getSqlContainerThroughputWithResponse(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); + + /** + * 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 ClientEncryptionKeys under 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 List operation response, that contains the client encryption keys and their properties as paginated + * response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listClientEncryptionKeys(String resourceGroupName, + String accountName, String databaseName); + + /** + * Lists the ClientEncryptionKeys under 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 List operation response, that contains the client encryption keys and their properties as paginated + * response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listClientEncryptionKeys(String resourceGroupName, + String accountName, String databaseName, Context context); + + /** + * Gets the ClientEncryptionKey under 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 clientEncryptionKeyName Cosmos DB ClientEncryptionKey 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 ClientEncryptionKey under an existing Azure Cosmos DB SQL database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getClientEncryptionKeyWithResponse(String resourceGroupName, + String accountName, String databaseName, String clientEncryptionKeyName, Context context); + + /** + * Gets the ClientEncryptionKey under 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 clientEncryptionKeyName Cosmos DB ClientEncryptionKey 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 ClientEncryptionKey under an existing Azure Cosmos DB SQL database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ClientEncryptionKeyGetResultsInner getClientEncryptionKey(String resourceGroupName, String accountName, + String databaseName, String clientEncryptionKeyName); + + /** + * Create or update a ClientEncryptionKey. This API is meant to be invoked via tools such as the Azure Powershell + * (instead of directly). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param clientEncryptionKeyName Cosmos DB ClientEncryptionKey name. + * @param createUpdateClientEncryptionKeyParameters The parameters to provide for the client encryption key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of client Encryption Key. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ClientEncryptionKeyGetResultsInner> + beginCreateUpdateClientEncryptionKey(String resourceGroupName, String accountName, String databaseName, + String clientEncryptionKeyName, + ClientEncryptionKeyCreateUpdateParameters createUpdateClientEncryptionKeyParameters); + + /** + * Create or update a ClientEncryptionKey. This API is meant to be invoked via tools such as the Azure Powershell + * (instead of directly). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param clientEncryptionKeyName Cosmos DB ClientEncryptionKey name. + * @param createUpdateClientEncryptionKeyParameters The parameters to provide for the client encryption key. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of client Encryption Key. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ClientEncryptionKeyGetResultsInner> + beginCreateUpdateClientEncryptionKey(String resourceGroupName, String accountName, String databaseName, + String clientEncryptionKeyName, + ClientEncryptionKeyCreateUpdateParameters createUpdateClientEncryptionKeyParameters, Context context); + + /** + * Create or update a ClientEncryptionKey. This API is meant to be invoked via tools such as the Azure Powershell + * (instead of directly). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param clientEncryptionKeyName Cosmos DB ClientEncryptionKey name. + * @param createUpdateClientEncryptionKeyParameters The parameters to provide for the client encryption key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return client Encryption Key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ClientEncryptionKeyGetResultsInner createUpdateClientEncryptionKey(String resourceGroupName, String accountName, + String databaseName, String clientEncryptionKeyName, + ClientEncryptionKeyCreateUpdateParameters createUpdateClientEncryptionKeyParameters); + + /** + * Create or update a ClientEncryptionKey. This API is meant to be invoked via tools such as the Azure Powershell + * (instead of directly). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param clientEncryptionKeyName Cosmos DB ClientEncryptionKey name. + * @param createUpdateClientEncryptionKeyParameters The parameters to provide for the client encryption key. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return client Encryption Key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ClientEncryptionKeyGetResultsInner createUpdateClientEncryptionKey(String resourceGroupName, String accountName, + String databaseName, String clientEncryptionKeyName, + ClientEncryptionKeyCreateUpdateParameters createUpdateClientEncryptionKeyParameters, 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 as paginated + * response with {@link PagedIterable}. + */ + @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 as paginated + * response with {@link PagedIterable}. + */ + @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getSqlStoredProcedureWithResponse(String resourceGroupName, + String accountName, String databaseName, String containerName, String storedProcedureName, 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); + + /** + * 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 {@link SyncPoller} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @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 as paginated + * response with {@link PagedIterable}. + */ + @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 as paginated + * response with {@link PagedIterable}. + */ + @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getSqlUserDefinedFunctionWithResponse(String resourceGroupName, + String accountName, String databaseName, String containerName, String userDefinedFunctionName, 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); + + /** + * 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 {@link SyncPoller} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @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 as paginated response with + * {@link PagedIterable}. + */ + @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 as paginated response with + * {@link PagedIterable}. + */ + @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getSqlTriggerWithResponse(String resourceGroupName, String accountName, + String databaseName, String containerName, String triggerName, 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); + + /** + * 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 {@link SyncPoller} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getSqlRoleDefinitionWithResponse(String roleDefinitionId, + String resourceGroupName, String accountName, 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); + + /** + * 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 {@link SyncPoller} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getSqlRoleAssignmentWithResponse(String roleAssignmentId, + 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); + + /** + * 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 {@link SyncPoller} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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..43e73ca32d9b5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/TableResourcesClient.java @@ -0,0 +1,500 @@ +// Copyright (c) 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.TableGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ThroughputSettingsGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.ContinuousBackupRestoreLocation; +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 as paginated response with + * {@link PagedIterable}. + */ + @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 as paginated response with + * {@link PagedIterable}. + */ + @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getTableWithResponse(String resourceGroupName, String accountName, String tableName, + 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); + + /** + * 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 {@link SyncPoller} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 + * along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getTableThroughputWithResponse(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); + + /** + * 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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 the {@link SyncPoller} for polling of 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); + + /** + * Retrieves continuous backup information for a 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 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 the {@link SyncPoller} for polling of backup information of a resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, BackupInformationInner> beginRetrieveContinuousBackupInformation( + String resourceGroupName, String accountName, String tableName, ContinuousBackupRestoreLocation location); + + /** + * Retrieves continuous backup information for a 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 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 the {@link SyncPoller} for polling of backup information of a resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, BackupInformationInner> beginRetrieveContinuousBackupInformation( + String resourceGroupName, String accountName, String tableName, ContinuousBackupRestoreLocation location, + Context context); + + /** + * Retrieves continuous backup information for a 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 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 tableName, ContinuousBackupRestoreLocation location); + + /** + * Retrieves continuous backup information for a 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 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 tableName, ContinuousBackupRestoreLocation location, 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..200c86782c4ae --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/BackupInformationInner.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.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.ContinuousBackupInformation; +import java.io.IOException; + +/** + * Backup information of a resource. + */ +@Immutable +public final class BackupInformationInner implements JsonSerializable { + /* + * Information about the status of continuous backups. + */ + private ContinuousBackupInformation continuousBackupInformation; + + /** + * Creates an instance of BackupInformationInner class. + */ + public BackupInformationInner() { + } + + /** + * 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BackupInformationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BackupInformationInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the BackupInformationInner. + */ + public static BackupInformationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BackupInformationInner deserializedBackupInformationInner = new BackupInformationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("continuousBackupInformation".equals(fieldName)) { + deserializedBackupInformationInner.continuousBackupInformation + = ContinuousBackupInformation.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedBackupInformationInner; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraClusterPublicStatusInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraClusterPublicStatusInner.java new file mode 100644 index 0000000000000..c475b2dd800a9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraClusterPublicStatusInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.CassandraClusterPublicStatusDataCentersItem; +import com.azure.resourcemanager.cosmos.generated.models.CassandraError; +import com.azure.resourcemanager.cosmos.generated.models.ConnectionError; +import com.azure.resourcemanager.cosmos.generated.models.ManagedCassandraReaperStatus; +import java.io.IOException; +import java.util.List; + +/** + * Properties of a managed Cassandra cluster public status. + */ +@Fluent +public final class CassandraClusterPublicStatusInner implements JsonSerializable { + /* + * The eTag property. + */ + private String etag; + + /* + * The reaperStatus property. + */ + private ManagedCassandraReaperStatus reaperStatus; + + /* + * List relevant information about any connection errors to the Datacenters. + */ + private List connectionErrors; + + /* + * List relevant information about any errors about cluster, data center and connection error. + */ + private List errors; + + /* + * List of the status of each datacenter in this cluster. + */ + private List dataCenters; + + /** + * Creates an instance of CassandraClusterPublicStatusInner class. + */ + public CassandraClusterPublicStatusInner() { + } + + /** + * Get the etag property: The eTag property. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag property: The eTag property. + * + * @param etag the etag value to set. + * @return the CassandraClusterPublicStatusInner object itself. + */ + public CassandraClusterPublicStatusInner withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Get the reaperStatus property: The reaperStatus property. + * + * @return the reaperStatus value. + */ + public ManagedCassandraReaperStatus reaperStatus() { + return this.reaperStatus; + } + + /** + * Set the reaperStatus property: The reaperStatus property. + * + * @param reaperStatus the reaperStatus value to set. + * @return the CassandraClusterPublicStatusInner object itself. + */ + public CassandraClusterPublicStatusInner withReaperStatus(ManagedCassandraReaperStatus reaperStatus) { + this.reaperStatus = reaperStatus; + return this; + } + + /** + * Get the connectionErrors property: List relevant information about any connection errors to the Datacenters. + * + * @return the connectionErrors value. + */ + public List connectionErrors() { + return this.connectionErrors; + } + + /** + * Set the connectionErrors property: List relevant information about any connection errors to the Datacenters. + * + * @param connectionErrors the connectionErrors value to set. + * @return the CassandraClusterPublicStatusInner object itself. + */ + public CassandraClusterPublicStatusInner withConnectionErrors(List connectionErrors) { + this.connectionErrors = connectionErrors; + return this; + } + + /** + * Get the errors property: List relevant information about any errors about cluster, data center and connection + * error. + * + * @return the errors value. + */ + public List errors() { + return this.errors; + } + + /** + * Set the errors property: List relevant information about any errors about cluster, data center and connection + * error. + * + * @param errors the errors value to set. + * @return the CassandraClusterPublicStatusInner object itself. + */ + public CassandraClusterPublicStatusInner withErrors(List errors) { + this.errors = errors; + return this; + } + + /** + * Get the dataCenters property: List of the status of each datacenter in this cluster. + * + * @return the dataCenters value. + */ + public List dataCenters() { + return this.dataCenters; + } + + /** + * Set the dataCenters property: List of the status of each datacenter in this cluster. + * + * @param dataCenters the dataCenters value to set. + * @return the CassandraClusterPublicStatusInner object itself. + */ + public CassandraClusterPublicStatusInner + withDataCenters(List dataCenters) { + this.dataCenters = dataCenters; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (reaperStatus() != null) { + reaperStatus().validate(); + } + if (connectionErrors() != null) { + connectionErrors().forEach(e -> e.validate()); + } + if (errors() != null) { + errors().forEach(e -> e.validate()); + } + if (dataCenters() != null) { + dataCenters().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("eTag", this.etag); + jsonWriter.writeJsonField("reaperStatus", this.reaperStatus); + jsonWriter.writeArrayField("connectionErrors", this.connectionErrors, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("errors", this.errors, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("dataCenters", this.dataCenters, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CassandraClusterPublicStatusInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CassandraClusterPublicStatusInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CassandraClusterPublicStatusInner. + */ + public static CassandraClusterPublicStatusInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CassandraClusterPublicStatusInner deserializedCassandraClusterPublicStatusInner + = new CassandraClusterPublicStatusInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("eTag".equals(fieldName)) { + deserializedCassandraClusterPublicStatusInner.etag = reader.getString(); + } else if ("reaperStatus".equals(fieldName)) { + deserializedCassandraClusterPublicStatusInner.reaperStatus + = ManagedCassandraReaperStatus.fromJson(reader); + } else if ("connectionErrors".equals(fieldName)) { + List connectionErrors + = reader.readArray(reader1 -> ConnectionError.fromJson(reader1)); + deserializedCassandraClusterPublicStatusInner.connectionErrors = connectionErrors; + } else if ("errors".equals(fieldName)) { + List errors = reader.readArray(reader1 -> CassandraError.fromJson(reader1)); + deserializedCassandraClusterPublicStatusInner.errors = errors; + } else if ("dataCenters".equals(fieldName)) { + List dataCenters + = reader.readArray(reader1 -> CassandraClusterPublicStatusDataCentersItem.fromJson(reader1)); + deserializedCassandraClusterPublicStatusInner.dataCenters = dataCenters; + } else { + reader.skipChildren(); + } + } + + return deserializedCassandraClusterPublicStatusInner; + }); + } +} 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..315dc2e7b8737 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraKeyspaceCreateUpdateProperties.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.CassandraKeyspaceResource; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import java.io.IOException; + +/** + * Properties to create and update Azure Cosmos DB Cassandra keyspace. + */ +@Fluent +public final class CassandraKeyspaceCreateUpdateProperties + implements JsonSerializable { + /* + * The standard JSON format of a Cassandra keyspace + */ + private CassandraKeyspaceResource resource; + + /* + * A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + */ + private CreateUpdateOptions options; + + /** + * Creates an instance of CassandraKeyspaceCreateUpdateProperties class. + */ + public CassandraKeyspaceCreateUpdateProperties() { + } + + /** + * 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.atError() + .log(new IllegalArgumentException( + "Missing required property resource in model CassandraKeyspaceCreateUpdateProperties")); + } else { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CassandraKeyspaceCreateUpdateProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("resource", this.resource); + jsonWriter.writeJsonField("options", this.options); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CassandraKeyspaceCreateUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CassandraKeyspaceCreateUpdateProperties if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CassandraKeyspaceCreateUpdateProperties. + */ + public static CassandraKeyspaceCreateUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CassandraKeyspaceCreateUpdateProperties deserializedCassandraKeyspaceCreateUpdateProperties + = new CassandraKeyspaceCreateUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resource".equals(fieldName)) { + deserializedCassandraKeyspaceCreateUpdateProperties.resource + = CassandraKeyspaceResource.fromJson(reader); + } else if ("options".equals(fieldName)) { + deserializedCassandraKeyspaceCreateUpdateProperties.options = CreateUpdateOptions.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCassandraKeyspaceCreateUpdateProperties; + }); + } +} 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..fe00a6d6b7af6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraKeyspaceGetProperties.java @@ -0,0 +1,132 @@ +// Copyright (c) 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.CassandraKeyspaceGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.CassandraKeyspaceGetPropertiesResource; +import java.io.IOException; + +/** + * The properties of an Azure Cosmos DB Cassandra keyspace. + */ +@Fluent +public final class CassandraKeyspaceGetProperties implements JsonSerializable { + /* + * The resource property. + */ + private CassandraKeyspaceGetPropertiesResource resource; + + /* + * The options property. + */ + private CassandraKeyspaceGetPropertiesOptions options; + + /** + * Creates an instance of CassandraKeyspaceGetProperties class. + */ + public CassandraKeyspaceGetProperties() { + } + + /** + * 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("resource", this.resource); + jsonWriter.writeJsonField("options", this.options); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CassandraKeyspaceGetProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CassandraKeyspaceGetProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CassandraKeyspaceGetProperties. + */ + public static CassandraKeyspaceGetProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CassandraKeyspaceGetProperties deserializedCassandraKeyspaceGetProperties + = new CassandraKeyspaceGetProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resource".equals(fieldName)) { + deserializedCassandraKeyspaceGetProperties.resource + = CassandraKeyspaceGetPropertiesResource.fromJson(reader); + } else if ("options".equals(fieldName)) { + deserializedCassandraKeyspaceGetProperties.options + = CassandraKeyspaceGetPropertiesOptions.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCassandraKeyspaceGetProperties; + }); + } +} 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..d4ee0ee8b286a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraKeyspaceGetResultsInner.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +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 java.io.IOException; +import java.util.Map; + +/** + * An Azure Cosmos DB Cassandra keyspace. + */ +@Fluent +public final class CassandraKeyspaceGetResultsInner extends ArmResourceProperties { + /* + * The properties of an Azure Cosmos DB Cassandra keyspace + */ + private CassandraKeyspaceGetProperties innerProperties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of CassandraKeyspaceGetResultsInner class. + */ + public CassandraKeyspaceGetResultsInner() { + } + + /** + * Get the innerProperties property: The properties of an Azure Cosmos DB Cassandra keyspace. + * + * @return the innerProperties value. + */ + private CassandraKeyspaceGetProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@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() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CassandraKeyspaceGetResultsInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CassandraKeyspaceGetResultsInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CassandraKeyspaceGetResultsInner. + */ + public static CassandraKeyspaceGetResultsInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CassandraKeyspaceGetResultsInner deserializedCassandraKeyspaceGetResultsInner + = new CassandraKeyspaceGetResultsInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedCassandraKeyspaceGetResultsInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedCassandraKeyspaceGetResultsInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedCassandraKeyspaceGetResultsInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedCassandraKeyspaceGetResultsInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedCassandraKeyspaceGetResultsInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedCassandraKeyspaceGetResultsInner.innerProperties + = CassandraKeyspaceGetProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCassandraKeyspaceGetResultsInner; + }); + } +} 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..1c80141815334 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraTableCreateUpdateProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.CassandraTableResource; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import java.io.IOException; + +/** + * Properties to create and update Azure Cosmos DB Cassandra table. + */ +@Fluent +public final class CassandraTableCreateUpdateProperties + implements JsonSerializable { + /* + * The standard JSON format of a Cassandra table + */ + private CassandraTableResource resource; + + /* + * A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + */ + private CreateUpdateOptions options; + + /** + * Creates an instance of CassandraTableCreateUpdateProperties class. + */ + public CassandraTableCreateUpdateProperties() { + } + + /** + * 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.atError() + .log(new IllegalArgumentException( + "Missing required property resource in model CassandraTableCreateUpdateProperties")); + } else { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CassandraTableCreateUpdateProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("resource", this.resource); + jsonWriter.writeJsonField("options", this.options); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CassandraTableCreateUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CassandraTableCreateUpdateProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CassandraTableCreateUpdateProperties. + */ + public static CassandraTableCreateUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CassandraTableCreateUpdateProperties deserializedCassandraTableCreateUpdateProperties + = new CassandraTableCreateUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resource".equals(fieldName)) { + deserializedCassandraTableCreateUpdateProperties.resource = CassandraTableResource.fromJson(reader); + } else if ("options".equals(fieldName)) { + deserializedCassandraTableCreateUpdateProperties.options = CreateUpdateOptions.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCassandraTableCreateUpdateProperties; + }); + } +} 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..9dae54256690f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraTableGetProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.CassandraTableGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.CassandraTableGetPropertiesResource; +import java.io.IOException; + +/** + * The properties of an Azure Cosmos DB Cassandra table. + */ +@Fluent +public final class CassandraTableGetProperties implements JsonSerializable { + /* + * The resource property. + */ + private CassandraTableGetPropertiesResource resource; + + /* + * The options property. + */ + private CassandraTableGetPropertiesOptions options; + + /** + * Creates an instance of CassandraTableGetProperties class. + */ + public CassandraTableGetProperties() { + } + + /** + * 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("resource", this.resource); + jsonWriter.writeJsonField("options", this.options); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CassandraTableGetProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CassandraTableGetProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CassandraTableGetProperties. + */ + public static CassandraTableGetProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CassandraTableGetProperties deserializedCassandraTableGetProperties = new CassandraTableGetProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resource".equals(fieldName)) { + deserializedCassandraTableGetProperties.resource + = CassandraTableGetPropertiesResource.fromJson(reader); + } else if ("options".equals(fieldName)) { + deserializedCassandraTableGetProperties.options + = CassandraTableGetPropertiesOptions.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCassandraTableGetProperties; + }); + } +} 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..ab2e46aabbf79 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraTableGetResultsInner.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +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 java.io.IOException; +import java.util.Map; + +/** + * An Azure Cosmos DB Cassandra table. + */ +@Fluent +public final class CassandraTableGetResultsInner extends ArmResourceProperties { + /* + * The properties of an Azure Cosmos DB Cassandra table + */ + private CassandraTableGetProperties innerProperties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of CassandraTableGetResultsInner class. + */ + public CassandraTableGetResultsInner() { + } + + /** + * Get the innerProperties property: The properties of an Azure Cosmos DB Cassandra table. + * + * @return the innerProperties value. + */ + private CassandraTableGetProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@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() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CassandraTableGetResultsInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CassandraTableGetResultsInner if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CassandraTableGetResultsInner. + */ + public static CassandraTableGetResultsInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CassandraTableGetResultsInner deserializedCassandraTableGetResultsInner + = new CassandraTableGetResultsInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedCassandraTableGetResultsInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedCassandraTableGetResultsInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedCassandraTableGetResultsInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedCassandraTableGetResultsInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedCassandraTableGetResultsInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedCassandraTableGetResultsInner.innerProperties + = CassandraTableGetProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCassandraTableGetResultsInner; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ClientEncryptionKeyCreateUpdateProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ClientEncryptionKeyCreateUpdateProperties.java new file mode 100644 index 0000000000000..12a02855bc4aa --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ClientEncryptionKeyCreateUpdateProperties.java @@ -0,0 +1,108 @@ +// Copyright (c) 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.ClientEncryptionKeyResource; +import java.io.IOException; + +/** + * Properties to create and update ClientEncryptionKey. + */ +@Fluent +public final class ClientEncryptionKeyCreateUpdateProperties + implements JsonSerializable { + /* + * The standard JSON format of a ClientEncryptionKey + */ + private ClientEncryptionKeyResource resource; + + /** + * Creates an instance of ClientEncryptionKeyCreateUpdateProperties class. + */ + public ClientEncryptionKeyCreateUpdateProperties() { + } + + /** + * Get the resource property: The standard JSON format of a ClientEncryptionKey. + * + * @return the resource value. + */ + public ClientEncryptionKeyResource resource() { + return this.resource; + } + + /** + * Set the resource property: The standard JSON format of a ClientEncryptionKey. + * + * @param resource the resource value to set. + * @return the ClientEncryptionKeyCreateUpdateProperties object itself. + */ + public ClientEncryptionKeyCreateUpdateProperties withResource(ClientEncryptionKeyResource 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.atError() + .log(new IllegalArgumentException( + "Missing required property resource in model ClientEncryptionKeyCreateUpdateProperties")); + } else { + resource().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ClientEncryptionKeyCreateUpdateProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("resource", this.resource); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ClientEncryptionKeyCreateUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ClientEncryptionKeyCreateUpdateProperties if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ClientEncryptionKeyCreateUpdateProperties. + */ + public static ClientEncryptionKeyCreateUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ClientEncryptionKeyCreateUpdateProperties deserializedClientEncryptionKeyCreateUpdateProperties + = new ClientEncryptionKeyCreateUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resource".equals(fieldName)) { + deserializedClientEncryptionKeyCreateUpdateProperties.resource + = ClientEncryptionKeyResource.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedClientEncryptionKeyCreateUpdateProperties; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ClientEncryptionKeyGetProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ClientEncryptionKeyGetProperties.java new file mode 100644 index 0000000000000..c8bc990c58601 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ClientEncryptionKeyGetProperties.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.ClientEncryptionKeyGetPropertiesResource; +import java.io.IOException; + +/** + * The properties of a ClientEncryptionKey resource. + */ +@Fluent +public final class ClientEncryptionKeyGetProperties implements JsonSerializable { + /* + * The resource property. + */ + private ClientEncryptionKeyGetPropertiesResource resource; + + /** + * Creates an instance of ClientEncryptionKeyGetProperties class. + */ + public ClientEncryptionKeyGetProperties() { + } + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public ClientEncryptionKeyGetPropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the ClientEncryptionKeyGetProperties object itself. + */ + public ClientEncryptionKeyGetProperties withResource(ClientEncryptionKeyGetPropertiesResource 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("resource", this.resource); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ClientEncryptionKeyGetProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ClientEncryptionKeyGetProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ClientEncryptionKeyGetProperties. + */ + public static ClientEncryptionKeyGetProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ClientEncryptionKeyGetProperties deserializedClientEncryptionKeyGetProperties + = new ClientEncryptionKeyGetProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resource".equals(fieldName)) { + deserializedClientEncryptionKeyGetProperties.resource + = ClientEncryptionKeyGetPropertiesResource.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedClientEncryptionKeyGetProperties; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ClientEncryptionKeyGetResultsInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ClientEncryptionKeyGetResultsInner.java new file mode 100644 index 0000000000000..79646a635c940 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ClientEncryptionKeyGetResultsInner.java @@ -0,0 +1,164 @@ +// Copyright (c) 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.ArmProxyResource; +import com.azure.resourcemanager.cosmos.generated.models.ClientEncryptionKeyGetPropertiesResource; +import java.io.IOException; + +/** + * Client Encryption Key. + */ +@Fluent +public final class ClientEncryptionKeyGetResultsInner extends ArmProxyResource { + /* + * The properties of a ClientEncryptionKey + */ + private ClientEncryptionKeyGetProperties innerProperties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ClientEncryptionKeyGetResultsInner class. + */ + public ClientEncryptionKeyGetResultsInner() { + } + + /** + * Get the innerProperties property: The properties of a ClientEncryptionKey. + * + * @return the innerProperties value. + */ + private ClientEncryptionKeyGetProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public ClientEncryptionKeyGetPropertiesResource 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 ClientEncryptionKeyGetResultsInner object itself. + */ + public ClientEncryptionKeyGetResultsInner withResource(ClientEncryptionKeyGetPropertiesResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new ClientEncryptionKeyGetProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ClientEncryptionKeyGetResultsInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ClientEncryptionKeyGetResultsInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ClientEncryptionKeyGetResultsInner. + */ + public static ClientEncryptionKeyGetResultsInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ClientEncryptionKeyGetResultsInner deserializedClientEncryptionKeyGetResultsInner + = new ClientEncryptionKeyGetResultsInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedClientEncryptionKeyGetResultsInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedClientEncryptionKeyGetResultsInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedClientEncryptionKeyGetResultsInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedClientEncryptionKeyGetResultsInner.innerProperties + = ClientEncryptionKeyGetProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedClientEncryptionKeyGetResultsInner; + }); + } +} 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..690bdc8daea72 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ClusterResourceInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.ClusterResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.ManagedCassandraArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.ManagedCassandraManagedServiceIdentity; +import java.io.IOException; +import java.util.Map; + +/** + * Representation of a managed Cassandra cluster. + */ +@Fluent +public final class ClusterResourceInner extends ManagedCassandraArmResourceProperties { + /* + * Properties of a managed Cassandra cluster. + */ + private ClusterResourceProperties properties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ClusterResourceInner class. + */ + public ClusterResourceInner() { + } + + /** + * 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; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public ClusterResourceInner withIdentity(ManagedCassandraManagedServiceIdentity 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() { + if (properties() != null) { + properties().validate(); + } + if (identity() != null) { + identity().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("identity", identity()); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ClusterResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ClusterResourceInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ClusterResourceInner. + */ + public static ClusterResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ClusterResourceInner deserializedClusterResourceInner = new ClusterResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedClusterResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedClusterResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedClusterResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedClusterResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedClusterResourceInner.withTags(tags); + } else if ("identity".equals(fieldName)) { + deserializedClusterResourceInner + .withIdentity(ManagedCassandraManagedServiceIdentity.fromJson(reader)); + } else if ("properties".equals(fieldName)) { + deserializedClusterResourceInner.properties = ClusterResourceProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedClusterResourceInner; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CommandOutputInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CommandOutputInner.java new file mode 100644 index 0000000000000..51d02d42bde30 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CommandOutputInner.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Response of /command api. + */ +@Fluent +public final class CommandOutputInner implements JsonSerializable { + /* + * Output of the command. + */ + private String commandOutput; + + /** + * Creates an instance of CommandOutputInner class. + */ + public CommandOutputInner() { + } + + /** + * Get the commandOutput property: Output of the command. + * + * @return the commandOutput value. + */ + public String commandOutput() { + return this.commandOutput; + } + + /** + * Set the commandOutput property: Output of the command. + * + * @param commandOutput the commandOutput value to set. + * @return the CommandOutputInner object itself. + */ + public CommandOutputInner withCommandOutput(String commandOutput) { + this.commandOutput = commandOutput; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("commandOutput", this.commandOutput); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CommandOutputInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CommandOutputInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the CommandOutputInner. + */ + public static CommandOutputInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CommandOutputInner deserializedCommandOutputInner = new CommandOutputInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("commandOutput".equals(fieldName)) { + deserializedCommandOutputInner.commandOutput = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCommandOutputInner; + }); + } +} 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..fa2fc961ba8b0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DataCenterResourceInner.java @@ -0,0 +1,150 @@ +// Copyright (c) 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.ArmProxyResource; +import com.azure.resourcemanager.cosmos.generated.models.DataCenterResourceProperties; +import java.io.IOException; + +/** + * A managed Cassandra data center. + */ +@Fluent +public final class DataCenterResourceInner extends ArmProxyResource { + /* + * Properties of a managed Cassandra data center. + */ + private DataCenterResourceProperties properties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of DataCenterResourceInner class. + */ + public DataCenterResourceInner() { + } + + /** + * 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; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DataCenterResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DataCenterResourceInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DataCenterResourceInner. + */ + public static DataCenterResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DataCenterResourceInner deserializedDataCenterResourceInner = new DataCenterResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedDataCenterResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedDataCenterResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedDataCenterResourceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedDataCenterResourceInner.properties = DataCenterResourceProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDataCenterResourceInner; + }); + } +} 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..b255864d0ab0d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountCreateUpdateProperties.java @@ -0,0 +1,1116 @@ +// Copyright (c) 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +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.Capacity; +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.DatabaseAccountKeysMetadata; +import com.azure.resourcemanager.cosmos.generated.models.IpAddressOrRange; +import com.azure.resourcemanager.cosmos.generated.models.Location; +import com.azure.resourcemanager.cosmos.generated.models.MinimalTlsVersion; +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 java.io.IOException; +import java.util.List; + +/** + * Properties to create and update Azure Cosmos DB database accounts. + */ +@Fluent +public final class DatabaseAccountCreateUpdateProperties + implements JsonSerializable { + /* + * The consistency policy for the Cosmos DB account. + */ + private ConsistencyPolicy consistencyPolicy; + + /* + * An array that contains the georeplication locations enabled for the Cosmos DB account. + */ + private List locations; + + /* + * The offer type for the database + */ + private String databaseAccountOfferType = "Standard"; + + /* + * List of IpRules. + */ + private List ipRules; + + /* + * Flag to indicate whether to enable/disable Virtual Network ACL rules. + */ + 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. + */ + private Boolean enableAutomaticFailover; + + /* + * List of Cosmos DB capabilities for the account + */ + private List capabilities; + + /* + * List of Virtual Network ACL rules configured for the Cosmos DB account. + */ + private List virtualNetworkRules; + + /* + * Enables the account to write in multiple locations + */ + private Boolean enableMultipleWriteLocations; + + /* + * Enables the cassandra connector on the Cosmos DB C* account + */ + private Boolean enableCassandraConnector; + + /* + * The cassandra connector offer type for the Cosmos DB database C* account. + */ + private ConnectorOffer connectorOffer; + + /* + * Disable write operations on metadata resources (databases, containers, throughput) via account keys + */ + private Boolean disableKeyBasedMetadataWriteAccess; + + /* + * The URI of the key vault + */ + 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. + */ + private String defaultIdentity; + + /* + * Whether requests from Public Network are allowed + */ + private PublicNetworkAccess publicNetworkAccess; + + /* + * Flag to indicate whether Free Tier is enabled. + */ + private Boolean enableFreeTier; + + /* + * API specific properties. Currently, supported only for MongoDB API. + */ + private ApiProperties apiProperties; + + /* + * Flag to indicate whether to enable storage analytics. + */ + private Boolean enableAnalyticalStorage; + + /* + * Analytical storage specific properties. + */ + private AnalyticalStorageConfiguration analyticalStorageConfiguration; + + /* + * Enum to indicate the mode of account creation. + */ + private CreateMode createMode; + + /* + * The object representing the policy for taking backups on an account. + */ + private BackupPolicy backupPolicy; + + /* + * The CORS policy for the Cosmos DB database account. + */ + private List cors; + + /* + * Indicates what services are allowed to bypass firewall checks. + */ + private NetworkAclBypass networkAclBypass; + + /* + * An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account. + */ + private List networkAclBypassResourceIds; + + /* + * Opt-out of local authentication and ensure only MSI and AAD can be used exclusively for authentication. + */ + private Boolean disableLocalAuth; + + /* + * Parameters to indicate the information about the restore. + */ + private RestoreParameters restoreParameters; + + /* + * The object that represents all properties related to capacity enforcement on an account. + */ + private Capacity capacity; + + /* + * This property is ignored during the update/create operation, as the metadata is read-only. The object represents + * the metadata for the Account Keys of the Cosmos DB account. + */ + private DatabaseAccountKeysMetadata keysMetadata; + + /* + * Flag to indicate enabling/disabling of Partition Merge feature on the account + */ + private Boolean enablePartitionMerge; + + /* + * Indicates the minimum allowed Tls version. The default value is Tls 1.2. Cassandra and Mongo APIs only work with + * Tls 1.2. + */ + private MinimalTlsVersion minimalTlsVersion; + + /* + * Flag to indicate enabling/disabling of Burst Capacity feature on the account + */ + private Boolean enableBurstCapacity; + + /* + * Indicates the status of the Customer Managed Key feature on the account. In case there are errors, the property + * provides troubleshooting guidance. + */ + private String customerManagedKeyStatus; + + /* + * Flag to indicate enabling/disabling of PerRegionPerPartitionAutoscale feature on the account + */ + private Boolean enablePerRegionPerPartitionAutoscale; + + /** + * Creates an instance of DatabaseAccountCreateUpdateProperties class. + */ + public DatabaseAccountCreateUpdateProperties() { + } + + /** + * 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 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; + } + + /** + * Get the capacity property: The object that represents all properties related to capacity enforcement on an + * account. + * + * @return the capacity value. + */ + public Capacity capacity() { + return this.capacity; + } + + /** + * Set the capacity property: The object that represents all properties related to capacity enforcement on an + * account. + * + * @param capacity the capacity value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withCapacity(Capacity capacity) { + this.capacity = capacity; + return this; + } + + /** + * Get the keysMetadata property: This property is ignored during the update/create operation, as the metadata is + * read-only. The object represents the metadata for the Account Keys of the Cosmos DB account. + * + * @return the keysMetadata value. + */ + public DatabaseAccountKeysMetadata keysMetadata() { + return this.keysMetadata; + } + + /** + * Get the enablePartitionMerge property: Flag to indicate enabling/disabling of Partition Merge feature on the + * account. + * + * @return the enablePartitionMerge value. + */ + public Boolean enablePartitionMerge() { + return this.enablePartitionMerge; + } + + /** + * Set the enablePartitionMerge property: Flag to indicate enabling/disabling of Partition Merge feature on the + * account. + * + * @param enablePartitionMerge the enablePartitionMerge value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withEnablePartitionMerge(Boolean enablePartitionMerge) { + this.enablePartitionMerge = enablePartitionMerge; + return this; + } + + /** + * Get the minimalTlsVersion property: Indicates the minimum allowed Tls version. The default value is Tls 1.2. + * Cassandra and Mongo APIs only work with Tls 1.2. + * + * @return the minimalTlsVersion value. + */ + public MinimalTlsVersion minimalTlsVersion() { + return this.minimalTlsVersion; + } + + /** + * Set the minimalTlsVersion property: Indicates the minimum allowed Tls version. The default value is Tls 1.2. + * Cassandra and Mongo APIs only work with Tls 1.2. + * + * @param minimalTlsVersion the minimalTlsVersion value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withMinimalTlsVersion(MinimalTlsVersion minimalTlsVersion) { + this.minimalTlsVersion = minimalTlsVersion; + return this; + } + + /** + * Get the enableBurstCapacity property: Flag to indicate enabling/disabling of Burst Capacity feature on the + * account. + * + * @return the enableBurstCapacity value. + */ + public Boolean enableBurstCapacity() { + return this.enableBurstCapacity; + } + + /** + * Set the enableBurstCapacity property: Flag to indicate enabling/disabling of Burst Capacity feature on the + * account. + * + * @param enableBurstCapacity the enableBurstCapacity value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withEnableBurstCapacity(Boolean enableBurstCapacity) { + this.enableBurstCapacity = enableBurstCapacity; + return this; + } + + /** + * Get the customerManagedKeyStatus property: Indicates the status of the Customer Managed Key feature on the + * account. In case there are errors, the property provides troubleshooting guidance. + * + * @return the customerManagedKeyStatus value. + */ + public String customerManagedKeyStatus() { + return this.customerManagedKeyStatus; + } + + /** + * Set the customerManagedKeyStatus property: Indicates the status of the Customer Managed Key feature on the + * account. In case there are errors, the property provides troubleshooting guidance. + * + * @param customerManagedKeyStatus the customerManagedKeyStatus value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withCustomerManagedKeyStatus(String customerManagedKeyStatus) { + this.customerManagedKeyStatus = customerManagedKeyStatus; + return this; + } + + /** + * Get the enablePerRegionPerPartitionAutoscale property: Flag to indicate enabling/disabling of + * PerRegionPerPartitionAutoscale feature on the account. + * + * @return the enablePerRegionPerPartitionAutoscale value. + */ + public Boolean enablePerRegionPerPartitionAutoscale() { + return this.enablePerRegionPerPartitionAutoscale; + } + + /** + * Set the enablePerRegionPerPartitionAutoscale property: Flag to indicate enabling/disabling of + * PerRegionPerPartitionAutoscale feature on the account. + * + * @param enablePerRegionPerPartitionAutoscale the enablePerRegionPerPartitionAutoscale value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties + withEnablePerRegionPerPartitionAutoscale(Boolean enablePerRegionPerPartitionAutoscale) { + this.enablePerRegionPerPartitionAutoscale = enablePerRegionPerPartitionAutoscale; + 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.atError() + .log(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 (backupPolicy() != null) { + backupPolicy().validate(); + } + if (cors() != null) { + cors().forEach(e -> e.validate()); + } + if (restoreParameters() != null) { + restoreParameters().validate(); + } + if (capacity() != null) { + capacity().validate(); + } + if (keysMetadata() != null) { + keysMetadata().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DatabaseAccountCreateUpdateProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("locations", this.locations, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("databaseAccountOfferType", this.databaseAccountOfferType); + jsonWriter.writeJsonField("consistencyPolicy", this.consistencyPolicy); + jsonWriter.writeArrayField("ipRules", this.ipRules, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeBooleanField("isVirtualNetworkFilterEnabled", this.isVirtualNetworkFilterEnabled); + jsonWriter.writeBooleanField("enableAutomaticFailover", this.enableAutomaticFailover); + jsonWriter.writeArrayField("capabilities", this.capabilities, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("virtualNetworkRules", this.virtualNetworkRules, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeBooleanField("enableMultipleWriteLocations", this.enableMultipleWriteLocations); + jsonWriter.writeBooleanField("enableCassandraConnector", this.enableCassandraConnector); + jsonWriter.writeStringField("connectorOffer", + this.connectorOffer == null ? null : this.connectorOffer.toString()); + jsonWriter.writeBooleanField("disableKeyBasedMetadataWriteAccess", this.disableKeyBasedMetadataWriteAccess); + jsonWriter.writeStringField("keyVaultKeyUri", this.keyVaultKeyUri); + jsonWriter.writeStringField("defaultIdentity", this.defaultIdentity); + jsonWriter.writeStringField("publicNetworkAccess", + this.publicNetworkAccess == null ? null : this.publicNetworkAccess.toString()); + jsonWriter.writeBooleanField("enableFreeTier", this.enableFreeTier); + jsonWriter.writeJsonField("apiProperties", this.apiProperties); + jsonWriter.writeBooleanField("enableAnalyticalStorage", this.enableAnalyticalStorage); + jsonWriter.writeJsonField("analyticalStorageConfiguration", this.analyticalStorageConfiguration); + jsonWriter.writeStringField("createMode", this.createMode == null ? null : this.createMode.toString()); + jsonWriter.writeJsonField("backupPolicy", this.backupPolicy); + jsonWriter.writeArrayField("cors", this.cors, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("networkAclBypass", + this.networkAclBypass == null ? null : this.networkAclBypass.toString()); + jsonWriter.writeArrayField("networkAclBypassResourceIds", this.networkAclBypassResourceIds, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeBooleanField("disableLocalAuth", this.disableLocalAuth); + jsonWriter.writeJsonField("restoreParameters", this.restoreParameters); + jsonWriter.writeJsonField("capacity", this.capacity); + jsonWriter.writeBooleanField("enablePartitionMerge", this.enablePartitionMerge); + jsonWriter.writeStringField("minimalTlsVersion", + this.minimalTlsVersion == null ? null : this.minimalTlsVersion.toString()); + jsonWriter.writeBooleanField("enableBurstCapacity", this.enableBurstCapacity); + jsonWriter.writeStringField("customerManagedKeyStatus", this.customerManagedKeyStatus); + jsonWriter.writeBooleanField("enablePerRegionPerPartitionAutoscale", this.enablePerRegionPerPartitionAutoscale); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DatabaseAccountCreateUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DatabaseAccountCreateUpdateProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DatabaseAccountCreateUpdateProperties. + */ + public static DatabaseAccountCreateUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DatabaseAccountCreateUpdateProperties deserializedDatabaseAccountCreateUpdateProperties + = new DatabaseAccountCreateUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("locations".equals(fieldName)) { + List locations = reader.readArray(reader1 -> Location.fromJson(reader1)); + deserializedDatabaseAccountCreateUpdateProperties.locations = locations; + } else if ("consistencyPolicy".equals(fieldName)) { + deserializedDatabaseAccountCreateUpdateProperties.consistencyPolicy + = ConsistencyPolicy.fromJson(reader); + } else if ("ipRules".equals(fieldName)) { + List ipRules = reader.readArray(reader1 -> IpAddressOrRange.fromJson(reader1)); + deserializedDatabaseAccountCreateUpdateProperties.ipRules = ipRules; + } else if ("isVirtualNetworkFilterEnabled".equals(fieldName)) { + deserializedDatabaseAccountCreateUpdateProperties.isVirtualNetworkFilterEnabled + = reader.getNullable(JsonReader::getBoolean); + } else if ("enableAutomaticFailover".equals(fieldName)) { + deserializedDatabaseAccountCreateUpdateProperties.enableAutomaticFailover + = reader.getNullable(JsonReader::getBoolean); + } else if ("capabilities".equals(fieldName)) { + List capabilities = reader.readArray(reader1 -> Capability.fromJson(reader1)); + deserializedDatabaseAccountCreateUpdateProperties.capabilities = capabilities; + } else if ("virtualNetworkRules".equals(fieldName)) { + List virtualNetworkRules + = reader.readArray(reader1 -> VirtualNetworkRule.fromJson(reader1)); + deserializedDatabaseAccountCreateUpdateProperties.virtualNetworkRules = virtualNetworkRules; + } else if ("enableMultipleWriteLocations".equals(fieldName)) { + deserializedDatabaseAccountCreateUpdateProperties.enableMultipleWriteLocations + = reader.getNullable(JsonReader::getBoolean); + } else if ("enableCassandraConnector".equals(fieldName)) { + deserializedDatabaseAccountCreateUpdateProperties.enableCassandraConnector + = reader.getNullable(JsonReader::getBoolean); + } else if ("connectorOffer".equals(fieldName)) { + deserializedDatabaseAccountCreateUpdateProperties.connectorOffer + = ConnectorOffer.fromString(reader.getString()); + } else if ("disableKeyBasedMetadataWriteAccess".equals(fieldName)) { + deserializedDatabaseAccountCreateUpdateProperties.disableKeyBasedMetadataWriteAccess + = reader.getNullable(JsonReader::getBoolean); + } else if ("keyVaultKeyUri".equals(fieldName)) { + deserializedDatabaseAccountCreateUpdateProperties.keyVaultKeyUri = reader.getString(); + } else if ("defaultIdentity".equals(fieldName)) { + deserializedDatabaseAccountCreateUpdateProperties.defaultIdentity = reader.getString(); + } else if ("publicNetworkAccess".equals(fieldName)) { + deserializedDatabaseAccountCreateUpdateProperties.publicNetworkAccess + = PublicNetworkAccess.fromString(reader.getString()); + } else if ("enableFreeTier".equals(fieldName)) { + deserializedDatabaseAccountCreateUpdateProperties.enableFreeTier + = reader.getNullable(JsonReader::getBoolean); + } else if ("apiProperties".equals(fieldName)) { + deserializedDatabaseAccountCreateUpdateProperties.apiProperties = ApiProperties.fromJson(reader); + } else if ("enableAnalyticalStorage".equals(fieldName)) { + deserializedDatabaseAccountCreateUpdateProperties.enableAnalyticalStorage + = reader.getNullable(JsonReader::getBoolean); + } else if ("analyticalStorageConfiguration".equals(fieldName)) { + deserializedDatabaseAccountCreateUpdateProperties.analyticalStorageConfiguration + = AnalyticalStorageConfiguration.fromJson(reader); + } else if ("createMode".equals(fieldName)) { + deserializedDatabaseAccountCreateUpdateProperties.createMode + = CreateMode.fromString(reader.getString()); + } else if ("backupPolicy".equals(fieldName)) { + deserializedDatabaseAccountCreateUpdateProperties.backupPolicy = BackupPolicy.fromJson(reader); + } else if ("cors".equals(fieldName)) { + List cors = reader.readArray(reader1 -> CorsPolicy.fromJson(reader1)); + deserializedDatabaseAccountCreateUpdateProperties.cors = cors; + } else if ("networkAclBypass".equals(fieldName)) { + deserializedDatabaseAccountCreateUpdateProperties.networkAclBypass + = NetworkAclBypass.fromString(reader.getString()); + } else if ("networkAclBypassResourceIds".equals(fieldName)) { + List networkAclBypassResourceIds = reader.readArray(reader1 -> reader1.getString()); + deserializedDatabaseAccountCreateUpdateProperties.networkAclBypassResourceIds + = networkAclBypassResourceIds; + } else if ("disableLocalAuth".equals(fieldName)) { + deserializedDatabaseAccountCreateUpdateProperties.disableLocalAuth + = reader.getNullable(JsonReader::getBoolean); + } else if ("restoreParameters".equals(fieldName)) { + deserializedDatabaseAccountCreateUpdateProperties.restoreParameters + = RestoreParameters.fromJson(reader); + } else if ("capacity".equals(fieldName)) { + deserializedDatabaseAccountCreateUpdateProperties.capacity = Capacity.fromJson(reader); + } else if ("keysMetadata".equals(fieldName)) { + deserializedDatabaseAccountCreateUpdateProperties.keysMetadata + = DatabaseAccountKeysMetadata.fromJson(reader); + } else if ("enablePartitionMerge".equals(fieldName)) { + deserializedDatabaseAccountCreateUpdateProperties.enablePartitionMerge + = reader.getNullable(JsonReader::getBoolean); + } else if ("minimalTlsVersion".equals(fieldName)) { + deserializedDatabaseAccountCreateUpdateProperties.minimalTlsVersion + = MinimalTlsVersion.fromString(reader.getString()); + } else if ("enableBurstCapacity".equals(fieldName)) { + deserializedDatabaseAccountCreateUpdateProperties.enableBurstCapacity + = reader.getNullable(JsonReader::getBoolean); + } else if ("customerManagedKeyStatus".equals(fieldName)) { + deserializedDatabaseAccountCreateUpdateProperties.customerManagedKeyStatus = reader.getString(); + } else if ("enablePerRegionPerPartitionAutoscale".equals(fieldName)) { + deserializedDatabaseAccountCreateUpdateProperties.enablePerRegionPerPartitionAutoscale + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedDatabaseAccountCreateUpdateProperties; + }); + } +} 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..75cf936239699 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountGetProperties.java @@ -0,0 +1,1219 @@ +// Copyright (c) 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +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.Capacity; +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.DatabaseAccountKeysMetadata; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountOfferType; +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.MinimalTlsVersion; +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 java.io.IOException; +import java.util.List; + +/** + * Properties for the database account. + */ +@Fluent +public final class DatabaseAccountGetProperties implements JsonSerializable { + /* + * 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. + */ + private String provisioningState; + + /* + * The connection endpoint for the Cosmos DB database account. + */ + private String documentEndpoint; + + /* + * The offer type for the Cosmos DB database account. Default value: Standard. + */ + private DatabaseAccountOfferType databaseAccountOfferType; + + /* + * List of IpRules. + */ + private List ipRules; + + /* + * Flag to indicate whether to enable/disable Virtual Network ACL rules. + */ + 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. + */ + private Boolean enableAutomaticFailover; + + /* + * The consistency policy for the Cosmos DB database account. + */ + private ConsistencyPolicy consistencyPolicy; + + /* + * List of Cosmos DB capabilities for the account + */ + private List capabilities; + + /* + * An array that contains the write location for the Cosmos DB account. + */ + private List writeLocations; + + /* + * An array that contains of the read locations enabled for the Cosmos DB account. + */ + private List readLocations; + + /* + * An array that contains all of the locations enabled for the Cosmos DB account. + */ + private List locations; + + /* + * An array that contains the regions ordered by their failover priorities. + */ + private List failoverPolicies; + + /* + * List of Virtual Network ACL rules configured for the Cosmos DB account. + */ + private List virtualNetworkRules; + + /* + * List of Private Endpoint Connections configured for the Cosmos DB account. + */ + private List privateEndpointConnections; + + /* + * Enables the account to write in multiple locations + */ + private Boolean enableMultipleWriteLocations; + + /* + * Enables the cassandra connector on the Cosmos DB C* account + */ + private Boolean enableCassandraConnector; + + /* + * The cassandra connector offer type for the Cosmos DB database C* account. + */ + private ConnectorOffer connectorOffer; + + /* + * Disable write operations on metadata resources (databases, containers, throughput) via account keys + */ + private Boolean disableKeyBasedMetadataWriteAccess; + + /* + * The URI of the key vault + */ + 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. + */ + private String defaultIdentity; + + /* + * Whether requests from Public Network are allowed + */ + private PublicNetworkAccess publicNetworkAccess; + + /* + * Flag to indicate whether Free Tier is enabled. + */ + private Boolean enableFreeTier; + + /* + * API specific properties. + */ + private ApiProperties apiProperties; + + /* + * Flag to indicate whether to enable storage analytics. + */ + private Boolean enableAnalyticalStorage; + + /* + * Analytical storage specific properties. + */ + private AnalyticalStorageConfiguration analyticalStorageConfiguration; + + /* + * A unique identifier assigned to the database account + */ + private String instanceId; + + /* + * Enum to indicate the mode of account creation. + */ + private CreateMode createMode; + + /* + * Parameters to indicate the information about the restore. + */ + private RestoreParameters restoreParameters; + + /* + * The object representing the policy for taking backups on an account. + */ + private BackupPolicy backupPolicy; + + /* + * The CORS policy for the Cosmos DB database account. + */ + private List cors; + + /* + * Indicates what services are allowed to bypass firewall checks. + */ + private NetworkAclBypass networkAclBypass; + + /* + * An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account. + */ + private List networkAclBypassResourceIds; + + /* + * Opt-out of local authentication and ensure only MSI and AAD can be used exclusively for authentication. + */ + private Boolean disableLocalAuth; + + /* + * The object that represents all properties related to capacity enforcement on an account. + */ + private Capacity capacity; + + /* + * The object that represents the metadata for the Account Keys of the Cosmos DB account. + */ + private DatabaseAccountKeysMetadata keysMetadata; + + /* + * Flag to indicate enabling/disabling of Partition Merge feature on the account + */ + private Boolean enablePartitionMerge; + + /* + * Indicates the minimum allowed Tls version. The default value is Tls 1.2. Cassandra and Mongo APIs only work with + * Tls 1.2. + */ + private MinimalTlsVersion minimalTlsVersion; + + /* + * Flag to indicate enabling/disabling of Burst Capacity feature on the account + */ + private Boolean enableBurstCapacity; + + /* + * Indicates the status of the Customer Managed Key feature on the account. In case there are errors, the property + * provides troubleshooting guidance. + */ + private String customerManagedKeyStatus; + + /* + * Flag to indicate enabling/disabling of PerRegionPerPartitionAutoscale feature on the account + */ + private Boolean enablePerRegionPerPartitionAutoscale; + + /** + * Creates an instance of DatabaseAccountGetProperties class. + */ + public DatabaseAccountGetProperties() { + } + + /** + * 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 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; + } + + /** + * Get the capacity property: The object that represents all properties related to capacity enforcement on an + * account. + * + * @return the capacity value. + */ + public Capacity capacity() { + return this.capacity; + } + + /** + * Set the capacity property: The object that represents all properties related to capacity enforcement on an + * account. + * + * @param capacity the capacity value to set. + * @return the DatabaseAccountGetProperties object itself. + */ + public DatabaseAccountGetProperties withCapacity(Capacity capacity) { + this.capacity = capacity; + return this; + } + + /** + * Get the keysMetadata property: The object that represents the metadata for the Account Keys of the Cosmos DB + * account. + * + * @return the keysMetadata value. + */ + public DatabaseAccountKeysMetadata keysMetadata() { + return this.keysMetadata; + } + + /** + * Get the enablePartitionMerge property: Flag to indicate enabling/disabling of Partition Merge feature on the + * account. + * + * @return the enablePartitionMerge value. + */ + public Boolean enablePartitionMerge() { + return this.enablePartitionMerge; + } + + /** + * Set the enablePartitionMerge property: Flag to indicate enabling/disabling of Partition Merge feature on the + * account. + * + * @param enablePartitionMerge the enablePartitionMerge value to set. + * @return the DatabaseAccountGetProperties object itself. + */ + public DatabaseAccountGetProperties withEnablePartitionMerge(Boolean enablePartitionMerge) { + this.enablePartitionMerge = enablePartitionMerge; + return this; + } + + /** + * Get the minimalTlsVersion property: Indicates the minimum allowed Tls version. The default value is Tls 1.2. + * Cassandra and Mongo APIs only work with Tls 1.2. + * + * @return the minimalTlsVersion value. + */ + public MinimalTlsVersion minimalTlsVersion() { + return this.minimalTlsVersion; + } + + /** + * Set the minimalTlsVersion property: Indicates the minimum allowed Tls version. The default value is Tls 1.2. + * Cassandra and Mongo APIs only work with Tls 1.2. + * + * @param minimalTlsVersion the minimalTlsVersion value to set. + * @return the DatabaseAccountGetProperties object itself. + */ + public DatabaseAccountGetProperties withMinimalTlsVersion(MinimalTlsVersion minimalTlsVersion) { + this.minimalTlsVersion = minimalTlsVersion; + return this; + } + + /** + * Get the enableBurstCapacity property: Flag to indicate enabling/disabling of Burst Capacity feature on the + * account. + * + * @return the enableBurstCapacity value. + */ + public Boolean enableBurstCapacity() { + return this.enableBurstCapacity; + } + + /** + * Set the enableBurstCapacity property: Flag to indicate enabling/disabling of Burst Capacity feature on the + * account. + * + * @param enableBurstCapacity the enableBurstCapacity value to set. + * @return the DatabaseAccountGetProperties object itself. + */ + public DatabaseAccountGetProperties withEnableBurstCapacity(Boolean enableBurstCapacity) { + this.enableBurstCapacity = enableBurstCapacity; + return this; + } + + /** + * Get the customerManagedKeyStatus property: Indicates the status of the Customer Managed Key feature on the + * account. In case there are errors, the property provides troubleshooting guidance. + * + * @return the customerManagedKeyStatus value. + */ + public String customerManagedKeyStatus() { + return this.customerManagedKeyStatus; + } + + /** + * Set the customerManagedKeyStatus property: Indicates the status of the Customer Managed Key feature on the + * account. In case there are errors, the property provides troubleshooting guidance. + * + * @param customerManagedKeyStatus the customerManagedKeyStatus value to set. + * @return the DatabaseAccountGetProperties object itself. + */ + public DatabaseAccountGetProperties withCustomerManagedKeyStatus(String customerManagedKeyStatus) { + this.customerManagedKeyStatus = customerManagedKeyStatus; + return this; + } + + /** + * Get the enablePerRegionPerPartitionAutoscale property: Flag to indicate enabling/disabling of + * PerRegionPerPartitionAutoscale feature on the account. + * + * @return the enablePerRegionPerPartitionAutoscale value. + */ + public Boolean enablePerRegionPerPartitionAutoscale() { + return this.enablePerRegionPerPartitionAutoscale; + } + + /** + * Set the enablePerRegionPerPartitionAutoscale property: Flag to indicate enabling/disabling of + * PerRegionPerPartitionAutoscale feature on the account. + * + * @param enablePerRegionPerPartitionAutoscale the enablePerRegionPerPartitionAutoscale value to set. + * @return the DatabaseAccountGetProperties object itself. + */ + public DatabaseAccountGetProperties + withEnablePerRegionPerPartitionAutoscale(Boolean enablePerRegionPerPartitionAutoscale) { + this.enablePerRegionPerPartitionAutoscale = enablePerRegionPerPartitionAutoscale; + 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 (capacity() != null) { + capacity().validate(); + } + if (keysMetadata() != null) { + keysMetadata().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("ipRules", this.ipRules, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeBooleanField("isVirtualNetworkFilterEnabled", this.isVirtualNetworkFilterEnabled); + jsonWriter.writeBooleanField("enableAutomaticFailover", this.enableAutomaticFailover); + jsonWriter.writeJsonField("consistencyPolicy", this.consistencyPolicy); + jsonWriter.writeArrayField("capabilities", this.capabilities, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("virtualNetworkRules", this.virtualNetworkRules, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeBooleanField("enableMultipleWriteLocations", this.enableMultipleWriteLocations); + jsonWriter.writeBooleanField("enableCassandraConnector", this.enableCassandraConnector); + jsonWriter.writeStringField("connectorOffer", + this.connectorOffer == null ? null : this.connectorOffer.toString()); + jsonWriter.writeBooleanField("disableKeyBasedMetadataWriteAccess", this.disableKeyBasedMetadataWriteAccess); + jsonWriter.writeStringField("keyVaultKeyUri", this.keyVaultKeyUri); + jsonWriter.writeStringField("defaultIdentity", this.defaultIdentity); + jsonWriter.writeStringField("publicNetworkAccess", + this.publicNetworkAccess == null ? null : this.publicNetworkAccess.toString()); + jsonWriter.writeBooleanField("enableFreeTier", this.enableFreeTier); + jsonWriter.writeJsonField("apiProperties", this.apiProperties); + jsonWriter.writeBooleanField("enableAnalyticalStorage", this.enableAnalyticalStorage); + jsonWriter.writeJsonField("analyticalStorageConfiguration", this.analyticalStorageConfiguration); + jsonWriter.writeStringField("createMode", this.createMode == null ? null : this.createMode.toString()); + jsonWriter.writeJsonField("restoreParameters", this.restoreParameters); + jsonWriter.writeJsonField("backupPolicy", this.backupPolicy); + jsonWriter.writeArrayField("cors", this.cors, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("networkAclBypass", + this.networkAclBypass == null ? null : this.networkAclBypass.toString()); + jsonWriter.writeArrayField("networkAclBypassResourceIds", this.networkAclBypassResourceIds, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeBooleanField("disableLocalAuth", this.disableLocalAuth); + jsonWriter.writeJsonField("capacity", this.capacity); + jsonWriter.writeBooleanField("enablePartitionMerge", this.enablePartitionMerge); + jsonWriter.writeStringField("minimalTlsVersion", + this.minimalTlsVersion == null ? null : this.minimalTlsVersion.toString()); + jsonWriter.writeBooleanField("enableBurstCapacity", this.enableBurstCapacity); + jsonWriter.writeStringField("customerManagedKeyStatus", this.customerManagedKeyStatus); + jsonWriter.writeBooleanField("enablePerRegionPerPartitionAutoscale", this.enablePerRegionPerPartitionAutoscale); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DatabaseAccountGetProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DatabaseAccountGetProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DatabaseAccountGetProperties. + */ + public static DatabaseAccountGetProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DatabaseAccountGetProperties deserializedDatabaseAccountGetProperties = new DatabaseAccountGetProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedDatabaseAccountGetProperties.provisioningState = reader.getString(); + } else if ("documentEndpoint".equals(fieldName)) { + deserializedDatabaseAccountGetProperties.documentEndpoint = reader.getString(); + } else if ("databaseAccountOfferType".equals(fieldName)) { + deserializedDatabaseAccountGetProperties.databaseAccountOfferType + = DatabaseAccountOfferType.fromString(reader.getString()); + } else if ("ipRules".equals(fieldName)) { + List ipRules = reader.readArray(reader1 -> IpAddressOrRange.fromJson(reader1)); + deserializedDatabaseAccountGetProperties.ipRules = ipRules; + } else if ("isVirtualNetworkFilterEnabled".equals(fieldName)) { + deserializedDatabaseAccountGetProperties.isVirtualNetworkFilterEnabled + = reader.getNullable(JsonReader::getBoolean); + } else if ("enableAutomaticFailover".equals(fieldName)) { + deserializedDatabaseAccountGetProperties.enableAutomaticFailover + = reader.getNullable(JsonReader::getBoolean); + } else if ("consistencyPolicy".equals(fieldName)) { + deserializedDatabaseAccountGetProperties.consistencyPolicy = ConsistencyPolicy.fromJson(reader); + } else if ("capabilities".equals(fieldName)) { + List capabilities = reader.readArray(reader1 -> Capability.fromJson(reader1)); + deserializedDatabaseAccountGetProperties.capabilities = capabilities; + } else if ("writeLocations".equals(fieldName)) { + List writeLocations = reader.readArray(reader1 -> Location.fromJson(reader1)); + deserializedDatabaseAccountGetProperties.writeLocations = writeLocations; + } else if ("readLocations".equals(fieldName)) { + List readLocations = reader.readArray(reader1 -> Location.fromJson(reader1)); + deserializedDatabaseAccountGetProperties.readLocations = readLocations; + } else if ("locations".equals(fieldName)) { + List locations = reader.readArray(reader1 -> Location.fromJson(reader1)); + deserializedDatabaseAccountGetProperties.locations = locations; + } else if ("failoverPolicies".equals(fieldName)) { + List failoverPolicies + = reader.readArray(reader1 -> FailoverPolicy.fromJson(reader1)); + deserializedDatabaseAccountGetProperties.failoverPolicies = failoverPolicies; + } else if ("virtualNetworkRules".equals(fieldName)) { + List virtualNetworkRules + = reader.readArray(reader1 -> VirtualNetworkRule.fromJson(reader1)); + deserializedDatabaseAccountGetProperties.virtualNetworkRules = virtualNetworkRules; + } else if ("privateEndpointConnections".equals(fieldName)) { + List privateEndpointConnections + = reader.readArray(reader1 -> PrivateEndpointConnectionInner.fromJson(reader1)); + deserializedDatabaseAccountGetProperties.privateEndpointConnections = privateEndpointConnections; + } else if ("enableMultipleWriteLocations".equals(fieldName)) { + deserializedDatabaseAccountGetProperties.enableMultipleWriteLocations + = reader.getNullable(JsonReader::getBoolean); + } else if ("enableCassandraConnector".equals(fieldName)) { + deserializedDatabaseAccountGetProperties.enableCassandraConnector + = reader.getNullable(JsonReader::getBoolean); + } else if ("connectorOffer".equals(fieldName)) { + deserializedDatabaseAccountGetProperties.connectorOffer + = ConnectorOffer.fromString(reader.getString()); + } else if ("disableKeyBasedMetadataWriteAccess".equals(fieldName)) { + deserializedDatabaseAccountGetProperties.disableKeyBasedMetadataWriteAccess + = reader.getNullable(JsonReader::getBoolean); + } else if ("keyVaultKeyUri".equals(fieldName)) { + deserializedDatabaseAccountGetProperties.keyVaultKeyUri = reader.getString(); + } else if ("defaultIdentity".equals(fieldName)) { + deserializedDatabaseAccountGetProperties.defaultIdentity = reader.getString(); + } else if ("publicNetworkAccess".equals(fieldName)) { + deserializedDatabaseAccountGetProperties.publicNetworkAccess + = PublicNetworkAccess.fromString(reader.getString()); + } else if ("enableFreeTier".equals(fieldName)) { + deserializedDatabaseAccountGetProperties.enableFreeTier + = reader.getNullable(JsonReader::getBoolean); + } else if ("apiProperties".equals(fieldName)) { + deserializedDatabaseAccountGetProperties.apiProperties = ApiProperties.fromJson(reader); + } else if ("enableAnalyticalStorage".equals(fieldName)) { + deserializedDatabaseAccountGetProperties.enableAnalyticalStorage + = reader.getNullable(JsonReader::getBoolean); + } else if ("analyticalStorageConfiguration".equals(fieldName)) { + deserializedDatabaseAccountGetProperties.analyticalStorageConfiguration + = AnalyticalStorageConfiguration.fromJson(reader); + } else if ("instanceId".equals(fieldName)) { + deserializedDatabaseAccountGetProperties.instanceId = reader.getString(); + } else if ("createMode".equals(fieldName)) { + deserializedDatabaseAccountGetProperties.createMode = CreateMode.fromString(reader.getString()); + } else if ("restoreParameters".equals(fieldName)) { + deserializedDatabaseAccountGetProperties.restoreParameters = RestoreParameters.fromJson(reader); + } else if ("backupPolicy".equals(fieldName)) { + deserializedDatabaseAccountGetProperties.backupPolicy = BackupPolicy.fromJson(reader); + } else if ("cors".equals(fieldName)) { + List cors = reader.readArray(reader1 -> CorsPolicy.fromJson(reader1)); + deserializedDatabaseAccountGetProperties.cors = cors; + } else if ("networkAclBypass".equals(fieldName)) { + deserializedDatabaseAccountGetProperties.networkAclBypass + = NetworkAclBypass.fromString(reader.getString()); + } else if ("networkAclBypassResourceIds".equals(fieldName)) { + List networkAclBypassResourceIds = reader.readArray(reader1 -> reader1.getString()); + deserializedDatabaseAccountGetProperties.networkAclBypassResourceIds = networkAclBypassResourceIds; + } else if ("disableLocalAuth".equals(fieldName)) { + deserializedDatabaseAccountGetProperties.disableLocalAuth + = reader.getNullable(JsonReader::getBoolean); + } else if ("capacity".equals(fieldName)) { + deserializedDatabaseAccountGetProperties.capacity = Capacity.fromJson(reader); + } else if ("keysMetadata".equals(fieldName)) { + deserializedDatabaseAccountGetProperties.keysMetadata + = DatabaseAccountKeysMetadata.fromJson(reader); + } else if ("enablePartitionMerge".equals(fieldName)) { + deserializedDatabaseAccountGetProperties.enablePartitionMerge + = reader.getNullable(JsonReader::getBoolean); + } else if ("minimalTlsVersion".equals(fieldName)) { + deserializedDatabaseAccountGetProperties.minimalTlsVersion + = MinimalTlsVersion.fromString(reader.getString()); + } else if ("enableBurstCapacity".equals(fieldName)) { + deserializedDatabaseAccountGetProperties.enableBurstCapacity + = reader.getNullable(JsonReader::getBoolean); + } else if ("customerManagedKeyStatus".equals(fieldName)) { + deserializedDatabaseAccountGetProperties.customerManagedKeyStatus = reader.getString(); + } else if ("enablePerRegionPerPartitionAutoscale".equals(fieldName)) { + deserializedDatabaseAccountGetProperties.enablePerRegionPerPartitionAutoscale + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedDatabaseAccountGetProperties; + }); + } +} 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..98ce7854700b6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountGetResultsInner.java @@ -0,0 +1,1084 @@ +// Copyright (c) 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +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.Capacity; +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.DatabaseAccountKeysMetadata; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountKind; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountOfferType; +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.MinimalTlsVersion; +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 java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * An Azure Cosmos DB database account. + */ +@Fluent +public final class DatabaseAccountGetResultsInner extends ArmResourceProperties { + /* + * Indicates the type of database account. This can only be set at database account creation. + */ + private DatabaseAccountKind kind; + + /* + * Identity for the resource. + */ + private ManagedServiceIdentity identity; + + /* + * Properties for the database account. + */ + private DatabaseAccountGetProperties innerProperties; + + /* + * The system meta data relating to this resource. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of DatabaseAccountGetResultsInner class. + */ + public DatabaseAccountGetResultsInner() { + } + + /** + * 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 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 DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + 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; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@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 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; + } + + /** + * Get the capacity property: The object that represents all properties related to capacity enforcement on an + * account. + * + * @return the capacity value. + */ + public Capacity capacity() { + return this.innerProperties() == null ? null : this.innerProperties().capacity(); + } + + /** + * Set the capacity property: The object that represents all properties related to capacity enforcement on an + * account. + * + * @param capacity the capacity value to set. + * @return the DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner withCapacity(Capacity capacity) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountGetProperties(); + } + this.innerProperties().withCapacity(capacity); + return this; + } + + /** + * Get the keysMetadata property: The object that represents the metadata for the Account Keys of the Cosmos DB + * account. + * + * @return the keysMetadata value. + */ + public DatabaseAccountKeysMetadata keysMetadata() { + return this.innerProperties() == null ? null : this.innerProperties().keysMetadata(); + } + + /** + * Get the enablePartitionMerge property: Flag to indicate enabling/disabling of Partition Merge feature on the + * account. + * + * @return the enablePartitionMerge value. + */ + public Boolean enablePartitionMerge() { + return this.innerProperties() == null ? null : this.innerProperties().enablePartitionMerge(); + } + + /** + * Set the enablePartitionMerge property: Flag to indicate enabling/disabling of Partition Merge feature on the + * account. + * + * @param enablePartitionMerge the enablePartitionMerge value to set. + * @return the DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner withEnablePartitionMerge(Boolean enablePartitionMerge) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountGetProperties(); + } + this.innerProperties().withEnablePartitionMerge(enablePartitionMerge); + return this; + } + + /** + * Get the minimalTlsVersion property: Indicates the minimum allowed Tls version. The default value is Tls 1.2. + * Cassandra and Mongo APIs only work with Tls 1.2. + * + * @return the minimalTlsVersion value. + */ + public MinimalTlsVersion minimalTlsVersion() { + return this.innerProperties() == null ? null : this.innerProperties().minimalTlsVersion(); + } + + /** + * Set the minimalTlsVersion property: Indicates the minimum allowed Tls version. The default value is Tls 1.2. + * Cassandra and Mongo APIs only work with Tls 1.2. + * + * @param minimalTlsVersion the minimalTlsVersion value to set. + * @return the DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner withMinimalTlsVersion(MinimalTlsVersion minimalTlsVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountGetProperties(); + } + this.innerProperties().withMinimalTlsVersion(minimalTlsVersion); + return this; + } + + /** + * Get the enableBurstCapacity property: Flag to indicate enabling/disabling of Burst Capacity feature on the + * account. + * + * @return the enableBurstCapacity value. + */ + public Boolean enableBurstCapacity() { + return this.innerProperties() == null ? null : this.innerProperties().enableBurstCapacity(); + } + + /** + * Set the enableBurstCapacity property: Flag to indicate enabling/disabling of Burst Capacity feature on the + * account. + * + * @param enableBurstCapacity the enableBurstCapacity value to set. + * @return the DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner withEnableBurstCapacity(Boolean enableBurstCapacity) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountGetProperties(); + } + this.innerProperties().withEnableBurstCapacity(enableBurstCapacity); + return this; + } + + /** + * Get the customerManagedKeyStatus property: Indicates the status of the Customer Managed Key feature on the + * account. In case there are errors, the property provides troubleshooting guidance. + * + * @return the customerManagedKeyStatus value. + */ + public String customerManagedKeyStatus() { + return this.innerProperties() == null ? null : this.innerProperties().customerManagedKeyStatus(); + } + + /** + * Set the customerManagedKeyStatus property: Indicates the status of the Customer Managed Key feature on the + * account. In case there are errors, the property provides troubleshooting guidance. + * + * @param customerManagedKeyStatus the customerManagedKeyStatus value to set. + * @return the DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner withCustomerManagedKeyStatus(String customerManagedKeyStatus) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountGetProperties(); + } + this.innerProperties().withCustomerManagedKeyStatus(customerManagedKeyStatus); + return this; + } + + /** + * Get the enablePerRegionPerPartitionAutoscale property: Flag to indicate enabling/disabling of + * PerRegionPerPartitionAutoscale feature on the account. + * + * @return the enablePerRegionPerPartitionAutoscale value. + */ + public Boolean enablePerRegionPerPartitionAutoscale() { + return this.innerProperties() == null ? null : this.innerProperties().enablePerRegionPerPartitionAutoscale(); + } + + /** + * Set the enablePerRegionPerPartitionAutoscale property: Flag to indicate enabling/disabling of + * PerRegionPerPartitionAutoscale feature on the account. + * + * @param enablePerRegionPerPartitionAutoscale the enablePerRegionPerPartitionAutoscale value to set. + * @return the DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner + withEnablePerRegionPerPartitionAutoscale(Boolean enablePerRegionPerPartitionAutoscale) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountGetProperties(); + } + this.innerProperties().withEnablePerRegionPerPartitionAutoscale(enablePerRegionPerPartitionAutoscale); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (identity() != null) { + identity().validate(); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("identity", this.identity); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DatabaseAccountGetResultsInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DatabaseAccountGetResultsInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DatabaseAccountGetResultsInner. + */ + public static DatabaseAccountGetResultsInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DatabaseAccountGetResultsInner deserializedDatabaseAccountGetResultsInner + = new DatabaseAccountGetResultsInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedDatabaseAccountGetResultsInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedDatabaseAccountGetResultsInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedDatabaseAccountGetResultsInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedDatabaseAccountGetResultsInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedDatabaseAccountGetResultsInner.withTags(tags); + } else if ("kind".equals(fieldName)) { + deserializedDatabaseAccountGetResultsInner.kind + = DatabaseAccountKind.fromString(reader.getString()); + } else if ("identity".equals(fieldName)) { + deserializedDatabaseAccountGetResultsInner.identity = ManagedServiceIdentity.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedDatabaseAccountGetResultsInner.innerProperties + = DatabaseAccountGetProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedDatabaseAccountGetResultsInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDatabaseAccountGetResultsInner; + }); + } +} 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..3e5fa1ce97f6b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountListConnectionStringsResultInner.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountConnectionString; +import java.io.IOException; +import java.util.List; + +/** + * The connection strings for the given database account. + */ +@Fluent +public final class DatabaseAccountListConnectionStringsResultInner + implements JsonSerializable { + /* + * An array that contains the connection strings for the Cosmos DB account. + */ + private List connectionStrings; + + /** + * Creates an instance of DatabaseAccountListConnectionStringsResultInner class. + */ + public DatabaseAccountListConnectionStringsResultInner() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("connectionStrings", this.connectionStrings, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DatabaseAccountListConnectionStringsResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DatabaseAccountListConnectionStringsResultInner if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DatabaseAccountListConnectionStringsResultInner. + */ + public static DatabaseAccountListConnectionStringsResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DatabaseAccountListConnectionStringsResultInner deserializedDatabaseAccountListConnectionStringsResultInner + = new DatabaseAccountListConnectionStringsResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("connectionStrings".equals(fieldName)) { + List connectionStrings + = reader.readArray(reader1 -> DatabaseAccountConnectionString.fromJson(reader1)); + deserializedDatabaseAccountListConnectionStringsResultInner.connectionStrings = connectionStrings; + } else { + reader.skipChildren(); + } + } + + return deserializedDatabaseAccountListConnectionStringsResultInner; + }); + } +} 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..f063a4b805e4e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountListKeysResultInner.java @@ -0,0 +1,132 @@ +// Copyright (c) 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The access keys for the given database account. + */ +@Immutable +public final class DatabaseAccountListKeysResultInner extends DatabaseAccountListReadOnlyKeysResultInner { + /* + * Base 64 encoded value of the primary read-write key. + */ + private String primaryMasterKey; + + /* + * Base 64 encoded value of the secondary read-write key. + */ + private String secondaryMasterKey; + + /* + * Base 64 encoded value of the secondary read-only key. + */ + private String secondaryReadonlyMasterKey; + + /* + * Base 64 encoded value of the primary read-only key. + */ + private String primaryReadonlyMasterKey; + + /** + * Creates an instance of DatabaseAccountListKeysResultInner class. + */ + public DatabaseAccountListKeysResultInner() { + } + + /** + * 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; + } + + /** + * Get the secondaryReadonlyMasterKey property: Base 64 encoded value of the secondary read-only key. + * + * @return the secondaryReadonlyMasterKey value. + */ + @Override + public String secondaryReadonlyMasterKey() { + return this.secondaryReadonlyMasterKey; + } + + /** + * Get the primaryReadonlyMasterKey property: Base 64 encoded value of the primary read-only key. + * + * @return the primaryReadonlyMasterKey value. + */ + @Override + public String primaryReadonlyMasterKey() { + return this.primaryReadonlyMasterKey; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DatabaseAccountListKeysResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DatabaseAccountListKeysResultInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DatabaseAccountListKeysResultInner. + */ + public static DatabaseAccountListKeysResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DatabaseAccountListKeysResultInner deserializedDatabaseAccountListKeysResultInner + = new DatabaseAccountListKeysResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("primaryReadonlyMasterKey".equals(fieldName)) { + deserializedDatabaseAccountListKeysResultInner.primaryReadonlyMasterKey = reader.getString(); + } else if ("secondaryReadonlyMasterKey".equals(fieldName)) { + deserializedDatabaseAccountListKeysResultInner.secondaryReadonlyMasterKey = reader.getString(); + } else if ("primaryMasterKey".equals(fieldName)) { + deserializedDatabaseAccountListKeysResultInner.primaryMasterKey = reader.getString(); + } else if ("secondaryMasterKey".equals(fieldName)) { + deserializedDatabaseAccountListKeysResultInner.secondaryMasterKey = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDatabaseAccountListKeysResultInner; + }); + } +} 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..2cdc870cf780f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountListReadOnlyKeysResultInner.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.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The read-only access keys for the given database account. + */ +@Immutable +public class DatabaseAccountListReadOnlyKeysResultInner + implements JsonSerializable { + /* + * Base 64 encoded value of the primary read-only key. + */ + private String primaryReadonlyMasterKey; + + /* + * Base 64 encoded value of the secondary read-only key. + */ + private String secondaryReadonlyMasterKey; + + /** + * Creates an instance of DatabaseAccountListReadOnlyKeysResultInner class. + */ + public DatabaseAccountListReadOnlyKeysResultInner() { + } + + /** + * Get the primaryReadonlyMasterKey property: Base 64 encoded value of the primary read-only key. + * + * @return the primaryReadonlyMasterKey value. + */ + public String primaryReadonlyMasterKey() { + return this.primaryReadonlyMasterKey; + } + + /** + * Set the primaryReadonlyMasterKey property: Base 64 encoded value of the primary read-only key. + * + * @param primaryReadonlyMasterKey the primaryReadonlyMasterKey value to set. + * @return the DatabaseAccountListReadOnlyKeysResultInner object itself. + */ + DatabaseAccountListReadOnlyKeysResultInner withPrimaryReadonlyMasterKey(String primaryReadonlyMasterKey) { + this.primaryReadonlyMasterKey = primaryReadonlyMasterKey; + return this; + } + + /** + * Get the secondaryReadonlyMasterKey property: Base 64 encoded value of the secondary read-only key. + * + * @return the secondaryReadonlyMasterKey value. + */ + public String secondaryReadonlyMasterKey() { + return this.secondaryReadonlyMasterKey; + } + + /** + * Set the secondaryReadonlyMasterKey property: Base 64 encoded value of the secondary read-only key. + * + * @param secondaryReadonlyMasterKey the secondaryReadonlyMasterKey value to set. + * @return the DatabaseAccountListReadOnlyKeysResultInner object itself. + */ + DatabaseAccountListReadOnlyKeysResultInner withSecondaryReadonlyMasterKey(String secondaryReadonlyMasterKey) { + this.secondaryReadonlyMasterKey = secondaryReadonlyMasterKey; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DatabaseAccountListReadOnlyKeysResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DatabaseAccountListReadOnlyKeysResultInner if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DatabaseAccountListReadOnlyKeysResultInner. + */ + public static DatabaseAccountListReadOnlyKeysResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DatabaseAccountListReadOnlyKeysResultInner deserializedDatabaseAccountListReadOnlyKeysResultInner + = new DatabaseAccountListReadOnlyKeysResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("primaryReadonlyMasterKey".equals(fieldName)) { + deserializedDatabaseAccountListReadOnlyKeysResultInner.primaryReadonlyMasterKey + = reader.getString(); + } else if ("secondaryReadonlyMasterKey".equals(fieldName)) { + deserializedDatabaseAccountListReadOnlyKeysResultInner.secondaryReadonlyMasterKey + = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDatabaseAccountListReadOnlyKeysResultInner; + }); + } +} 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..cb54c0bd2f52f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountUpdateProperties.java @@ -0,0 +1,1014 @@ +// Copyright (c) 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +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.Capacity; +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.DatabaseAccountKeysMetadata; +import com.azure.resourcemanager.cosmos.generated.models.IpAddressOrRange; +import com.azure.resourcemanager.cosmos.generated.models.Location; +import com.azure.resourcemanager.cosmos.generated.models.MinimalTlsVersion; +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 java.io.IOException; +import java.util.List; + +/** + * Properties to update Azure Cosmos DB database accounts. + */ +@Fluent +public final class DatabaseAccountUpdateProperties implements JsonSerializable { + /* + * The consistency policy for the Cosmos DB account. + */ + private ConsistencyPolicy consistencyPolicy; + + /* + * An array that contains the georeplication locations enabled for the Cosmos DB account. + */ + private List locations; + + /* + * List of IpRules. + */ + private List ipRules; + + /* + * Flag to indicate whether to enable/disable Virtual Network ACL rules. + */ + 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. + */ + private Boolean enableAutomaticFailover; + + /* + * List of Cosmos DB capabilities for the account + */ + private List capabilities; + + /* + * List of Virtual Network ACL rules configured for the Cosmos DB account. + */ + private List virtualNetworkRules; + + /* + * Enables the account to write in multiple locations + */ + private Boolean enableMultipleWriteLocations; + + /* + * Enables the cassandra connector on the Cosmos DB C* account + */ + private Boolean enableCassandraConnector; + + /* + * The cassandra connector offer type for the Cosmos DB database C* account. + */ + private ConnectorOffer connectorOffer; + + /* + * Disable write operations on metadata resources (databases, containers, throughput) via account keys + */ + private Boolean disableKeyBasedMetadataWriteAccess; + + /* + * The URI of the key vault + */ + 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. + */ + private String defaultIdentity; + + /* + * Whether requests from Public Network are allowed + */ + private PublicNetworkAccess publicNetworkAccess; + + /* + * Flag to indicate whether Free Tier is enabled. + */ + private Boolean enableFreeTier; + + /* + * API specific properties. Currently, supported only for MongoDB API. + */ + private ApiProperties apiProperties; + + /* + * Flag to indicate whether to enable storage analytics. + */ + private Boolean enableAnalyticalStorage; + + /* + * Analytical storage specific properties. + */ + private AnalyticalStorageConfiguration analyticalStorageConfiguration; + + /* + * The object representing the policy for taking backups on an account. + */ + private BackupPolicy backupPolicy; + + /* + * The CORS policy for the Cosmos DB database account. + */ + private List cors; + + /* + * Indicates what services are allowed to bypass firewall checks. + */ + private NetworkAclBypass networkAclBypass; + + /* + * An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account. + */ + private List networkAclBypassResourceIds; + + /* + * Opt-out of local authentication and ensure only MSI and AAD can be used exclusively for authentication. + */ + private Boolean disableLocalAuth; + + /* + * The object that represents all properties related to capacity enforcement on an account. + */ + private Capacity capacity; + + /* + * This property is ignored during the update operation, as the metadata is read-only. The object represents the + * metadata for the Account Keys of the Cosmos DB account. + */ + private DatabaseAccountKeysMetadata keysMetadata; + + /* + * Flag to indicate enabling/disabling of Partition Merge feature on the account + */ + private Boolean enablePartitionMerge; + + /* + * Indicates the minimum allowed Tls version. The default value is Tls 1.2. Cassandra and Mongo APIs only work with + * Tls 1.2. + */ + private MinimalTlsVersion minimalTlsVersion; + + /* + * Flag to indicate enabling/disabling of Burst Capacity feature on the account + */ + private Boolean enableBurstCapacity; + + /* + * Indicates the status of the Customer Managed Key feature on the account. In case there are errors, the property + * provides troubleshooting guidance. + */ + private String customerManagedKeyStatus; + + /* + * Flag to indicate enabling/disabling of PerRegionPerPartitionAutoscale feature on the account + */ + private Boolean enablePerRegionPerPartitionAutoscale; + + /** + * Creates an instance of DatabaseAccountUpdateProperties class. + */ + public DatabaseAccountUpdateProperties() { + } + + /** + * 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 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; + } + + /** + * Get the capacity property: The object that represents all properties related to capacity enforcement on an + * account. + * + * @return the capacity value. + */ + public Capacity capacity() { + return this.capacity; + } + + /** + * Set the capacity property: The object that represents all properties related to capacity enforcement on an + * account. + * + * @param capacity the capacity value to set. + * @return the DatabaseAccountUpdateProperties object itself. + */ + public DatabaseAccountUpdateProperties withCapacity(Capacity capacity) { + this.capacity = capacity; + return this; + } + + /** + * Get the keysMetadata property: This property is ignored during the update operation, as the metadata is + * read-only. The object represents the metadata for the Account Keys of the Cosmos DB account. + * + * @return the keysMetadata value. + */ + public DatabaseAccountKeysMetadata keysMetadata() { + return this.keysMetadata; + } + + /** + * Get the enablePartitionMerge property: Flag to indicate enabling/disabling of Partition Merge feature on the + * account. + * + * @return the enablePartitionMerge value. + */ + public Boolean enablePartitionMerge() { + return this.enablePartitionMerge; + } + + /** + * Set the enablePartitionMerge property: Flag to indicate enabling/disabling of Partition Merge feature on the + * account. + * + * @param enablePartitionMerge the enablePartitionMerge value to set. + * @return the DatabaseAccountUpdateProperties object itself. + */ + public DatabaseAccountUpdateProperties withEnablePartitionMerge(Boolean enablePartitionMerge) { + this.enablePartitionMerge = enablePartitionMerge; + return this; + } + + /** + * Get the minimalTlsVersion property: Indicates the minimum allowed Tls version. The default value is Tls 1.2. + * Cassandra and Mongo APIs only work with Tls 1.2. + * + * @return the minimalTlsVersion value. + */ + public MinimalTlsVersion minimalTlsVersion() { + return this.minimalTlsVersion; + } + + /** + * Set the minimalTlsVersion property: Indicates the minimum allowed Tls version. The default value is Tls 1.2. + * Cassandra and Mongo APIs only work with Tls 1.2. + * + * @param minimalTlsVersion the minimalTlsVersion value to set. + * @return the DatabaseAccountUpdateProperties object itself. + */ + public DatabaseAccountUpdateProperties withMinimalTlsVersion(MinimalTlsVersion minimalTlsVersion) { + this.minimalTlsVersion = minimalTlsVersion; + return this; + } + + /** + * Get the enableBurstCapacity property: Flag to indicate enabling/disabling of Burst Capacity feature on the + * account. + * + * @return the enableBurstCapacity value. + */ + public Boolean enableBurstCapacity() { + return this.enableBurstCapacity; + } + + /** + * Set the enableBurstCapacity property: Flag to indicate enabling/disabling of Burst Capacity feature on the + * account. + * + * @param enableBurstCapacity the enableBurstCapacity value to set. + * @return the DatabaseAccountUpdateProperties object itself. + */ + public DatabaseAccountUpdateProperties withEnableBurstCapacity(Boolean enableBurstCapacity) { + this.enableBurstCapacity = enableBurstCapacity; + return this; + } + + /** + * Get the customerManagedKeyStatus property: Indicates the status of the Customer Managed Key feature on the + * account. In case there are errors, the property provides troubleshooting guidance. + * + * @return the customerManagedKeyStatus value. + */ + public String customerManagedKeyStatus() { + return this.customerManagedKeyStatus; + } + + /** + * Set the customerManagedKeyStatus property: Indicates the status of the Customer Managed Key feature on the + * account. In case there are errors, the property provides troubleshooting guidance. + * + * @param customerManagedKeyStatus the customerManagedKeyStatus value to set. + * @return the DatabaseAccountUpdateProperties object itself. + */ + public DatabaseAccountUpdateProperties withCustomerManagedKeyStatus(String customerManagedKeyStatus) { + this.customerManagedKeyStatus = customerManagedKeyStatus; + return this; + } + + /** + * Get the enablePerRegionPerPartitionAutoscale property: Flag to indicate enabling/disabling of + * PerRegionPerPartitionAutoscale feature on the account. + * + * @return the enablePerRegionPerPartitionAutoscale value. + */ + public Boolean enablePerRegionPerPartitionAutoscale() { + return this.enablePerRegionPerPartitionAutoscale; + } + + /** + * Set the enablePerRegionPerPartitionAutoscale property: Flag to indicate enabling/disabling of + * PerRegionPerPartitionAutoscale feature on the account. + * + * @param enablePerRegionPerPartitionAutoscale the enablePerRegionPerPartitionAutoscale value to set. + * @return the DatabaseAccountUpdateProperties object itself. + */ + public DatabaseAccountUpdateProperties + withEnablePerRegionPerPartitionAutoscale(Boolean enablePerRegionPerPartitionAutoscale) { + this.enablePerRegionPerPartitionAutoscale = enablePerRegionPerPartitionAutoscale; + 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 (capacity() != null) { + capacity().validate(); + } + if (keysMetadata() != null) { + keysMetadata().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("consistencyPolicy", this.consistencyPolicy); + jsonWriter.writeArrayField("locations", this.locations, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("ipRules", this.ipRules, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeBooleanField("isVirtualNetworkFilterEnabled", this.isVirtualNetworkFilterEnabled); + jsonWriter.writeBooleanField("enableAutomaticFailover", this.enableAutomaticFailover); + jsonWriter.writeArrayField("capabilities", this.capabilities, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("virtualNetworkRules", this.virtualNetworkRules, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeBooleanField("enableMultipleWriteLocations", this.enableMultipleWriteLocations); + jsonWriter.writeBooleanField("enableCassandraConnector", this.enableCassandraConnector); + jsonWriter.writeStringField("connectorOffer", + this.connectorOffer == null ? null : this.connectorOffer.toString()); + jsonWriter.writeBooleanField("disableKeyBasedMetadataWriteAccess", this.disableKeyBasedMetadataWriteAccess); + jsonWriter.writeStringField("keyVaultKeyUri", this.keyVaultKeyUri); + jsonWriter.writeStringField("defaultIdentity", this.defaultIdentity); + jsonWriter.writeStringField("publicNetworkAccess", + this.publicNetworkAccess == null ? null : this.publicNetworkAccess.toString()); + jsonWriter.writeBooleanField("enableFreeTier", this.enableFreeTier); + jsonWriter.writeJsonField("apiProperties", this.apiProperties); + jsonWriter.writeBooleanField("enableAnalyticalStorage", this.enableAnalyticalStorage); + jsonWriter.writeJsonField("analyticalStorageConfiguration", this.analyticalStorageConfiguration); + jsonWriter.writeJsonField("backupPolicy", this.backupPolicy); + jsonWriter.writeArrayField("cors", this.cors, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("networkAclBypass", + this.networkAclBypass == null ? null : this.networkAclBypass.toString()); + jsonWriter.writeArrayField("networkAclBypassResourceIds", this.networkAclBypassResourceIds, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeBooleanField("disableLocalAuth", this.disableLocalAuth); + jsonWriter.writeJsonField("capacity", this.capacity); + jsonWriter.writeBooleanField("enablePartitionMerge", this.enablePartitionMerge); + jsonWriter.writeStringField("minimalTlsVersion", + this.minimalTlsVersion == null ? null : this.minimalTlsVersion.toString()); + jsonWriter.writeBooleanField("enableBurstCapacity", this.enableBurstCapacity); + jsonWriter.writeStringField("customerManagedKeyStatus", this.customerManagedKeyStatus); + jsonWriter.writeBooleanField("enablePerRegionPerPartitionAutoscale", this.enablePerRegionPerPartitionAutoscale); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DatabaseAccountUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DatabaseAccountUpdateProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DatabaseAccountUpdateProperties. + */ + public static DatabaseAccountUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DatabaseAccountUpdateProperties deserializedDatabaseAccountUpdateProperties + = new DatabaseAccountUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("consistencyPolicy".equals(fieldName)) { + deserializedDatabaseAccountUpdateProperties.consistencyPolicy = ConsistencyPolicy.fromJson(reader); + } else if ("locations".equals(fieldName)) { + List locations = reader.readArray(reader1 -> Location.fromJson(reader1)); + deserializedDatabaseAccountUpdateProperties.locations = locations; + } else if ("ipRules".equals(fieldName)) { + List ipRules = reader.readArray(reader1 -> IpAddressOrRange.fromJson(reader1)); + deserializedDatabaseAccountUpdateProperties.ipRules = ipRules; + } else if ("isVirtualNetworkFilterEnabled".equals(fieldName)) { + deserializedDatabaseAccountUpdateProperties.isVirtualNetworkFilterEnabled + = reader.getNullable(JsonReader::getBoolean); + } else if ("enableAutomaticFailover".equals(fieldName)) { + deserializedDatabaseAccountUpdateProperties.enableAutomaticFailover + = reader.getNullable(JsonReader::getBoolean); + } else if ("capabilities".equals(fieldName)) { + List capabilities = reader.readArray(reader1 -> Capability.fromJson(reader1)); + deserializedDatabaseAccountUpdateProperties.capabilities = capabilities; + } else if ("virtualNetworkRules".equals(fieldName)) { + List virtualNetworkRules + = reader.readArray(reader1 -> VirtualNetworkRule.fromJson(reader1)); + deserializedDatabaseAccountUpdateProperties.virtualNetworkRules = virtualNetworkRules; + } else if ("enableMultipleWriteLocations".equals(fieldName)) { + deserializedDatabaseAccountUpdateProperties.enableMultipleWriteLocations + = reader.getNullable(JsonReader::getBoolean); + } else if ("enableCassandraConnector".equals(fieldName)) { + deserializedDatabaseAccountUpdateProperties.enableCassandraConnector + = reader.getNullable(JsonReader::getBoolean); + } else if ("connectorOffer".equals(fieldName)) { + deserializedDatabaseAccountUpdateProperties.connectorOffer + = ConnectorOffer.fromString(reader.getString()); + } else if ("disableKeyBasedMetadataWriteAccess".equals(fieldName)) { + deserializedDatabaseAccountUpdateProperties.disableKeyBasedMetadataWriteAccess + = reader.getNullable(JsonReader::getBoolean); + } else if ("keyVaultKeyUri".equals(fieldName)) { + deserializedDatabaseAccountUpdateProperties.keyVaultKeyUri = reader.getString(); + } else if ("defaultIdentity".equals(fieldName)) { + deserializedDatabaseAccountUpdateProperties.defaultIdentity = reader.getString(); + } else if ("publicNetworkAccess".equals(fieldName)) { + deserializedDatabaseAccountUpdateProperties.publicNetworkAccess + = PublicNetworkAccess.fromString(reader.getString()); + } else if ("enableFreeTier".equals(fieldName)) { + deserializedDatabaseAccountUpdateProperties.enableFreeTier + = reader.getNullable(JsonReader::getBoolean); + } else if ("apiProperties".equals(fieldName)) { + deserializedDatabaseAccountUpdateProperties.apiProperties = ApiProperties.fromJson(reader); + } else if ("enableAnalyticalStorage".equals(fieldName)) { + deserializedDatabaseAccountUpdateProperties.enableAnalyticalStorage + = reader.getNullable(JsonReader::getBoolean); + } else if ("analyticalStorageConfiguration".equals(fieldName)) { + deserializedDatabaseAccountUpdateProperties.analyticalStorageConfiguration + = AnalyticalStorageConfiguration.fromJson(reader); + } else if ("backupPolicy".equals(fieldName)) { + deserializedDatabaseAccountUpdateProperties.backupPolicy = BackupPolicy.fromJson(reader); + } else if ("cors".equals(fieldName)) { + List cors = reader.readArray(reader1 -> CorsPolicy.fromJson(reader1)); + deserializedDatabaseAccountUpdateProperties.cors = cors; + } else if ("networkAclBypass".equals(fieldName)) { + deserializedDatabaseAccountUpdateProperties.networkAclBypass + = NetworkAclBypass.fromString(reader.getString()); + } else if ("networkAclBypassResourceIds".equals(fieldName)) { + List networkAclBypassResourceIds = reader.readArray(reader1 -> reader1.getString()); + deserializedDatabaseAccountUpdateProperties.networkAclBypassResourceIds + = networkAclBypassResourceIds; + } else if ("disableLocalAuth".equals(fieldName)) { + deserializedDatabaseAccountUpdateProperties.disableLocalAuth + = reader.getNullable(JsonReader::getBoolean); + } else if ("capacity".equals(fieldName)) { + deserializedDatabaseAccountUpdateProperties.capacity = Capacity.fromJson(reader); + } else if ("keysMetadata".equals(fieldName)) { + deserializedDatabaseAccountUpdateProperties.keysMetadata + = DatabaseAccountKeysMetadata.fromJson(reader); + } else if ("enablePartitionMerge".equals(fieldName)) { + deserializedDatabaseAccountUpdateProperties.enablePartitionMerge + = reader.getNullable(JsonReader::getBoolean); + } else if ("minimalTlsVersion".equals(fieldName)) { + deserializedDatabaseAccountUpdateProperties.minimalTlsVersion + = MinimalTlsVersion.fromString(reader.getString()); + } else if ("enableBurstCapacity".equals(fieldName)) { + deserializedDatabaseAccountUpdateProperties.enableBurstCapacity + = reader.getNullable(JsonReader::getBoolean); + } else if ("customerManagedKeyStatus".equals(fieldName)) { + deserializedDatabaseAccountUpdateProperties.customerManagedKeyStatus = reader.getString(); + } else if ("enablePerRegionPerPartitionAutoscale".equals(fieldName)) { + deserializedDatabaseAccountUpdateProperties.enablePerRegionPerPartitionAutoscale + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedDatabaseAccountUpdateProperties; + }); + } +} 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..6a1fc6adbc4d1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/GremlinDatabaseCreateUpdateProperties.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.GremlinDatabaseResource; +import java.io.IOException; + +/** + * Properties to create and update Azure Cosmos DB Gremlin database. + */ +@Fluent +public final class GremlinDatabaseCreateUpdateProperties + implements JsonSerializable { + /* + * The standard JSON format of a Gremlin database + */ + private GremlinDatabaseResource resource; + + /* + * A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + */ + private CreateUpdateOptions options; + + /** + * Creates an instance of GremlinDatabaseCreateUpdateProperties class. + */ + public GremlinDatabaseCreateUpdateProperties() { + } + + /** + * 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.atError() + .log(new IllegalArgumentException( + "Missing required property resource in model GremlinDatabaseCreateUpdateProperties")); + } else { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(GremlinDatabaseCreateUpdateProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("resource", this.resource); + jsonWriter.writeJsonField("options", this.options); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GremlinDatabaseCreateUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GremlinDatabaseCreateUpdateProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GremlinDatabaseCreateUpdateProperties. + */ + public static GremlinDatabaseCreateUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GremlinDatabaseCreateUpdateProperties deserializedGremlinDatabaseCreateUpdateProperties + = new GremlinDatabaseCreateUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resource".equals(fieldName)) { + deserializedGremlinDatabaseCreateUpdateProperties.resource + = GremlinDatabaseResource.fromJson(reader); + } else if ("options".equals(fieldName)) { + deserializedGremlinDatabaseCreateUpdateProperties.options = CreateUpdateOptions.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedGremlinDatabaseCreateUpdateProperties; + }); + } +} 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..f0a89d79c7551 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/GremlinDatabaseGetProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.GremlinDatabaseGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.GremlinDatabaseGetPropertiesResource; +import java.io.IOException; + +/** + * The properties of an Azure Cosmos DB SQL database. + */ +@Fluent +public final class GremlinDatabaseGetProperties implements JsonSerializable { + /* + * The resource property. + */ + private GremlinDatabaseGetPropertiesResource resource; + + /* + * The options property. + */ + private GremlinDatabaseGetPropertiesOptions options; + + /** + * Creates an instance of GremlinDatabaseGetProperties class. + */ + public GremlinDatabaseGetProperties() { + } + + /** + * 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("resource", this.resource); + jsonWriter.writeJsonField("options", this.options); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GremlinDatabaseGetProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GremlinDatabaseGetProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the GremlinDatabaseGetProperties. + */ + public static GremlinDatabaseGetProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GremlinDatabaseGetProperties deserializedGremlinDatabaseGetProperties = new GremlinDatabaseGetProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resource".equals(fieldName)) { + deserializedGremlinDatabaseGetProperties.resource + = GremlinDatabaseGetPropertiesResource.fromJson(reader); + } else if ("options".equals(fieldName)) { + deserializedGremlinDatabaseGetProperties.options + = GremlinDatabaseGetPropertiesOptions.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedGremlinDatabaseGetProperties; + }); + } +} 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..a058b0700a8e5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/GremlinDatabaseGetResultsInner.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +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 java.io.IOException; +import java.util.Map; + +/** + * An Azure Cosmos DB Gremlin database. + */ +@Fluent +public final class GremlinDatabaseGetResultsInner extends ArmResourceProperties { + /* + * The properties of an Azure Cosmos DB SQL database + */ + private GremlinDatabaseGetProperties innerProperties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of GremlinDatabaseGetResultsInner class. + */ + public GremlinDatabaseGetResultsInner() { + } + + /** + * Get the innerProperties property: The properties of an Azure Cosmos DB SQL database. + * + * @return the innerProperties value. + */ + private GremlinDatabaseGetProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@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() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GremlinDatabaseGetResultsInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GremlinDatabaseGetResultsInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GremlinDatabaseGetResultsInner. + */ + public static GremlinDatabaseGetResultsInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GremlinDatabaseGetResultsInner deserializedGremlinDatabaseGetResultsInner + = new GremlinDatabaseGetResultsInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedGremlinDatabaseGetResultsInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedGremlinDatabaseGetResultsInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedGremlinDatabaseGetResultsInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedGremlinDatabaseGetResultsInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedGremlinDatabaseGetResultsInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedGremlinDatabaseGetResultsInner.innerProperties + = GremlinDatabaseGetProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedGremlinDatabaseGetResultsInner; + }); + } +} 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..e94192b02a0ac --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/GremlinGraphCreateUpdateProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.GremlinGraphResource; +import java.io.IOException; + +/** + * Properties to create and update Azure Cosmos DB Gremlin graph. + */ +@Fluent +public final class GremlinGraphCreateUpdateProperties implements JsonSerializable { + /* + * The standard JSON format of a Gremlin graph + */ + private GremlinGraphResource resource; + + /* + * A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + */ + private CreateUpdateOptions options; + + /** + * Creates an instance of GremlinGraphCreateUpdateProperties class. + */ + public GremlinGraphCreateUpdateProperties() { + } + + /** + * 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.atError() + .log(new IllegalArgumentException( + "Missing required property resource in model GremlinGraphCreateUpdateProperties")); + } else { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(GremlinGraphCreateUpdateProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("resource", this.resource); + jsonWriter.writeJsonField("options", this.options); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GremlinGraphCreateUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GremlinGraphCreateUpdateProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GremlinGraphCreateUpdateProperties. + */ + public static GremlinGraphCreateUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GremlinGraphCreateUpdateProperties deserializedGremlinGraphCreateUpdateProperties + = new GremlinGraphCreateUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resource".equals(fieldName)) { + deserializedGremlinGraphCreateUpdateProperties.resource = GremlinGraphResource.fromJson(reader); + } else if ("options".equals(fieldName)) { + deserializedGremlinGraphCreateUpdateProperties.options = CreateUpdateOptions.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedGremlinGraphCreateUpdateProperties; + }); + } +} 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..4e53ea651af76 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/GremlinGraphGetProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.GremlinGraphGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.GremlinGraphGetPropertiesResource; +import java.io.IOException; + +/** + * The properties of an Azure Cosmos DB Gremlin graph. + */ +@Fluent +public final class GremlinGraphGetProperties implements JsonSerializable { + /* + * The resource property. + */ + private GremlinGraphGetPropertiesResource resource; + + /* + * The options property. + */ + private GremlinGraphGetPropertiesOptions options; + + /** + * Creates an instance of GremlinGraphGetProperties class. + */ + public GremlinGraphGetProperties() { + } + + /** + * 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("resource", this.resource); + jsonWriter.writeJsonField("options", this.options); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GremlinGraphGetProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GremlinGraphGetProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the GremlinGraphGetProperties. + */ + public static GremlinGraphGetProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GremlinGraphGetProperties deserializedGremlinGraphGetProperties = new GremlinGraphGetProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resource".equals(fieldName)) { + deserializedGremlinGraphGetProperties.resource = GremlinGraphGetPropertiesResource.fromJson(reader); + } else if ("options".equals(fieldName)) { + deserializedGremlinGraphGetProperties.options = GremlinGraphGetPropertiesOptions.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedGremlinGraphGetProperties; + }); + } +} 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..c6dbfec1a29d5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/GremlinGraphGetResultsInner.java @@ -0,0 +1,213 @@ +// Copyright (c) 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +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 java.io.IOException; +import java.util.Map; + +/** + * An Azure Cosmos DB Gremlin graph. + */ +@Fluent +public final class GremlinGraphGetResultsInner extends ArmResourceProperties { + /* + * The properties of an Azure Cosmos DB Gremlin graph + */ + private GremlinGraphGetProperties innerProperties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of GremlinGraphGetResultsInner class. + */ + public GremlinGraphGetResultsInner() { + } + + /** + * Get the innerProperties property: The properties of an Azure Cosmos DB Gremlin graph. + * + * @return the innerProperties value. + */ + private GremlinGraphGetProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@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() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GremlinGraphGetResultsInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GremlinGraphGetResultsInner if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GremlinGraphGetResultsInner. + */ + public static GremlinGraphGetResultsInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GremlinGraphGetResultsInner deserializedGremlinGraphGetResultsInner = new GremlinGraphGetResultsInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedGremlinGraphGetResultsInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedGremlinGraphGetResultsInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedGremlinGraphGetResultsInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedGremlinGraphGetResultsInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedGremlinGraphGetResultsInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedGremlinGraphGetResultsInner.innerProperties + = GremlinGraphGetProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedGremlinGraphGetResultsInner; + }); + } +} 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..1e7e61b7424d0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/LocationGetResultInner.java @@ -0,0 +1,150 @@ +// Copyright (c) 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.ArmProxyResource; +import com.azure.resourcemanager.cosmos.generated.models.LocationProperties; +import java.io.IOException; + +/** + * Cosmos DB location get result. + */ +@Fluent +public final class LocationGetResultInner extends ArmProxyResource { + /* + * Cosmos DB location metadata + */ + private LocationProperties properties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of LocationGetResultInner class. + */ + public LocationGetResultInner() { + } + + /** + * 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; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LocationGetResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LocationGetResultInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the LocationGetResultInner. + */ + public static LocationGetResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LocationGetResultInner deserializedLocationGetResultInner = new LocationGetResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedLocationGetResultInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedLocationGetResultInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedLocationGetResultInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedLocationGetResultInner.properties = LocationProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedLocationGetResultInner; + }); + } +} 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..d92d86ab90f21 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MetricDefinitionInner.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.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +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 java.io.IOException; +import java.util.List; + +/** + * The definition of a metric. + */ +@Immutable +public final class MetricDefinitionInner implements JsonSerializable { + /* + * The list of metric availabilities for the account. + */ + private List metricAvailabilities; + + /* + * The primary aggregation type of the metric. + */ + private PrimaryAggregationType primaryAggregationType; + + /* + * The unit of the metric. + */ + private UnitType unit; + + /* + * The resource uri of the database. + */ + private String resourceUri; + + /* + * The name information for the metric. + */ + private MetricName name; + + /** + * Creates an instance of MetricDefinitionInner class. + */ + public MetricDefinitionInner() { + } + + /** + * 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MetricDefinitionInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MetricDefinitionInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the MetricDefinitionInner. + */ + public static MetricDefinitionInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MetricDefinitionInner deserializedMetricDefinitionInner = new MetricDefinitionInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("metricAvailabilities".equals(fieldName)) { + List metricAvailabilities + = reader.readArray(reader1 -> MetricAvailability.fromJson(reader1)); + deserializedMetricDefinitionInner.metricAvailabilities = metricAvailabilities; + } else if ("primaryAggregationType".equals(fieldName)) { + deserializedMetricDefinitionInner.primaryAggregationType + = PrimaryAggregationType.fromString(reader.getString()); + } else if ("unit".equals(fieldName)) { + deserializedMetricDefinitionInner.unit = UnitType.fromString(reader.getString()); + } else if ("resourceUri".equals(fieldName)) { + deserializedMetricDefinitionInner.resourceUri = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedMetricDefinitionInner.name = MetricName.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMetricDefinitionInner; + }); + } +} 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..0e7eb2854b5a3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MetricInner.java @@ -0,0 +1,242 @@ +// Copyright (c) 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.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +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.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; + +/** + * Metric data. + */ +@Immutable +public class MetricInner implements JsonSerializable { + /* + * The start time for the metric (ISO-8601 format). + */ + private OffsetDateTime startTime; + + /* + * The end time for the metric (ISO-8601 format). + */ + private OffsetDateTime endTime; + + /* + * The time grain to be used to summarize the metric values. + */ + private String timeGrain; + + /* + * The unit of the metric. + */ + private UnitType unit; + + /* + * The name information for the metric. + */ + private MetricName name; + + /* + * The metric values for the specified time window and timestep. + */ + private List metricValues; + + /** + * Creates an instance of MetricInner class. + */ + public MetricInner() { + } + + /** + * Get the startTime property: The start time for the metric (ISO-8601 format). + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime property: The start time for the metric (ISO-8601 format). + * + * @param startTime the startTime value to set. + * @return the MetricInner object itself. + */ + MetricInner withStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the endTime property: The end time for the metric (ISO-8601 format). + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Set the endTime property: The end time for the metric (ISO-8601 format). + * + * @param endTime the endTime value to set. + * @return the MetricInner object itself. + */ + MetricInner withEndTime(OffsetDateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * 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; + } + + /** + * Set the timeGrain property: The time grain to be used to summarize the metric values. + * + * @param timeGrain the timeGrain value to set. + * @return the MetricInner object itself. + */ + MetricInner withTimeGrain(String timeGrain) { + this.timeGrain = timeGrain; + return this; + } + + /** + * Get the unit property: The unit of the metric. + * + * @return the unit value. + */ + public UnitType unit() { + return this.unit; + } + + /** + * Set the unit property: The unit of the metric. + * + * @param unit the unit value to set. + * @return the MetricInner object itself. + */ + MetricInner withUnit(UnitType unit) { + this.unit = unit; + return this; + } + + /** + * Get the name property: The name information for the metric. + * + * @return the name value. + */ + public MetricName name() { + return this.name; + } + + /** + * Set the name property: The name information for the metric. + * + * @param name the name value to set. + * @return the MetricInner object itself. + */ + MetricInner withName(MetricName name) { + this.name = name; + return this; + } + + /** + * Get the metricValues property: The metric values for the specified time window and timestep. + * + * @return the metricValues value. + */ + public List metricValues() { + return this.metricValues; + } + + /** + * Set the metricValues property: The metric values for the specified time window and timestep. + * + * @param metricValues the metricValues value to set. + * @return the MetricInner object itself. + */ + MetricInner withMetricValues(List metricValues) { + this.metricValues = metricValues; + return this; + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MetricInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MetricInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the MetricInner. + */ + public static MetricInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MetricInner deserializedMetricInner = new MetricInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("startTime".equals(fieldName)) { + deserializedMetricInner.startTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("endTime".equals(fieldName)) { + deserializedMetricInner.endTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("timeGrain".equals(fieldName)) { + deserializedMetricInner.timeGrain = reader.getString(); + } else if ("unit".equals(fieldName)) { + deserializedMetricInner.unit = UnitType.fromString(reader.getString()); + } else if ("name".equals(fieldName)) { + deserializedMetricInner.name = MetricName.fromJson(reader); + } else if ("metricValues".equals(fieldName)) { + List metricValues = reader.readArray(reader1 -> MetricValue.fromJson(reader1)); + deserializedMetricInner.metricValues = metricValues; + } else { + reader.skipChildren(); + } + } + + return deserializedMetricInner; + }); + } +} 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..70d555f001bad --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoDBCollectionCreateUpdateProperties.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBCollectionResource; +import java.io.IOException; + +/** + * Properties to create and update Azure Cosmos DB MongoDB collection. + */ +@Fluent +public final class MongoDBCollectionCreateUpdateProperties + implements JsonSerializable { + /* + * The standard JSON format of a MongoDB collection + */ + private MongoDBCollectionResource resource; + + /* + * A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + */ + private CreateUpdateOptions options; + + /** + * Creates an instance of MongoDBCollectionCreateUpdateProperties class. + */ + public MongoDBCollectionCreateUpdateProperties() { + } + + /** + * 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.atError() + .log(new IllegalArgumentException( + "Missing required property resource in model MongoDBCollectionCreateUpdateProperties")); + } else { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MongoDBCollectionCreateUpdateProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("resource", this.resource); + jsonWriter.writeJsonField("options", this.options); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MongoDBCollectionCreateUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MongoDBCollectionCreateUpdateProperties if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MongoDBCollectionCreateUpdateProperties. + */ + public static MongoDBCollectionCreateUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MongoDBCollectionCreateUpdateProperties deserializedMongoDBCollectionCreateUpdateProperties + = new MongoDBCollectionCreateUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resource".equals(fieldName)) { + deserializedMongoDBCollectionCreateUpdateProperties.resource + = MongoDBCollectionResource.fromJson(reader); + } else if ("options".equals(fieldName)) { + deserializedMongoDBCollectionCreateUpdateProperties.options = CreateUpdateOptions.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMongoDBCollectionCreateUpdateProperties; + }); + } +} 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..d1b95bbb8c177 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoDBCollectionGetProperties.java @@ -0,0 +1,132 @@ +// Copyright (c) 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBCollectionGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBCollectionGetPropertiesResource; +import java.io.IOException; + +/** + * The properties of an Azure Cosmos DB MongoDB collection. + */ +@Fluent +public final class MongoDBCollectionGetProperties implements JsonSerializable { + /* + * The resource property. + */ + private MongoDBCollectionGetPropertiesResource resource; + + /* + * The options property. + */ + private MongoDBCollectionGetPropertiesOptions options; + + /** + * Creates an instance of MongoDBCollectionGetProperties class. + */ + public MongoDBCollectionGetProperties() { + } + + /** + * 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("resource", this.resource); + jsonWriter.writeJsonField("options", this.options); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MongoDBCollectionGetProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MongoDBCollectionGetProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the MongoDBCollectionGetProperties. + */ + public static MongoDBCollectionGetProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MongoDBCollectionGetProperties deserializedMongoDBCollectionGetProperties + = new MongoDBCollectionGetProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resource".equals(fieldName)) { + deserializedMongoDBCollectionGetProperties.resource + = MongoDBCollectionGetPropertiesResource.fromJson(reader); + } else if ("options".equals(fieldName)) { + deserializedMongoDBCollectionGetProperties.options + = MongoDBCollectionGetPropertiesOptions.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMongoDBCollectionGetProperties; + }); + } +} 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..431e99ed0632f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoDBCollectionGetResultsInner.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBCollectionGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBCollectionGetPropertiesResource; +import java.io.IOException; +import java.util.Map; + +/** + * An Azure Cosmos DB MongoDB collection. + */ +@Fluent +public final class MongoDBCollectionGetResultsInner extends ArmResourceProperties { + /* + * The properties of an Azure Cosmos DB MongoDB collection + */ + private MongoDBCollectionGetProperties innerProperties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of MongoDBCollectionGetResultsInner class. + */ + public MongoDBCollectionGetResultsInner() { + } + + /** + * Get the innerProperties property: The properties of an Azure Cosmos DB MongoDB collection. + * + * @return the innerProperties value. + */ + private MongoDBCollectionGetProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@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() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MongoDBCollectionGetResultsInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MongoDBCollectionGetResultsInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MongoDBCollectionGetResultsInner. + */ + public static MongoDBCollectionGetResultsInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MongoDBCollectionGetResultsInner deserializedMongoDBCollectionGetResultsInner + = new MongoDBCollectionGetResultsInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedMongoDBCollectionGetResultsInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedMongoDBCollectionGetResultsInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedMongoDBCollectionGetResultsInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedMongoDBCollectionGetResultsInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedMongoDBCollectionGetResultsInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedMongoDBCollectionGetResultsInner.innerProperties + = MongoDBCollectionGetProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMongoDBCollectionGetResultsInner; + }); + } +} 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..778d0ff53bd83 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoDBDatabaseCreateUpdateProperties.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBDatabaseResource; +import java.io.IOException; + +/** + * Properties to create and update Azure Cosmos DB MongoDB database. + */ +@Fluent +public final class MongoDBDatabaseCreateUpdateProperties + implements JsonSerializable { + /* + * The standard JSON format of a MongoDB database + */ + private MongoDBDatabaseResource resource; + + /* + * A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + */ + private CreateUpdateOptions options; + + /** + * Creates an instance of MongoDBDatabaseCreateUpdateProperties class. + */ + public MongoDBDatabaseCreateUpdateProperties() { + } + + /** + * 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.atError() + .log(new IllegalArgumentException( + "Missing required property resource in model MongoDBDatabaseCreateUpdateProperties")); + } else { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MongoDBDatabaseCreateUpdateProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("resource", this.resource); + jsonWriter.writeJsonField("options", this.options); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MongoDBDatabaseCreateUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MongoDBDatabaseCreateUpdateProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MongoDBDatabaseCreateUpdateProperties. + */ + public static MongoDBDatabaseCreateUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MongoDBDatabaseCreateUpdateProperties deserializedMongoDBDatabaseCreateUpdateProperties + = new MongoDBDatabaseCreateUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resource".equals(fieldName)) { + deserializedMongoDBDatabaseCreateUpdateProperties.resource + = MongoDBDatabaseResource.fromJson(reader); + } else if ("options".equals(fieldName)) { + deserializedMongoDBDatabaseCreateUpdateProperties.options = CreateUpdateOptions.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMongoDBDatabaseCreateUpdateProperties; + }); + } +} 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..47c70f8cb1822 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoDBDatabaseGetProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBDatabaseGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBDatabaseGetPropertiesResource; +import java.io.IOException; + +/** + * The properties of an Azure Cosmos DB MongoDB database. + */ +@Fluent +public final class MongoDBDatabaseGetProperties implements JsonSerializable { + /* + * The resource property. + */ + private MongoDBDatabaseGetPropertiesResource resource; + + /* + * The options property. + */ + private MongoDBDatabaseGetPropertiesOptions options; + + /** + * Creates an instance of MongoDBDatabaseGetProperties class. + */ + public MongoDBDatabaseGetProperties() { + } + + /** + * 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("resource", this.resource); + jsonWriter.writeJsonField("options", this.options); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MongoDBDatabaseGetProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MongoDBDatabaseGetProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the MongoDBDatabaseGetProperties. + */ + public static MongoDBDatabaseGetProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MongoDBDatabaseGetProperties deserializedMongoDBDatabaseGetProperties = new MongoDBDatabaseGetProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resource".equals(fieldName)) { + deserializedMongoDBDatabaseGetProperties.resource + = MongoDBDatabaseGetPropertiesResource.fromJson(reader); + } else if ("options".equals(fieldName)) { + deserializedMongoDBDatabaseGetProperties.options + = MongoDBDatabaseGetPropertiesOptions.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMongoDBDatabaseGetProperties; + }); + } +} 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..7276afa8c361e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoDBDatabaseGetResultsInner.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBDatabaseGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBDatabaseGetPropertiesResource; +import java.io.IOException; +import java.util.Map; + +/** + * An Azure Cosmos DB MongoDB database. + */ +@Fluent +public final class MongoDBDatabaseGetResultsInner extends ArmResourceProperties { + /* + * The properties of an Azure Cosmos DB MongoDB database + */ + private MongoDBDatabaseGetProperties innerProperties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of MongoDBDatabaseGetResultsInner class. + */ + public MongoDBDatabaseGetResultsInner() { + } + + /** + * Get the innerProperties property: The properties of an Azure Cosmos DB MongoDB database. + * + * @return the innerProperties value. + */ + private MongoDBDatabaseGetProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@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() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MongoDBDatabaseGetResultsInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MongoDBDatabaseGetResultsInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MongoDBDatabaseGetResultsInner. + */ + public static MongoDBDatabaseGetResultsInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MongoDBDatabaseGetResultsInner deserializedMongoDBDatabaseGetResultsInner + = new MongoDBDatabaseGetResultsInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedMongoDBDatabaseGetResultsInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedMongoDBDatabaseGetResultsInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedMongoDBDatabaseGetResultsInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedMongoDBDatabaseGetResultsInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedMongoDBDatabaseGetResultsInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedMongoDBDatabaseGetResultsInner.innerProperties + = MongoDBDatabaseGetProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMongoDBDatabaseGetResultsInner; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoRoleDefinitionGetResultsInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoRoleDefinitionGetResultsInner.java new file mode 100644 index 0000000000000..3af9981024c96 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoRoleDefinitionGetResultsInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.ArmProxyResource; +import com.azure.resourcemanager.cosmos.generated.models.MongoRoleDefinitionType; +import com.azure.resourcemanager.cosmos.generated.models.Privilege; +import com.azure.resourcemanager.cosmos.generated.models.Role; +import java.io.IOException; +import java.util.List; + +/** + * An Azure Cosmos DB Mongo Role Definition. + */ +@Fluent +public final class MongoRoleDefinitionGetResultsInner extends ArmProxyResource { + /* + * Properties related to the Mongo Role Definition. + */ + private MongoRoleDefinitionResource innerProperties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of MongoRoleDefinitionGetResultsInner class. + */ + public MongoRoleDefinitionGetResultsInner() { + } + + /** + * Get the innerProperties property: Properties related to the Mongo Role Definition. + * + * @return the innerProperties value. + */ + private MongoRoleDefinitionResource innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * 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 MongoRoleDefinitionGetResultsInner object itself. + */ + public MongoRoleDefinitionGetResultsInner withRoleName(String roleName) { + if (this.innerProperties() == null) { + this.innerProperties = new MongoRoleDefinitionResource(); + } + 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 MongoRoleDefinitionType 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 MongoRoleDefinitionGetResultsInner object itself. + */ + public MongoRoleDefinitionGetResultsInner withTypePropertiesType(MongoRoleDefinitionType type) { + if (this.innerProperties() == null) { + this.innerProperties = new MongoRoleDefinitionResource(); + } + this.innerProperties().withType(type); + return this; + } + + /** + * Get the databaseName property: The database name for which access is being granted for this Role Definition. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.innerProperties() == null ? null : this.innerProperties().databaseName(); + } + + /** + * Set the databaseName property: The database name for which access is being granted for this Role Definition. + * + * @param databaseName the databaseName value to set. + * @return the MongoRoleDefinitionGetResultsInner object itself. + */ + public MongoRoleDefinitionGetResultsInner withDatabaseName(String databaseName) { + if (this.innerProperties() == null) { + this.innerProperties = new MongoRoleDefinitionResource(); + } + this.innerProperties().withDatabaseName(databaseName); + return this; + } + + /** + * Get the privileges property: A set of privileges contained by the Role Definition. This will allow application of + * this Role Definition on the entire database account or any underlying Database / Collection. Scopes higher than + * Database are not enforceable as privilege. + * + * @return the privileges value. + */ + public List privileges() { + return this.innerProperties() == null ? null : this.innerProperties().privileges(); + } + + /** + * Set the privileges property: A set of privileges contained by the Role Definition. This will allow application of + * this Role Definition on the entire database account or any underlying Database / Collection. Scopes higher than + * Database are not enforceable as privilege. + * + * @param privileges the privileges value to set. + * @return the MongoRoleDefinitionGetResultsInner object itself. + */ + public MongoRoleDefinitionGetResultsInner withPrivileges(List privileges) { + if (this.innerProperties() == null) { + this.innerProperties = new MongoRoleDefinitionResource(); + } + this.innerProperties().withPrivileges(privileges); + return this; + } + + /** + * Get the roles property: The set of roles inherited by this Role Definition. + * + * @return the roles value. + */ + public List roles() { + return this.innerProperties() == null ? null : this.innerProperties().roles(); + } + + /** + * Set the roles property: The set of roles inherited by this Role Definition. + * + * @param roles the roles value to set. + * @return the MongoRoleDefinitionGetResultsInner object itself. + */ + public MongoRoleDefinitionGetResultsInner withRoles(List roles) { + if (this.innerProperties() == null) { + this.innerProperties = new MongoRoleDefinitionResource(); + } + this.innerProperties().withRoles(roles); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MongoRoleDefinitionGetResultsInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MongoRoleDefinitionGetResultsInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MongoRoleDefinitionGetResultsInner. + */ + public static MongoRoleDefinitionGetResultsInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MongoRoleDefinitionGetResultsInner deserializedMongoRoleDefinitionGetResultsInner + = new MongoRoleDefinitionGetResultsInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedMongoRoleDefinitionGetResultsInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedMongoRoleDefinitionGetResultsInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedMongoRoleDefinitionGetResultsInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedMongoRoleDefinitionGetResultsInner.innerProperties + = MongoRoleDefinitionResource.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMongoRoleDefinitionGetResultsInner; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoRoleDefinitionResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoRoleDefinitionResource.java new file mode 100644 index 0000000000000..a0dc14699bec9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoRoleDefinitionResource.java @@ -0,0 +1,224 @@ +// Copyright (c) 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.MongoRoleDefinitionType; +import com.azure.resourcemanager.cosmos.generated.models.Privilege; +import com.azure.resourcemanager.cosmos.generated.models.Role; +import java.io.IOException; +import java.util.List; + +/** + * Azure Cosmos DB Mongo Role Definition resource object. + */ +@Fluent +public final class MongoRoleDefinitionResource implements JsonSerializable { + /* + * A user-friendly name for the Role Definition. Must be unique for the database account. + */ + private String roleName; + + /* + * Indicates whether the Role Definition was built-in or user created. + */ + private MongoRoleDefinitionType type; + + /* + * The database name for which access is being granted for this Role Definition. + */ + private String databaseName; + + /* + * A set of privileges contained by the Role Definition. This will allow application of this Role Definition on the + * entire database account or any underlying Database / Collection. Scopes higher than Database are not enforceable + * as privilege. + */ + private List privileges; + + /* + * The set of roles inherited by this Role Definition. + */ + private List roles; + + /** + * Creates an instance of MongoRoleDefinitionResource class. + */ + public MongoRoleDefinitionResource() { + } + + /** + * 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 MongoRoleDefinitionResource object itself. + */ + public MongoRoleDefinitionResource 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 MongoRoleDefinitionType 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 MongoRoleDefinitionResource object itself. + */ + public MongoRoleDefinitionResource withType(MongoRoleDefinitionType type) { + this.type = type; + return this; + } + + /** + * Get the databaseName property: The database name for which access is being granted for this Role Definition. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Set the databaseName property: The database name for which access is being granted for this Role Definition. + * + * @param databaseName the databaseName value to set. + * @return the MongoRoleDefinitionResource object itself. + */ + public MongoRoleDefinitionResource withDatabaseName(String databaseName) { + this.databaseName = databaseName; + return this; + } + + /** + * Get the privileges property: A set of privileges contained by the Role Definition. This will allow application of + * this Role Definition on the entire database account or any underlying Database / Collection. Scopes higher than + * Database are not enforceable as privilege. + * + * @return the privileges value. + */ + public List privileges() { + return this.privileges; + } + + /** + * Set the privileges property: A set of privileges contained by the Role Definition. This will allow application of + * this Role Definition on the entire database account or any underlying Database / Collection. Scopes higher than + * Database are not enforceable as privilege. + * + * @param privileges the privileges value to set. + * @return the MongoRoleDefinitionResource object itself. + */ + public MongoRoleDefinitionResource withPrivileges(List privileges) { + this.privileges = privileges; + return this; + } + + /** + * Get the roles property: The set of roles inherited by this Role Definition. + * + * @return the roles value. + */ + public List roles() { + return this.roles; + } + + /** + * Set the roles property: The set of roles inherited by this Role Definition. + * + * @param roles the roles value to set. + * @return the MongoRoleDefinitionResource object itself. + */ + public MongoRoleDefinitionResource withRoles(List roles) { + this.roles = roles; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (privileges() != null) { + privileges().forEach(e -> e.validate()); + } + if (roles() != null) { + roles().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("roleName", this.roleName); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeStringField("databaseName", this.databaseName); + jsonWriter.writeArrayField("privileges", this.privileges, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("roles", this.roles, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MongoRoleDefinitionResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MongoRoleDefinitionResource if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the MongoRoleDefinitionResource. + */ + public static MongoRoleDefinitionResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MongoRoleDefinitionResource deserializedMongoRoleDefinitionResource = new MongoRoleDefinitionResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("roleName".equals(fieldName)) { + deserializedMongoRoleDefinitionResource.roleName = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedMongoRoleDefinitionResource.type + = MongoRoleDefinitionType.fromString(reader.getString()); + } else if ("databaseName".equals(fieldName)) { + deserializedMongoRoleDefinitionResource.databaseName = reader.getString(); + } else if ("privileges".equals(fieldName)) { + List privileges = reader.readArray(reader1 -> Privilege.fromJson(reader1)); + deserializedMongoRoleDefinitionResource.privileges = privileges; + } else if ("roles".equals(fieldName)) { + List roles = reader.readArray(reader1 -> Role.fromJson(reader1)); + deserializedMongoRoleDefinitionResource.roles = roles; + } else { + reader.skipChildren(); + } + } + + return deserializedMongoRoleDefinitionResource; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoUserDefinitionGetResultsInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoUserDefinitionGetResultsInner.java new file mode 100644 index 0000000000000..4f3fde58ea97d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoUserDefinitionGetResultsInner.java @@ -0,0 +1,280 @@ +// Copyright (c) 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.ArmProxyResource; +import com.azure.resourcemanager.cosmos.generated.models.Role; +import java.io.IOException; +import java.util.List; + +/** + * An Azure Cosmos DB User Definition. + */ +@Fluent +public final class MongoUserDefinitionGetResultsInner extends ArmProxyResource { + /* + * Properties related to the User Definition. + */ + private MongoUserDefinitionResource innerProperties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of MongoUserDefinitionGetResultsInner class. + */ + public MongoUserDefinitionGetResultsInner() { + } + + /** + * Get the innerProperties property: Properties related to the User Definition. + * + * @return the innerProperties value. + */ + private MongoUserDefinitionResource innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the username property: The user name for User Definition. + * + * @return the username value. + */ + public String username() { + return this.innerProperties() == null ? null : this.innerProperties().username(); + } + + /** + * Set the username property: The user name for User Definition. + * + * @param username the username value to set. + * @return the MongoUserDefinitionGetResultsInner object itself. + */ + public MongoUserDefinitionGetResultsInner withUsername(String username) { + if (this.innerProperties() == null) { + this.innerProperties = new MongoUserDefinitionResource(); + } + this.innerProperties().withUsername(username); + return this; + } + + /** + * Get the password property: The password for User Definition. Response does not contain user password. + * + * @return the password value. + */ + public String password() { + return this.innerProperties() == null ? null : this.innerProperties().password(); + } + + /** + * Set the password property: The password for User Definition. Response does not contain user password. + * + * @param password the password value to set. + * @return the MongoUserDefinitionGetResultsInner object itself. + */ + public MongoUserDefinitionGetResultsInner withPassword(String password) { + if (this.innerProperties() == null) { + this.innerProperties = new MongoUserDefinitionResource(); + } + this.innerProperties().withPassword(password); + return this; + } + + /** + * Get the databaseName property: The database name for which access is being granted for this User Definition. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.innerProperties() == null ? null : this.innerProperties().databaseName(); + } + + /** + * Set the databaseName property: The database name for which access is being granted for this User Definition. + * + * @param databaseName the databaseName value to set. + * @return the MongoUserDefinitionGetResultsInner object itself. + */ + public MongoUserDefinitionGetResultsInner withDatabaseName(String databaseName) { + if (this.innerProperties() == null) { + this.innerProperties = new MongoUserDefinitionResource(); + } + this.innerProperties().withDatabaseName(databaseName); + return this; + } + + /** + * Get the customData property: A custom definition for the USer Definition. + * + * @return the customData value. + */ + public String customData() { + return this.innerProperties() == null ? null : this.innerProperties().customData(); + } + + /** + * Set the customData property: A custom definition for the USer Definition. + * + * @param customData the customData value to set. + * @return the MongoUserDefinitionGetResultsInner object itself. + */ + public MongoUserDefinitionGetResultsInner withCustomData(String customData) { + if (this.innerProperties() == null) { + this.innerProperties = new MongoUserDefinitionResource(); + } + this.innerProperties().withCustomData(customData); + return this; + } + + /** + * Get the roles property: The set of roles inherited by the User Definition. + * + * @return the roles value. + */ + public List roles() { + return this.innerProperties() == null ? null : this.innerProperties().roles(); + } + + /** + * Set the roles property: The set of roles inherited by the User Definition. + * + * @param roles the roles value to set. + * @return the MongoUserDefinitionGetResultsInner object itself. + */ + public MongoUserDefinitionGetResultsInner withRoles(List roles) { + if (this.innerProperties() == null) { + this.innerProperties = new MongoUserDefinitionResource(); + } + this.innerProperties().withRoles(roles); + return this; + } + + /** + * Get the mechanisms property: The Mongo Auth mechanism. For now, we only support auth mechanism SCRAM-SHA-256. + * + * @return the mechanisms value. + */ + public String mechanisms() { + return this.innerProperties() == null ? null : this.innerProperties().mechanisms(); + } + + /** + * Set the mechanisms property: The Mongo Auth mechanism. For now, we only support auth mechanism SCRAM-SHA-256. + * + * @param mechanisms the mechanisms value to set. + * @return the MongoUserDefinitionGetResultsInner object itself. + */ + public MongoUserDefinitionGetResultsInner withMechanisms(String mechanisms) { + if (this.innerProperties() == null) { + this.innerProperties = new MongoUserDefinitionResource(); + } + this.innerProperties().withMechanisms(mechanisms); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MongoUserDefinitionGetResultsInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MongoUserDefinitionGetResultsInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MongoUserDefinitionGetResultsInner. + */ + public static MongoUserDefinitionGetResultsInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MongoUserDefinitionGetResultsInner deserializedMongoUserDefinitionGetResultsInner + = new MongoUserDefinitionGetResultsInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedMongoUserDefinitionGetResultsInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedMongoUserDefinitionGetResultsInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedMongoUserDefinitionGetResultsInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedMongoUserDefinitionGetResultsInner.innerProperties + = MongoUserDefinitionResource.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMongoUserDefinitionGetResultsInner; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoUserDefinitionResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoUserDefinitionResource.java new file mode 100644 index 0000000000000..87016cd261a78 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoUserDefinitionResource.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.Role; +import java.io.IOException; +import java.util.List; + +/** + * Azure Cosmos DB Mongo User Definition resource object. + */ +@Fluent +public final class MongoUserDefinitionResource implements JsonSerializable { + /* + * The user name for User Definition. + */ + private String username; + + /* + * The password for User Definition. Response does not contain user password. + */ + private String password; + + /* + * The database name for which access is being granted for this User Definition. + */ + private String databaseName; + + /* + * A custom definition for the USer Definition. + */ + private String customData; + + /* + * The set of roles inherited by the User Definition. + */ + private List roles; + + /* + * The Mongo Auth mechanism. For now, we only support auth mechanism SCRAM-SHA-256. + */ + private String mechanisms; + + /** + * Creates an instance of MongoUserDefinitionResource class. + */ + public MongoUserDefinitionResource() { + } + + /** + * Get the username property: The user name for User Definition. + * + * @return the username value. + */ + public String username() { + return this.username; + } + + /** + * Set the username property: The user name for User Definition. + * + * @param username the username value to set. + * @return the MongoUserDefinitionResource object itself. + */ + public MongoUserDefinitionResource withUsername(String username) { + this.username = username; + return this; + } + + /** + * Get the password property: The password for User Definition. Response does not contain user password. + * + * @return the password value. + */ + public String password() { + return this.password; + } + + /** + * Set the password property: The password for User Definition. Response does not contain user password. + * + * @param password the password value to set. + * @return the MongoUserDefinitionResource object itself. + */ + public MongoUserDefinitionResource withPassword(String password) { + this.password = password; + return this; + } + + /** + * Get the databaseName property: The database name for which access is being granted for this User Definition. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Set the databaseName property: The database name for which access is being granted for this User Definition. + * + * @param databaseName the databaseName value to set. + * @return the MongoUserDefinitionResource object itself. + */ + public MongoUserDefinitionResource withDatabaseName(String databaseName) { + this.databaseName = databaseName; + return this; + } + + /** + * Get the customData property: A custom definition for the USer Definition. + * + * @return the customData value. + */ + public String customData() { + return this.customData; + } + + /** + * Set the customData property: A custom definition for the USer Definition. + * + * @param customData the customData value to set. + * @return the MongoUserDefinitionResource object itself. + */ + public MongoUserDefinitionResource withCustomData(String customData) { + this.customData = customData; + return this; + } + + /** + * Get the roles property: The set of roles inherited by the User Definition. + * + * @return the roles value. + */ + public List roles() { + return this.roles; + } + + /** + * Set the roles property: The set of roles inherited by the User Definition. + * + * @param roles the roles value to set. + * @return the MongoUserDefinitionResource object itself. + */ + public MongoUserDefinitionResource withRoles(List roles) { + this.roles = roles; + return this; + } + + /** + * Get the mechanisms property: The Mongo Auth mechanism. For now, we only support auth mechanism SCRAM-SHA-256. + * + * @return the mechanisms value. + */ + public String mechanisms() { + return this.mechanisms; + } + + /** + * Set the mechanisms property: The Mongo Auth mechanism. For now, we only support auth mechanism SCRAM-SHA-256. + * + * @param mechanisms the mechanisms value to set. + * @return the MongoUserDefinitionResource object itself. + */ + public MongoUserDefinitionResource withMechanisms(String mechanisms) { + this.mechanisms = mechanisms; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (roles() != null) { + roles().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("userName", this.username); + jsonWriter.writeStringField("password", this.password); + jsonWriter.writeStringField("databaseName", this.databaseName); + jsonWriter.writeStringField("customData", this.customData); + jsonWriter.writeArrayField("roles", this.roles, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("mechanisms", this.mechanisms); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MongoUserDefinitionResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MongoUserDefinitionResource if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the MongoUserDefinitionResource. + */ + public static MongoUserDefinitionResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MongoUserDefinitionResource deserializedMongoUserDefinitionResource = new MongoUserDefinitionResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("userName".equals(fieldName)) { + deserializedMongoUserDefinitionResource.username = reader.getString(); + } else if ("password".equals(fieldName)) { + deserializedMongoUserDefinitionResource.password = reader.getString(); + } else if ("databaseName".equals(fieldName)) { + deserializedMongoUserDefinitionResource.databaseName = reader.getString(); + } else if ("customData".equals(fieldName)) { + deserializedMongoUserDefinitionResource.customData = reader.getString(); + } else if ("roles".equals(fieldName)) { + List roles = reader.readArray(reader1 -> Role.fromJson(reader1)); + deserializedMongoUserDefinitionResource.roles = roles; + } else if ("mechanisms".equals(fieldName)) { + deserializedMongoUserDefinitionResource.mechanisms = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMongoUserDefinitionResource; + }); + } +} 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..c0b5286475951 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/NotebookWorkspaceConnectionInfoResultInner.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.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The connection info for the given notebook workspace. + */ +@Immutable +public final class NotebookWorkspaceConnectionInfoResultInner + implements JsonSerializable { + /* + * Specifies auth token used for connecting to Notebook server (uses token-based auth). + */ + private String authToken; + + /* + * Specifies the endpoint of Notebook server. + */ + private String notebookServerEndpoint; + + /** + * Creates an instance of NotebookWorkspaceConnectionInfoResultInner class. + */ + public NotebookWorkspaceConnectionInfoResultInner() { + } + + /** + * 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NotebookWorkspaceConnectionInfoResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NotebookWorkspaceConnectionInfoResultInner if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the NotebookWorkspaceConnectionInfoResultInner. + */ + public static NotebookWorkspaceConnectionInfoResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NotebookWorkspaceConnectionInfoResultInner deserializedNotebookWorkspaceConnectionInfoResultInner + = new NotebookWorkspaceConnectionInfoResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("authToken".equals(fieldName)) { + deserializedNotebookWorkspaceConnectionInfoResultInner.authToken = reader.getString(); + } else if ("notebookServerEndpoint".equals(fieldName)) { + deserializedNotebookWorkspaceConnectionInfoResultInner.notebookServerEndpoint = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedNotebookWorkspaceConnectionInfoResultInner; + }); + } +} 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..97cdc0dec5b6f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/NotebookWorkspaceInner.java @@ -0,0 +1,157 @@ +// Copyright (c) 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.ArmProxyResource; +import java.io.IOException; + +/** + * A notebook workspace resource. + */ +@Immutable +public final class NotebookWorkspaceInner extends ArmProxyResource { + /* + * Resource properties. + */ + private NotebookWorkspaceProperties innerProperties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of NotebookWorkspaceInner class. + */ + public NotebookWorkspaceInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private NotebookWorkspaceProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * 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() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NotebookWorkspaceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NotebookWorkspaceInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the NotebookWorkspaceInner. + */ + public static NotebookWorkspaceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NotebookWorkspaceInner deserializedNotebookWorkspaceInner = new NotebookWorkspaceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedNotebookWorkspaceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedNotebookWorkspaceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedNotebookWorkspaceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedNotebookWorkspaceInner.innerProperties = NotebookWorkspaceProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedNotebookWorkspaceInner; + }); + } +} 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..b5acda101fc81 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/NotebookWorkspaceProperties.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.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Properties of a notebook workspace resource. + */ +@Immutable +public final class NotebookWorkspaceProperties implements JsonSerializable { + /* + * Specifies the endpoint of Notebook server. + */ + private String notebookServerEndpoint; + + /* + * Status of the notebook workspace. Possible values are: Creating, Online, Deleting, Failed, Updating. + */ + private String status; + + /** + * Creates an instance of NotebookWorkspaceProperties class. + */ + public NotebookWorkspaceProperties() { + } + + /** + * 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NotebookWorkspaceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NotebookWorkspaceProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the NotebookWorkspaceProperties. + */ + public static NotebookWorkspaceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NotebookWorkspaceProperties deserializedNotebookWorkspaceProperties = new NotebookWorkspaceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("notebookServerEndpoint".equals(fieldName)) { + deserializedNotebookWorkspaceProperties.notebookServerEndpoint = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedNotebookWorkspaceProperties.status = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedNotebookWorkspaceProperties; + }); + } +} 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..70db49a5e3a0d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/OperationInner.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.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.OperationDisplay; +import java.io.IOException; + +/** + * REST API operation. + */ +@Fluent +public final class OperationInner implements JsonSerializable { + /* + * Operation name: {provider}/{resource}/{operation} + */ + private String name; + + /* + * The object that represents the operation. + */ + private OperationDisplay display; + + /** + * Creates an instance of OperationInner class. + */ + public OperationInner() { + } + + /** + * 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeJsonField("display", this.display); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationInner. + */ + public static OperationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationInner deserializedOperationInner = new OperationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedOperationInner.name = reader.getString(); + } else if ("display".equals(fieldName)) { + deserializedOperationInner.display = OperationDisplay.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationInner; + }); + } +} 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..016476efa33d9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PartitionMetricInner.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.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +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.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; + +/** + * The metric values for a single partition. + */ +@Immutable +public final class PartitionMetricInner extends MetricInner { + /* + * The partition id (GUID identifier) of the metric values. + */ + private String partitionId; + + /* + * The partition key range id (integer identifier) of the metric values. + */ + private String partitionKeyRangeId; + + /* + * The metric values for the specified time window and timestep. + */ + private List metricValues; + + /* + * The name information for the metric. + */ + private MetricName name; + + /* + * The unit of the metric. + */ + private UnitType unit; + + /* + * The time grain to be used to summarize the metric values. + */ + private String timeGrain; + + /* + * The end time for the metric (ISO-8601 format). + */ + private OffsetDateTime endTime; + + /* + * The start time for the metric (ISO-8601 format). + */ + private OffsetDateTime startTime; + + /** + * Creates an instance of PartitionMetricInner class. + */ + public PartitionMetricInner() { + } + + /** + * 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; + } + + /** + * Get the metricValues property: The metric values for the specified time window and timestep. + * + * @return the metricValues value. + */ + @Override + public List metricValues() { + return this.metricValues; + } + + /** + * Get the name property: The name information for the metric. + * + * @return the name value. + */ + @Override + public MetricName name() { + return this.name; + } + + /** + * Get the unit property: The unit of the metric. + * + * @return the unit value. + */ + @Override + public UnitType unit() { + return this.unit; + } + + /** + * Get the timeGrain property: The time grain to be used to summarize the metric values. + * + * @return the timeGrain value. + */ + @Override + public String timeGrain() { + return this.timeGrain; + } + + /** + * Get the endTime property: The end time for the metric (ISO-8601 format). + * + * @return the endTime value. + */ + @Override + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Get the startTime property: The start time for the metric (ISO-8601 format). + * + * @return the startTime value. + */ + @Override + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (name() != null) { + name().validate(); + } + if (metricValues() != null) { + metricValues().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PartitionMetricInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PartitionMetricInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the PartitionMetricInner. + */ + public static PartitionMetricInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PartitionMetricInner deserializedPartitionMetricInner = new PartitionMetricInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("startTime".equals(fieldName)) { + deserializedPartitionMetricInner.startTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("endTime".equals(fieldName)) { + deserializedPartitionMetricInner.endTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("timeGrain".equals(fieldName)) { + deserializedPartitionMetricInner.timeGrain = reader.getString(); + } else if ("unit".equals(fieldName)) { + deserializedPartitionMetricInner.unit = UnitType.fromString(reader.getString()); + } else if ("name".equals(fieldName)) { + deserializedPartitionMetricInner.name = MetricName.fromJson(reader); + } else if ("metricValues".equals(fieldName)) { + List metricValues = reader.readArray(reader1 -> MetricValue.fromJson(reader1)); + deserializedPartitionMetricInner.metricValues = metricValues; + } else if ("partitionId".equals(fieldName)) { + deserializedPartitionMetricInner.partitionId = reader.getString(); + } else if ("partitionKeyRangeId".equals(fieldName)) { + deserializedPartitionMetricInner.partitionKeyRangeId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPartitionMetricInner; + }); + } +} 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..2fab9188b16c2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PartitionUsageInner.java @@ -0,0 +1,187 @@ +// Copyright (c) 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.MetricName; +import com.azure.resourcemanager.cosmos.generated.models.UnitType; +import java.io.IOException; + +/** + * The partition level usage data for a usage request. + */ +@Immutable +public final class PartitionUsageInner extends UsageInner { + /* + * The partition id (GUID identifier) of the usages. + */ + private String partitionId; + + /* + * The partition key range id (integer identifier) of the usages. + */ + private String partitionKeyRangeId; + + /* + * Current value for this metric + */ + private Long currentValue; + + /* + * Maximum value for this metric + */ + private Long limit; + + /* + * The quota period used to summarize the usage values. + */ + private String quotaPeriod; + + /* + * The name information for the metric. + */ + private MetricName name; + + /* + * The unit of the metric. + */ + private UnitType unit; + + /** + * Creates an instance of PartitionUsageInner class. + */ + public PartitionUsageInner() { + } + + /** + * 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; + } + + /** + * Get the currentValue property: Current value for this metric. + * + * @return the currentValue value. + */ + @Override + public Long currentValue() { + return this.currentValue; + } + + /** + * Get the limit property: Maximum value for this metric. + * + * @return the limit value. + */ + @Override + public Long limit() { + return this.limit; + } + + /** + * Get the quotaPeriod property: The quota period used to summarize the usage values. + * + * @return the quotaPeriod value. + */ + @Override + public String quotaPeriod() { + return this.quotaPeriod; + } + + /** + * Get the name property: The name information for the metric. + * + * @return the name value. + */ + @Override + public MetricName name() { + return this.name; + } + + /** + * Get the unit property: The unit of the metric. + * + * @return the unit value. + */ + @Override + public UnitType unit() { + return this.unit; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (name() != null) { + name().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PartitionUsageInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PartitionUsageInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the PartitionUsageInner. + */ + public static PartitionUsageInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PartitionUsageInner deserializedPartitionUsageInner = new PartitionUsageInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("unit".equals(fieldName)) { + deserializedPartitionUsageInner.unit = UnitType.fromString(reader.getString()); + } else if ("name".equals(fieldName)) { + deserializedPartitionUsageInner.name = MetricName.fromJson(reader); + } else if ("quotaPeriod".equals(fieldName)) { + deserializedPartitionUsageInner.quotaPeriod = reader.getString(); + } else if ("limit".equals(fieldName)) { + deserializedPartitionUsageInner.limit = reader.getNullable(JsonReader::getLong); + } else if ("currentValue".equals(fieldName)) { + deserializedPartitionUsageInner.currentValue = reader.getNullable(JsonReader::getLong); + } else if ("partitionId".equals(fieldName)) { + deserializedPartitionUsageInner.partitionId = reader.getString(); + } else if ("partitionKeyRangeId".equals(fieldName)) { + deserializedPartitionUsageInner.partitionKeyRangeId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPartitionUsageInner; + }); + } +} 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..375f6d276121d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PercentileMetricInner.java @@ -0,0 +1,177 @@ +// Copyright (c) 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.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +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 java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; + +/** + * Percentile Metric data. + */ +@Immutable +public final class PercentileMetricInner implements JsonSerializable { + /* + * The start time for the metric (ISO-8601 format). + */ + private OffsetDateTime startTime; + + /* + * The end time for the metric (ISO-8601 format). + */ + private OffsetDateTime endTime; + + /* + * The time grain to be used to summarize the metric values. + */ + private String timeGrain; + + /* + * The unit of the metric. + */ + private UnitType unit; + + /* + * The name information for the metric. + */ + private MetricName name; + + /* + * The percentile metric values for the specified time window and timestep. + */ + private List metricValues; + + /** + * Creates an instance of PercentileMetricInner class. + */ + public PercentileMetricInner() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PercentileMetricInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PercentileMetricInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the PercentileMetricInner. + */ + public static PercentileMetricInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PercentileMetricInner deserializedPercentileMetricInner = new PercentileMetricInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("startTime".equals(fieldName)) { + deserializedPercentileMetricInner.startTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("endTime".equals(fieldName)) { + deserializedPercentileMetricInner.endTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("timeGrain".equals(fieldName)) { + deserializedPercentileMetricInner.timeGrain = reader.getString(); + } else if ("unit".equals(fieldName)) { + deserializedPercentileMetricInner.unit = UnitType.fromString(reader.getString()); + } else if ("name".equals(fieldName)) { + deserializedPercentileMetricInner.name = MetricName.fromJson(reader); + } else if ("metricValues".equals(fieldName)) { + List metricValues + = reader.readArray(reader1 -> PercentileMetricValue.fromJson(reader1)); + deserializedPercentileMetricInner.metricValues = metricValues; + } else { + reader.skipChildren(); + } + } + + return deserializedPercentileMetricInner; + }); + } +} 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..3b26501489af6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PrivateEndpointConnectionInner.java @@ -0,0 +1,234 @@ +// Copyright (c) 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.PrivateEndpointProperty; +import com.azure.resourcemanager.cosmos.generated.models.PrivateLinkServiceConnectionStateProperty; +import java.io.IOException; + +/** + * A private endpoint connection. + */ +@Fluent +public final class PrivateEndpointConnectionInner extends ProxyResource { + /* + * Resource properties. + */ + private PrivateEndpointConnectionProperties innerProperties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of PrivateEndpointConnectionInner class. + */ + public PrivateEndpointConnectionInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private PrivateEndpointConnectionProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateEndpointConnectionInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateEndpointConnectionInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PrivateEndpointConnectionInner. + */ + public static PrivateEndpointConnectionInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateEndpointConnectionInner deserializedPrivateEndpointConnectionInner + = new PrivateEndpointConnectionInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPrivateEndpointConnectionInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedPrivateEndpointConnectionInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedPrivateEndpointConnectionInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedPrivateEndpointConnectionInner.innerProperties + = PrivateEndpointConnectionProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateEndpointConnectionInner; + }); + } +} 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..f12c343507854 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PrivateEndpointConnectionProperties.java @@ -0,0 +1,190 @@ +// Copyright (c) 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.PrivateEndpointProperty; +import com.azure.resourcemanager.cosmos.generated.models.PrivateLinkServiceConnectionStateProperty; +import java.io.IOException; + +/** + * Properties of a private endpoint connection. + */ +@Fluent +public final class PrivateEndpointConnectionProperties + implements JsonSerializable { + /* + * Private endpoint which the connection belongs to. + */ + private PrivateEndpointProperty privateEndpoint; + + /* + * Connection State of the Private Endpoint Connection. + */ + private PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState; + + /* + * Group id of the private endpoint. + */ + private String groupId; + + /* + * Provisioning state of the private endpoint. + */ + private String provisioningState; + + /** + * Creates an instance of PrivateEndpointConnectionProperties class. + */ + public PrivateEndpointConnectionProperties() { + } + + /** + * 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("privateEndpoint", this.privateEndpoint); + jsonWriter.writeJsonField("privateLinkServiceConnectionState", this.privateLinkServiceConnectionState); + jsonWriter.writeStringField("groupId", this.groupId); + jsonWriter.writeStringField("provisioningState", this.provisioningState); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateEndpointConnectionProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateEndpointConnectionProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the PrivateEndpointConnectionProperties. + */ + public static PrivateEndpointConnectionProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateEndpointConnectionProperties deserializedPrivateEndpointConnectionProperties + = new PrivateEndpointConnectionProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("privateEndpoint".equals(fieldName)) { + deserializedPrivateEndpointConnectionProperties.privateEndpoint + = PrivateEndpointProperty.fromJson(reader); + } else if ("privateLinkServiceConnectionState".equals(fieldName)) { + deserializedPrivateEndpointConnectionProperties.privateLinkServiceConnectionState + = PrivateLinkServiceConnectionStateProperty.fromJson(reader); + } else if ("groupId".equals(fieldName)) { + deserializedPrivateEndpointConnectionProperties.groupId = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedPrivateEndpointConnectionProperties.provisioningState = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateEndpointConnectionProperties; + }); + } +} 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..a8e169e57a9e2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PrivateLinkResourceInner.java @@ -0,0 +1,167 @@ +// Copyright (c) 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.ArmProxyResource; +import java.io.IOException; +import java.util.List; + +/** + * A private link resource. + */ +@Immutable +public final class PrivateLinkResourceInner extends ArmProxyResource { + /* + * Resource properties. + */ + private PrivateLinkResourceProperties innerProperties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of PrivateLinkResourceInner class. + */ + public PrivateLinkResourceInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private PrivateLinkResourceProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * 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() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateLinkResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateLinkResourceInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PrivateLinkResourceInner. + */ + public static PrivateLinkResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateLinkResourceInner deserializedPrivateLinkResourceInner = new PrivateLinkResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPrivateLinkResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedPrivateLinkResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedPrivateLinkResourceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedPrivateLinkResourceInner.innerProperties + = PrivateLinkResourceProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateLinkResourceInner; + }); + } +} 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..aff5f0cd2fa94 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PrivateLinkResourceProperties.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.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Properties of a private link resource. + */ +@Immutable +public final class PrivateLinkResourceProperties implements JsonSerializable { + /* + * The private link resource group id. + */ + private String groupId; + + /* + * The private link resource required member names. + */ + private List requiredMembers; + + /* + * The private link resource required zone names. + */ + private List requiredZoneNames; + + /** + * Creates an instance of PrivateLinkResourceProperties class. + */ + public PrivateLinkResourceProperties() { + } + + /** + * 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateLinkResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateLinkResourceProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the PrivateLinkResourceProperties. + */ + public static PrivateLinkResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateLinkResourceProperties deserializedPrivateLinkResourceProperties + = new PrivateLinkResourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("groupId".equals(fieldName)) { + deserializedPrivateLinkResourceProperties.groupId = reader.getString(); + } else if ("requiredMembers".equals(fieldName)) { + List requiredMembers = reader.readArray(reader1 -> reader1.getString()); + deserializedPrivateLinkResourceProperties.requiredMembers = requiredMembers; + } else if ("requiredZoneNames".equals(fieldName)) { + List requiredZoneNames = reader.readArray(reader1 -> reader1.getString()); + deserializedPrivateLinkResourceProperties.requiredZoneNames = requiredZoneNames; + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateLinkResourceProperties; + }); + } +} 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..aea7c3fdf7c1b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableDatabaseAccountGetResultInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.ApiType; +import com.azure.resourcemanager.cosmos.generated.models.RestorableLocationResource; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; + +/** + * A Azure Cosmos DB restorable database account. + */ +@Fluent +public final class RestorableDatabaseAccountGetResultInner + implements JsonSerializable { + /* + * The properties of a restorable database account. + */ + private RestorableDatabaseAccountProperties innerProperties; + + /* + * The unique resource identifier of the ARM resource. + */ + private String id; + + /* + * The name of the ARM resource. + */ + private String name; + + /* + * The type of Azure resource. + */ + private String type; + + /* + * The location of the resource group to which the resource belongs. + */ + private String location; + + /** + * Creates an instance of RestorableDatabaseAccountGetResultInner class. + */ + public RestorableDatabaseAccountGetResultInner() { + } + + /** + * 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 oldestRestorableTime property: The least recent time at which the database account can be restored to + * (ISO-8601 format). + * + * @return the oldestRestorableTime value. + */ + public OffsetDateTime oldestRestorableTime() { + return this.innerProperties() == null ? null : this.innerProperties().oldestRestorableTime(); + } + + /** + * Set the oldestRestorableTime property: The least recent time at which the database account can be restored to + * (ISO-8601 format). + * + * @param oldestRestorableTime the oldestRestorableTime value to set. + * @return the RestorableDatabaseAccountGetResultInner object itself. + */ + public RestorableDatabaseAccountGetResultInner withOldestRestorableTime(OffsetDateTime oldestRestorableTime) { + if (this.innerProperties() == null) { + this.innerProperties = new RestorableDatabaseAccountProperties(); + } + this.innerProperties().withOldestRestorableTime(oldestRestorableTime); + 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + jsonWriter.writeStringField("location", this.location); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestorableDatabaseAccountGetResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestorableDatabaseAccountGetResultInner if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RestorableDatabaseAccountGetResultInner. + */ + public static RestorableDatabaseAccountGetResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestorableDatabaseAccountGetResultInner deserializedRestorableDatabaseAccountGetResultInner + = new RestorableDatabaseAccountGetResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedRestorableDatabaseAccountGetResultInner.innerProperties + = RestorableDatabaseAccountProperties.fromJson(reader); + } else if ("id".equals(fieldName)) { + deserializedRestorableDatabaseAccountGetResultInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedRestorableDatabaseAccountGetResultInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedRestorableDatabaseAccountGetResultInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedRestorableDatabaseAccountGetResultInner.location = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRestorableDatabaseAccountGetResultInner; + }); + } +} 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..b293a07d70dcf --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableDatabaseAccountProperties.java @@ -0,0 +1,234 @@ +// Copyright (c) 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.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.ApiType; +import com.azure.resourcemanager.cosmos.generated.models.RestorableLocationResource; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; + +/** + * The properties of a restorable database account. + */ +@Fluent +public final class RestorableDatabaseAccountProperties + implements JsonSerializable { + /* + * The name of the global database account + */ + private String accountName; + + /* + * The creation time of the restorable database account (ISO-8601 format). + */ + private OffsetDateTime creationTime; + + /* + * The time at which the restorable database account has been deleted (ISO-8601 format). + */ + private OffsetDateTime deletionTime; + + /* + * The least recent time at which the database account can be restored to (ISO-8601 format). + */ + private OffsetDateTime oldestRestorableTime; + + /* + * The API type of the restorable database account. + */ + private ApiType apiType; + + /* + * List of regions where the of the database account can be restored from. + */ + private List restorableLocations; + + /** + * Creates an instance of RestorableDatabaseAccountProperties class. + */ + public RestorableDatabaseAccountProperties() { + } + + /** + * 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 oldestRestorableTime property: The least recent time at which the database account can be restored to + * (ISO-8601 format). + * + * @return the oldestRestorableTime value. + */ + public OffsetDateTime oldestRestorableTime() { + return this.oldestRestorableTime; + } + + /** + * Set the oldestRestorableTime property: The least recent time at which the database account can be restored to + * (ISO-8601 format). + * + * @param oldestRestorableTime the oldestRestorableTime value to set. + * @return the RestorableDatabaseAccountProperties object itself. + */ + public RestorableDatabaseAccountProperties withOldestRestorableTime(OffsetDateTime oldestRestorableTime) { + this.oldestRestorableTime = oldestRestorableTime; + 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("accountName", this.accountName); + jsonWriter.writeStringField("creationTime", + this.creationTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.creationTime)); + jsonWriter.writeStringField("deletionTime", + this.deletionTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.deletionTime)); + jsonWriter.writeStringField("oldestRestorableTime", + this.oldestRestorableTime == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.oldestRestorableTime)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestorableDatabaseAccountProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestorableDatabaseAccountProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RestorableDatabaseAccountProperties. + */ + public static RestorableDatabaseAccountProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestorableDatabaseAccountProperties deserializedRestorableDatabaseAccountProperties + = new RestorableDatabaseAccountProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("accountName".equals(fieldName)) { + deserializedRestorableDatabaseAccountProperties.accountName = reader.getString(); + } else if ("creationTime".equals(fieldName)) { + deserializedRestorableDatabaseAccountProperties.creationTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("deletionTime".equals(fieldName)) { + deserializedRestorableDatabaseAccountProperties.deletionTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("oldestRestorableTime".equals(fieldName)) { + deserializedRestorableDatabaseAccountProperties.oldestRestorableTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("apiType".equals(fieldName)) { + deserializedRestorableDatabaseAccountProperties.apiType = ApiType.fromString(reader.getString()); + } else if ("restorableLocations".equals(fieldName)) { + List restorableLocations + = reader.readArray(reader1 -> RestorableLocationResource.fromJson(reader1)); + deserializedRestorableDatabaseAccountProperties.restorableLocations = restorableLocations; + } else { + reader.skipChildren(); + } + } + + return deserializedRestorableDatabaseAccountProperties; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableGremlinDatabaseGetResultInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableGremlinDatabaseGetResultInner.java new file mode 100644 index 0000000000000..d6ba06e2f28bf --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableGremlinDatabaseGetResultInner.java @@ -0,0 +1,160 @@ +// Copyright (c) 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.RestorableGremlinDatabasePropertiesResource; +import java.io.IOException; + +/** + * An Azure Cosmos DB Gremlin database event. + */ +@Fluent +public final class RestorableGremlinDatabaseGetResultInner + implements JsonSerializable { + /* + * The properties of a Gremlin database event. + */ + private RestorableGremlinDatabaseProperties innerProperties; + + /* + * The unique resource Identifier of the ARM resource. + */ + private String id; + + /* + * The name of the ARM resource. + */ + private String name; + + /* + * The type of Azure resource. + */ + private String type; + + /** + * Creates an instance of RestorableGremlinDatabaseGetResultInner class. + */ + public RestorableGremlinDatabaseGetResultInner() { + } + + /** + * Get the innerProperties property: The properties of a Gremlin database event. + * + * @return the innerProperties value. + */ + private RestorableGremlinDatabaseProperties 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 Gremlin database event. + * + * @return the resource value. + */ + public RestorableGremlinDatabasePropertiesResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The resource of an Azure Cosmos DB Gremlin database event. + * + * @param resource the resource value to set. + * @return the RestorableGremlinDatabaseGetResultInner object itself. + */ + public RestorableGremlinDatabaseGetResultInner withResource(RestorableGremlinDatabasePropertiesResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new RestorableGremlinDatabaseProperties(); + } + 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestorableGremlinDatabaseGetResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestorableGremlinDatabaseGetResultInner if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RestorableGremlinDatabaseGetResultInner. + */ + public static RestorableGremlinDatabaseGetResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestorableGremlinDatabaseGetResultInner deserializedRestorableGremlinDatabaseGetResultInner + = new RestorableGremlinDatabaseGetResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedRestorableGremlinDatabaseGetResultInner.innerProperties + = RestorableGremlinDatabaseProperties.fromJson(reader); + } else if ("id".equals(fieldName)) { + deserializedRestorableGremlinDatabaseGetResultInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedRestorableGremlinDatabaseGetResultInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedRestorableGremlinDatabaseGetResultInner.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRestorableGremlinDatabaseGetResultInner; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableGremlinDatabaseProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableGremlinDatabaseProperties.java new file mode 100644 index 0000000000000..1a12e62db9398 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableGremlinDatabaseProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.RestorableGremlinDatabasePropertiesResource; +import java.io.IOException; + +/** + * The properties of an Azure Cosmos DB Gremlin database event. + */ +@Fluent +public final class RestorableGremlinDatabaseProperties + implements JsonSerializable { + /* + * The resource of an Azure Cosmos DB Gremlin database event + */ + private RestorableGremlinDatabasePropertiesResource resource; + + /** + * Creates an instance of RestorableGremlinDatabaseProperties class. + */ + public RestorableGremlinDatabaseProperties() { + } + + /** + * Get the resource property: The resource of an Azure Cosmos DB Gremlin database event. + * + * @return the resource value. + */ + public RestorableGremlinDatabasePropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource property: The resource of an Azure Cosmos DB Gremlin database event. + * + * @param resource the resource value to set. + * @return the RestorableGremlinDatabaseProperties object itself. + */ + public RestorableGremlinDatabaseProperties withResource(RestorableGremlinDatabasePropertiesResource 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("resource", this.resource); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestorableGremlinDatabaseProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestorableGremlinDatabaseProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RestorableGremlinDatabaseProperties. + */ + public static RestorableGremlinDatabaseProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestorableGremlinDatabaseProperties deserializedRestorableGremlinDatabaseProperties + = new RestorableGremlinDatabaseProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resource".equals(fieldName)) { + deserializedRestorableGremlinDatabaseProperties.resource + = RestorableGremlinDatabasePropertiesResource.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedRestorableGremlinDatabaseProperties; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableGremlinGraphGetResultInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableGremlinGraphGetResultInner.java new file mode 100644 index 0000000000000..0a60c84d59f78 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableGremlinGraphGetResultInner.java @@ -0,0 +1,160 @@ +// Copyright (c) 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.RestorableGremlinGraphPropertiesResource; +import java.io.IOException; + +/** + * An Azure Cosmos DB Gremlin graph event. + */ +@Fluent +public final class RestorableGremlinGraphGetResultInner + implements JsonSerializable { + /* + * The properties of a Gremlin graph event. + */ + private RestorableGremlinGraphProperties innerProperties; + + /* + * The unique resource Identifier of the ARM resource. + */ + private String id; + + /* + * The name of the ARM resource. + */ + private String name; + + /* + * The type of Azure resource. + */ + private String type; + + /** + * Creates an instance of RestorableGremlinGraphGetResultInner class. + */ + public RestorableGremlinGraphGetResultInner() { + } + + /** + * Get the innerProperties property: The properties of a Gremlin graph event. + * + * @return the innerProperties value. + */ + private RestorableGremlinGraphProperties 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 Gremlin graph event. + * + * @return the resource value. + */ + public RestorableGremlinGraphPropertiesResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The resource of an Azure Cosmos DB Gremlin graph event. + * + * @param resource the resource value to set. + * @return the RestorableGremlinGraphGetResultInner object itself. + */ + public RestorableGremlinGraphGetResultInner withResource(RestorableGremlinGraphPropertiesResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new RestorableGremlinGraphProperties(); + } + 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestorableGremlinGraphGetResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestorableGremlinGraphGetResultInner if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RestorableGremlinGraphGetResultInner. + */ + public static RestorableGremlinGraphGetResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestorableGremlinGraphGetResultInner deserializedRestorableGremlinGraphGetResultInner + = new RestorableGremlinGraphGetResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedRestorableGremlinGraphGetResultInner.innerProperties + = RestorableGremlinGraphProperties.fromJson(reader); + } else if ("id".equals(fieldName)) { + deserializedRestorableGremlinGraphGetResultInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedRestorableGremlinGraphGetResultInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedRestorableGremlinGraphGetResultInner.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRestorableGremlinGraphGetResultInner; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableGremlinGraphProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableGremlinGraphProperties.java new file mode 100644 index 0000000000000..d0cf4850d38d8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableGremlinGraphProperties.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.RestorableGremlinGraphPropertiesResource; +import java.io.IOException; + +/** + * The properties of an Azure Cosmos DB Gremlin graph event. + */ +@Fluent +public final class RestorableGremlinGraphProperties implements JsonSerializable { + /* + * The resource of an Azure Cosmos DB Gremlin graph event + */ + private RestorableGremlinGraphPropertiesResource resource; + + /** + * Creates an instance of RestorableGremlinGraphProperties class. + */ + public RestorableGremlinGraphProperties() { + } + + /** + * Get the resource property: The resource of an Azure Cosmos DB Gremlin graph event. + * + * @return the resource value. + */ + public RestorableGremlinGraphPropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource property: The resource of an Azure Cosmos DB Gremlin graph event. + * + * @param resource the resource value to set. + * @return the RestorableGremlinGraphProperties object itself. + */ + public RestorableGremlinGraphProperties withResource(RestorableGremlinGraphPropertiesResource 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("resource", this.resource); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestorableGremlinGraphProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestorableGremlinGraphProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RestorableGremlinGraphProperties. + */ + public static RestorableGremlinGraphProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestorableGremlinGraphProperties deserializedRestorableGremlinGraphProperties + = new RestorableGremlinGraphProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resource".equals(fieldName)) { + deserializedRestorableGremlinGraphProperties.resource + = RestorableGremlinGraphPropertiesResource.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedRestorableGremlinGraphProperties; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableGremlinResourcesGetResultInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableGremlinResourcesGetResultInner.java new file mode 100644 index 0000000000000..a6b621ffe4c3e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableGremlinResourcesGetResultInner.java @@ -0,0 +1,173 @@ +// Copyright (c) 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Specific Databases to restore. + */ +@Fluent +public final class RestorableGremlinResourcesGetResultInner + implements JsonSerializable { + /* + * The unique resource identifier of the ARM resource. + */ + private String id; + + /* + * The name of the ARM resource. + */ + private String name; + + /* + * The type of Azure resource. + */ + private String type; + + /* + * The name of the gremlin database available for restore. + */ + private String databaseName; + + /* + * The names of the graphs available for restore. + */ + private List graphNames; + + /** + * Creates an instance of RestorableGremlinResourcesGetResultInner class. + */ + public RestorableGremlinResourcesGetResultInner() { + } + + /** + * 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 databaseName property: The name of the gremlin database available for restore. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Set the databaseName property: The name of the gremlin database available for restore. + * + * @param databaseName the databaseName value to set. + * @return the RestorableGremlinResourcesGetResultInner object itself. + */ + public RestorableGremlinResourcesGetResultInner withDatabaseName(String databaseName) { + this.databaseName = databaseName; + return this; + } + + /** + * Get the graphNames property: The names of the graphs available for restore. + * + * @return the graphNames value. + */ + public List graphNames() { + return this.graphNames; + } + + /** + * Set the graphNames property: The names of the graphs available for restore. + * + * @param graphNames the graphNames value to set. + * @return the RestorableGremlinResourcesGetResultInner object itself. + */ + public RestorableGremlinResourcesGetResultInner withGraphNames(List graphNames) { + this.graphNames = graphNames; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("databaseName", this.databaseName); + jsonWriter.writeArrayField("graphNames", this.graphNames, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestorableGremlinResourcesGetResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestorableGremlinResourcesGetResultInner if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RestorableGremlinResourcesGetResultInner. + */ + public static RestorableGremlinResourcesGetResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestorableGremlinResourcesGetResultInner deserializedRestorableGremlinResourcesGetResultInner + = new RestorableGremlinResourcesGetResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedRestorableGremlinResourcesGetResultInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedRestorableGremlinResourcesGetResultInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedRestorableGremlinResourcesGetResultInner.type = reader.getString(); + } else if ("databaseName".equals(fieldName)) { + deserializedRestorableGremlinResourcesGetResultInner.databaseName = reader.getString(); + } else if ("graphNames".equals(fieldName)) { + List graphNames = reader.readArray(reader1 -> reader1.getString()); + deserializedRestorableGremlinResourcesGetResultInner.graphNames = graphNames; + } else { + reader.skipChildren(); + } + } + + return deserializedRestorableGremlinResourcesGetResultInner; + }); + } +} 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..39db46d72176d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableMongodbCollectionGetResultInner.java @@ -0,0 +1,161 @@ +// Copyright (c) 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbCollectionPropertiesResource; +import java.io.IOException; + +/** + * An Azure Cosmos DB MongoDB collection event. + */ +@Fluent +public final class RestorableMongodbCollectionGetResultInner + implements JsonSerializable { + /* + * The properties of a MongoDB collection event. + */ + private RestorableMongodbCollectionProperties innerProperties; + + /* + * The unique resource Identifier of the ARM resource. + */ + private String id; + + /* + * The name of the ARM resource. + */ + private String name; + + /* + * The type of Azure resource. + */ + private String type; + + /** + * Creates an instance of RestorableMongodbCollectionGetResultInner class. + */ + public RestorableMongodbCollectionGetResultInner() { + } + + /** + * 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestorableMongodbCollectionGetResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestorableMongodbCollectionGetResultInner if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RestorableMongodbCollectionGetResultInner. + */ + public static RestorableMongodbCollectionGetResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestorableMongodbCollectionGetResultInner deserializedRestorableMongodbCollectionGetResultInner + = new RestorableMongodbCollectionGetResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedRestorableMongodbCollectionGetResultInner.innerProperties + = RestorableMongodbCollectionProperties.fromJson(reader); + } else if ("id".equals(fieldName)) { + deserializedRestorableMongodbCollectionGetResultInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedRestorableMongodbCollectionGetResultInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedRestorableMongodbCollectionGetResultInner.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRestorableMongodbCollectionGetResultInner; + }); + } +} 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..5fef04e12dffe --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableMongodbCollectionProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbCollectionPropertiesResource; +import java.io.IOException; + +/** + * The properties of an Azure Cosmos DB MongoDB collection event. + */ +@Fluent +public final class RestorableMongodbCollectionProperties + implements JsonSerializable { + /* + * The resource of an Azure Cosmos DB MongoDB collection event + */ + private RestorableMongodbCollectionPropertiesResource resource; + + /** + * Creates an instance of RestorableMongodbCollectionProperties class. + */ + public RestorableMongodbCollectionProperties() { + } + + /** + * 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("resource", this.resource); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestorableMongodbCollectionProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestorableMongodbCollectionProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RestorableMongodbCollectionProperties. + */ + public static RestorableMongodbCollectionProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestorableMongodbCollectionProperties deserializedRestorableMongodbCollectionProperties + = new RestorableMongodbCollectionProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resource".equals(fieldName)) { + deserializedRestorableMongodbCollectionProperties.resource + = RestorableMongodbCollectionPropertiesResource.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedRestorableMongodbCollectionProperties; + }); + } +} 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..f2adaf35f636b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableMongodbDatabaseGetResultInner.java @@ -0,0 +1,160 @@ +// Copyright (c) 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbDatabasePropertiesResource; +import java.io.IOException; + +/** + * An Azure Cosmos DB MongoDB database event. + */ +@Fluent +public final class RestorableMongodbDatabaseGetResultInner + implements JsonSerializable { + /* + * The properties of a MongoDB database event. + */ + private RestorableMongodbDatabaseProperties innerProperties; + + /* + * The unique resource Identifier of the ARM resource. + */ + private String id; + + /* + * The name of the ARM resource. + */ + private String name; + + /* + * The type of Azure resource. + */ + private String type; + + /** + * Creates an instance of RestorableMongodbDatabaseGetResultInner class. + */ + public RestorableMongodbDatabaseGetResultInner() { + } + + /** + * 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestorableMongodbDatabaseGetResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestorableMongodbDatabaseGetResultInner if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RestorableMongodbDatabaseGetResultInner. + */ + public static RestorableMongodbDatabaseGetResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestorableMongodbDatabaseGetResultInner deserializedRestorableMongodbDatabaseGetResultInner + = new RestorableMongodbDatabaseGetResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedRestorableMongodbDatabaseGetResultInner.innerProperties + = RestorableMongodbDatabaseProperties.fromJson(reader); + } else if ("id".equals(fieldName)) { + deserializedRestorableMongodbDatabaseGetResultInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedRestorableMongodbDatabaseGetResultInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedRestorableMongodbDatabaseGetResultInner.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRestorableMongodbDatabaseGetResultInner; + }); + } +} 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..38573fc4f708f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableMongodbDatabaseProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbDatabasePropertiesResource; +import java.io.IOException; + +/** + * The properties of an Azure Cosmos DB MongoDB database event. + */ +@Fluent +public final class RestorableMongodbDatabaseProperties + implements JsonSerializable { + /* + * The resource of an Azure Cosmos DB MongoDB database event + */ + private RestorableMongodbDatabasePropertiesResource resource; + + /** + * Creates an instance of RestorableMongodbDatabaseProperties class. + */ + public RestorableMongodbDatabaseProperties() { + } + + /** + * 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("resource", this.resource); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestorableMongodbDatabaseProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestorableMongodbDatabaseProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RestorableMongodbDatabaseProperties. + */ + public static RestorableMongodbDatabaseProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestorableMongodbDatabaseProperties deserializedRestorableMongodbDatabaseProperties + = new RestorableMongodbDatabaseProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resource".equals(fieldName)) { + deserializedRestorableMongodbDatabaseProperties.resource + = RestorableMongodbDatabasePropertiesResource.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedRestorableMongodbDatabaseProperties; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableMongodbResourcesGetResultInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableMongodbResourcesGetResultInner.java new file mode 100644 index 0000000000000..2b7633c1c421e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableMongodbResourcesGetResultInner.java @@ -0,0 +1,174 @@ +// Copyright (c) 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Specific Databases to restore. + */ +@Fluent +public final class RestorableMongodbResourcesGetResultInner + implements JsonSerializable { + /* + * The unique resource identifier of the ARM resource. + */ + private String id; + + /* + * The name of the ARM resource. + */ + private String name; + + /* + * The type of Azure resource. + */ + private String type; + + /* + * The name of the database available for restore. + */ + private String databaseName; + + /* + * The names of the collections available for restore. + */ + private List collectionNames; + + /** + * Creates an instance of RestorableMongodbResourcesGetResultInner class. + */ + public RestorableMongodbResourcesGetResultInner() { + } + + /** + * 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 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 RestorableMongodbResourcesGetResultInner object itself. + */ + public RestorableMongodbResourcesGetResultInner 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 RestorableMongodbResourcesGetResultInner object itself. + */ + public RestorableMongodbResourcesGetResultInner withCollectionNames(List collectionNames) { + this.collectionNames = collectionNames; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("databaseName", this.databaseName); + jsonWriter.writeArrayField("collectionNames", this.collectionNames, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestorableMongodbResourcesGetResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestorableMongodbResourcesGetResultInner if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RestorableMongodbResourcesGetResultInner. + */ + public static RestorableMongodbResourcesGetResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestorableMongodbResourcesGetResultInner deserializedRestorableMongodbResourcesGetResultInner + = new RestorableMongodbResourcesGetResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedRestorableMongodbResourcesGetResultInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedRestorableMongodbResourcesGetResultInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedRestorableMongodbResourcesGetResultInner.type = reader.getString(); + } else if ("databaseName".equals(fieldName)) { + deserializedRestorableMongodbResourcesGetResultInner.databaseName = reader.getString(); + } else if ("collectionNames".equals(fieldName)) { + List collectionNames = reader.readArray(reader1 -> reader1.getString()); + deserializedRestorableMongodbResourcesGetResultInner.collectionNames = collectionNames; + } else { + reader.skipChildren(); + } + } + + return deserializedRestorableMongodbResourcesGetResultInner; + }); + } +} 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..cf0966f684d35 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableSqlContainerGetResultInner.java @@ -0,0 +1,160 @@ +// Copyright (c) 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlContainerPropertiesResource; +import java.io.IOException; + +/** + * An Azure Cosmos DB SQL container event. + */ +@Fluent +public final class RestorableSqlContainerGetResultInner + implements JsonSerializable { + /* + * The properties of a SQL container event. + */ + private RestorableSqlContainerProperties innerProperties; + + /* + * The unique resource Identifier of the ARM resource. + */ + private String id; + + /* + * The name of the ARM resource. + */ + private String name; + + /* + * The type of Azure resource. + */ + private String type; + + /** + * Creates an instance of RestorableSqlContainerGetResultInner class. + */ + public RestorableSqlContainerGetResultInner() { + } + + /** + * 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestorableSqlContainerGetResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestorableSqlContainerGetResultInner if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RestorableSqlContainerGetResultInner. + */ + public static RestorableSqlContainerGetResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestorableSqlContainerGetResultInner deserializedRestorableSqlContainerGetResultInner + = new RestorableSqlContainerGetResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedRestorableSqlContainerGetResultInner.innerProperties + = RestorableSqlContainerProperties.fromJson(reader); + } else if ("id".equals(fieldName)) { + deserializedRestorableSqlContainerGetResultInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedRestorableSqlContainerGetResultInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedRestorableSqlContainerGetResultInner.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRestorableSqlContainerGetResultInner; + }); + } +} 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..0a62999077abc --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableSqlContainerProperties.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlContainerPropertiesResource; +import java.io.IOException; + +/** + * The properties of an Azure Cosmos DB SQL container event. + */ +@Fluent +public final class RestorableSqlContainerProperties implements JsonSerializable { + /* + * The resource of an Azure Cosmos DB SQL container event + */ + private RestorableSqlContainerPropertiesResource resource; + + /** + * Creates an instance of RestorableSqlContainerProperties class. + */ + public RestorableSqlContainerProperties() { + } + + /** + * 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("resource", this.resource); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestorableSqlContainerProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestorableSqlContainerProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RestorableSqlContainerProperties. + */ + public static RestorableSqlContainerProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestorableSqlContainerProperties deserializedRestorableSqlContainerProperties + = new RestorableSqlContainerProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resource".equals(fieldName)) { + deserializedRestorableSqlContainerProperties.resource + = RestorableSqlContainerPropertiesResource.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedRestorableSqlContainerProperties; + }); + } +} 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..a6b604b294f8e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableSqlDatabaseGetResultInner.java @@ -0,0 +1,160 @@ +// Copyright (c) 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlDatabasePropertiesResource; +import java.io.IOException; + +/** + * An Azure Cosmos DB SQL database event. + */ +@Fluent +public final class RestorableSqlDatabaseGetResultInner + implements JsonSerializable { + /* + * The properties of a SQL database event. + */ + private RestorableSqlDatabaseProperties innerProperties; + + /* + * The unique resource Identifier of the ARM resource. + */ + private String id; + + /* + * The name of the ARM resource. + */ + private String name; + + /* + * The type of Azure resource. + */ + private String type; + + /** + * Creates an instance of RestorableSqlDatabaseGetResultInner class. + */ + public RestorableSqlDatabaseGetResultInner() { + } + + /** + * 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestorableSqlDatabaseGetResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestorableSqlDatabaseGetResultInner if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RestorableSqlDatabaseGetResultInner. + */ + public static RestorableSqlDatabaseGetResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestorableSqlDatabaseGetResultInner deserializedRestorableSqlDatabaseGetResultInner + = new RestorableSqlDatabaseGetResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedRestorableSqlDatabaseGetResultInner.innerProperties + = RestorableSqlDatabaseProperties.fromJson(reader); + } else if ("id".equals(fieldName)) { + deserializedRestorableSqlDatabaseGetResultInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedRestorableSqlDatabaseGetResultInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedRestorableSqlDatabaseGetResultInner.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRestorableSqlDatabaseGetResultInner; + }); + } +} 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..d92c4a07ce293 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableSqlDatabaseProperties.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlDatabasePropertiesResource; +import java.io.IOException; + +/** + * The properties of an Azure Cosmos DB SQL database event. + */ +@Fluent +public final class RestorableSqlDatabaseProperties implements JsonSerializable { + /* + * The resource of an Azure Cosmos DB SQL database event + */ + private RestorableSqlDatabasePropertiesResource resource; + + /** + * Creates an instance of RestorableSqlDatabaseProperties class. + */ + public RestorableSqlDatabaseProperties() { + } + + /** + * 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("resource", this.resource); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestorableSqlDatabaseProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestorableSqlDatabaseProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RestorableSqlDatabaseProperties. + */ + public static RestorableSqlDatabaseProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestorableSqlDatabaseProperties deserializedRestorableSqlDatabaseProperties + = new RestorableSqlDatabaseProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resource".equals(fieldName)) { + deserializedRestorableSqlDatabaseProperties.resource + = RestorableSqlDatabasePropertiesResource.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedRestorableSqlDatabaseProperties; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableSqlResourcesGetResultInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableSqlResourcesGetResultInner.java new file mode 100644 index 0000000000000..8eb504cb3b7cb --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableSqlResourcesGetResultInner.java @@ -0,0 +1,174 @@ +// Copyright (c) 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Specific Databases to restore. + */ +@Fluent +public final class RestorableSqlResourcesGetResultInner + implements JsonSerializable { + /* + * The unique resource identifier of the ARM resource. + */ + private String id; + + /* + * The name of the ARM resource. + */ + private String name; + + /* + * The type of Azure resource. + */ + private String type; + + /* + * The name of the database available for restore. + */ + private String databaseName; + + /* + * The names of the collections available for restore. + */ + private List collectionNames; + + /** + * Creates an instance of RestorableSqlResourcesGetResultInner class. + */ + public RestorableSqlResourcesGetResultInner() { + } + + /** + * 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 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 RestorableSqlResourcesGetResultInner object itself. + */ + public RestorableSqlResourcesGetResultInner 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 RestorableSqlResourcesGetResultInner object itself. + */ + public RestorableSqlResourcesGetResultInner withCollectionNames(List collectionNames) { + this.collectionNames = collectionNames; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("databaseName", this.databaseName); + jsonWriter.writeArrayField("collectionNames", this.collectionNames, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestorableSqlResourcesGetResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestorableSqlResourcesGetResultInner if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RestorableSqlResourcesGetResultInner. + */ + public static RestorableSqlResourcesGetResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestorableSqlResourcesGetResultInner deserializedRestorableSqlResourcesGetResultInner + = new RestorableSqlResourcesGetResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedRestorableSqlResourcesGetResultInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedRestorableSqlResourcesGetResultInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedRestorableSqlResourcesGetResultInner.type = reader.getString(); + } else if ("databaseName".equals(fieldName)) { + deserializedRestorableSqlResourcesGetResultInner.databaseName = reader.getString(); + } else if ("collectionNames".equals(fieldName)) { + List collectionNames = reader.readArray(reader1 -> reader1.getString()); + deserializedRestorableSqlResourcesGetResultInner.collectionNames = collectionNames; + } else { + reader.skipChildren(); + } + } + + return deserializedRestorableSqlResourcesGetResultInner; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableTableGetResultInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableTableGetResultInner.java new file mode 100644 index 0000000000000..c018e20603d70 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableTableGetResultInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.RestorableTablePropertiesResource; +import java.io.IOException; + +/** + * An Azure Cosmos DB Table event. + */ +@Fluent +public final class RestorableTableGetResultInner implements JsonSerializable { + /* + * The properties of a Table event. + */ + private RestorableTableProperties innerProperties; + + /* + * The unique resource Identifier of the ARM resource. + */ + private String id; + + /* + * The name of the ARM resource. + */ + private String name; + + /* + * The type of Azure resource. + */ + private String type; + + /** + * Creates an instance of RestorableTableGetResultInner class. + */ + public RestorableTableGetResultInner() { + } + + /** + * Get the innerProperties property: The properties of a Table event. + * + * @return the innerProperties value. + */ + private RestorableTableProperties 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 Table event. + * + * @return the resource value. + */ + public RestorableTablePropertiesResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The resource of an Azure Cosmos DB Table event. + * + * @param resource the resource value to set. + * @return the RestorableTableGetResultInner object itself. + */ + public RestorableTableGetResultInner withResource(RestorableTablePropertiesResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new RestorableTableProperties(); + } + 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestorableTableGetResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestorableTableGetResultInner if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RestorableTableGetResultInner. + */ + public static RestorableTableGetResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestorableTableGetResultInner deserializedRestorableTableGetResultInner + = new RestorableTableGetResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedRestorableTableGetResultInner.innerProperties + = RestorableTableProperties.fromJson(reader); + } else if ("id".equals(fieldName)) { + deserializedRestorableTableGetResultInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedRestorableTableGetResultInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedRestorableTableGetResultInner.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRestorableTableGetResultInner; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableTableProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableTableProperties.java new file mode 100644 index 0000000000000..2aa05508f85d9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableTableProperties.java @@ -0,0 +1,97 @@ +// Copyright (c) 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.RestorableTablePropertiesResource; +import java.io.IOException; + +/** + * The properties of an Azure Cosmos DB Table event. + */ +@Fluent +public final class RestorableTableProperties implements JsonSerializable { + /* + * The resource of an Azure Cosmos DB Table event + */ + private RestorableTablePropertiesResource resource; + + /** + * Creates an instance of RestorableTableProperties class. + */ + public RestorableTableProperties() { + } + + /** + * Get the resource property: The resource of an Azure Cosmos DB Table event. + * + * @return the resource value. + */ + public RestorableTablePropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource property: The resource of an Azure Cosmos DB Table event. + * + * @param resource the resource value to set. + * @return the RestorableTableProperties object itself. + */ + public RestorableTableProperties withResource(RestorableTablePropertiesResource 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("resource", this.resource); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestorableTableProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestorableTableProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RestorableTableProperties. + */ + public static RestorableTableProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestorableTableProperties deserializedRestorableTableProperties = new RestorableTableProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resource".equals(fieldName)) { + deserializedRestorableTableProperties.resource = RestorableTablePropertiesResource.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedRestorableTableProperties; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableTableResourcesGetResultInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableTableResourcesGetResultInner.java new file mode 100644 index 0000000000000..66bba4ea6a893 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableTableResourcesGetResultInner.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.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Specific Databases to restore. + */ +@Immutable +public final class RestorableTableResourcesGetResultInner + implements JsonSerializable { + /* + * The unique resource identifier of the ARM resource. + */ + private String id; + + /* + * The name of the Table. + */ + private String name; + + /* + * The type of Azure resource. + */ + private String type; + + /** + * Creates an instance of RestorableTableResourcesGetResultInner class. + */ + public RestorableTableResourcesGetResultInner() { + } + + /** + * 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 Table. + * + * @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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestorableTableResourcesGetResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestorableTableResourcesGetResultInner if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RestorableTableResourcesGetResultInner. + */ + public static RestorableTableResourcesGetResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestorableTableResourcesGetResultInner deserializedRestorableTableResourcesGetResultInner + = new RestorableTableResourcesGetResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedRestorableTableResourcesGetResultInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedRestorableTableResourcesGetResultInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedRestorableTableResourcesGetResultInner.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRestorableTableResourcesGetResultInner; + }); + } +} 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..3adb354cd8d31 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ServiceResourceInner.java @@ -0,0 +1,150 @@ +// Copyright (c) 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.ArmProxyResource; +import com.azure.resourcemanager.cosmos.generated.models.ServiceResourceProperties; +import java.io.IOException; + +/** + * Properties for the database account. + */ +@Fluent +public final class ServiceResourceInner extends ArmProxyResource { + /* + * Services response resource. + */ + private ServiceResourceProperties properties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ServiceResourceInner class. + */ + public ServiceResourceInner() { + } + + /** + * 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; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServiceResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServiceResourceInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ServiceResourceInner. + */ + public static ServiceResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServiceResourceInner deserializedServiceResourceInner = new ServiceResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedServiceResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedServiceResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedServiceResourceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedServiceResourceInner.properties = ServiceResourceProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedServiceResourceInner; + }); + } +} 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..99448608b3045 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlContainerCreateUpdateProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.SqlContainerResource; +import java.io.IOException; + +/** + * Properties to create and update Azure Cosmos DB container. + */ +@Fluent +public final class SqlContainerCreateUpdateProperties implements JsonSerializable { + /* + * The standard JSON format of a container + */ + private SqlContainerResource resource; + + /* + * A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + */ + private CreateUpdateOptions options; + + /** + * Creates an instance of SqlContainerCreateUpdateProperties class. + */ + public SqlContainerCreateUpdateProperties() { + } + + /** + * 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.atError() + .log(new IllegalArgumentException( + "Missing required property resource in model SqlContainerCreateUpdateProperties")); + } else { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlContainerCreateUpdateProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("resource", this.resource); + jsonWriter.writeJsonField("options", this.options); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlContainerCreateUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlContainerCreateUpdateProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlContainerCreateUpdateProperties. + */ + public static SqlContainerCreateUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlContainerCreateUpdateProperties deserializedSqlContainerCreateUpdateProperties + = new SqlContainerCreateUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resource".equals(fieldName)) { + deserializedSqlContainerCreateUpdateProperties.resource = SqlContainerResource.fromJson(reader); + } else if ("options".equals(fieldName)) { + deserializedSqlContainerCreateUpdateProperties.options = CreateUpdateOptions.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlContainerCreateUpdateProperties; + }); + } +} 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..467bb09b03c88 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlContainerGetProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.SqlContainerGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.SqlContainerGetPropertiesResource; +import java.io.IOException; + +/** + * The properties of an Azure Cosmos DB container. + */ +@Fluent +public final class SqlContainerGetProperties implements JsonSerializable { + /* + * The resource property. + */ + private SqlContainerGetPropertiesResource resource; + + /* + * The options property. + */ + private SqlContainerGetPropertiesOptions options; + + /** + * Creates an instance of SqlContainerGetProperties class. + */ + public SqlContainerGetProperties() { + } + + /** + * 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("resource", this.resource); + jsonWriter.writeJsonField("options", this.options); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlContainerGetProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlContainerGetProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlContainerGetProperties. + */ + public static SqlContainerGetProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlContainerGetProperties deserializedSqlContainerGetProperties = new SqlContainerGetProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resource".equals(fieldName)) { + deserializedSqlContainerGetProperties.resource = SqlContainerGetPropertiesResource.fromJson(reader); + } else if ("options".equals(fieldName)) { + deserializedSqlContainerGetProperties.options = SqlContainerGetPropertiesOptions.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlContainerGetProperties; + }); + } +} 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..266e72001c016 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlContainerGetResultsInner.java @@ -0,0 +1,213 @@ +// Copyright (c) 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.SqlContainerGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.SqlContainerGetPropertiesResource; +import java.io.IOException; +import java.util.Map; + +/** + * An Azure Cosmos DB container. + */ +@Fluent +public final class SqlContainerGetResultsInner extends ArmResourceProperties { + /* + * The properties of an Azure Cosmos DB container + */ + private SqlContainerGetProperties innerProperties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of SqlContainerGetResultsInner class. + */ + public SqlContainerGetResultsInner() { + } + + /** + * Get the innerProperties property: The properties of an Azure Cosmos DB container. + * + * @return the innerProperties value. + */ + private SqlContainerGetProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@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() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlContainerGetResultsInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlContainerGetResultsInner if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlContainerGetResultsInner. + */ + public static SqlContainerGetResultsInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlContainerGetResultsInner deserializedSqlContainerGetResultsInner = new SqlContainerGetResultsInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSqlContainerGetResultsInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSqlContainerGetResultsInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSqlContainerGetResultsInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedSqlContainerGetResultsInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedSqlContainerGetResultsInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedSqlContainerGetResultsInner.innerProperties + = SqlContainerGetProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlContainerGetResultsInner; + }); + } +} 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..fc70b65397296 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlDatabaseCreateUpdateProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.SqlDatabaseResource; +import java.io.IOException; + +/** + * Properties to create and update Azure Cosmos DB SQL database. + */ +@Fluent +public final class SqlDatabaseCreateUpdateProperties implements JsonSerializable { + /* + * The standard JSON format of a SQL database + */ + private SqlDatabaseResource resource; + + /* + * A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + */ + private CreateUpdateOptions options; + + /** + * Creates an instance of SqlDatabaseCreateUpdateProperties class. + */ + public SqlDatabaseCreateUpdateProperties() { + } + + /** + * 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.atError() + .log(new IllegalArgumentException( + "Missing required property resource in model SqlDatabaseCreateUpdateProperties")); + } else { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlDatabaseCreateUpdateProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("resource", this.resource); + jsonWriter.writeJsonField("options", this.options); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlDatabaseCreateUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlDatabaseCreateUpdateProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlDatabaseCreateUpdateProperties. + */ + public static SqlDatabaseCreateUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlDatabaseCreateUpdateProperties deserializedSqlDatabaseCreateUpdateProperties + = new SqlDatabaseCreateUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resource".equals(fieldName)) { + deserializedSqlDatabaseCreateUpdateProperties.resource = SqlDatabaseResource.fromJson(reader); + } else if ("options".equals(fieldName)) { + deserializedSqlDatabaseCreateUpdateProperties.options = CreateUpdateOptions.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlDatabaseCreateUpdateProperties; + }); + } +} 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..0f42161e33e84 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlDatabaseGetProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.SqlDatabaseGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.SqlDatabaseGetPropertiesResource; +import java.io.IOException; + +/** + * The properties of an Azure Cosmos DB SQL database. + */ +@Fluent +public final class SqlDatabaseGetProperties implements JsonSerializable { + /* + * The resource property. + */ + private SqlDatabaseGetPropertiesResource resource; + + /* + * The options property. + */ + private SqlDatabaseGetPropertiesOptions options; + + /** + * Creates an instance of SqlDatabaseGetProperties class. + */ + public SqlDatabaseGetProperties() { + } + + /** + * 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("resource", this.resource); + jsonWriter.writeJsonField("options", this.options); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlDatabaseGetProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlDatabaseGetProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlDatabaseGetProperties. + */ + public static SqlDatabaseGetProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlDatabaseGetProperties deserializedSqlDatabaseGetProperties = new SqlDatabaseGetProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resource".equals(fieldName)) { + deserializedSqlDatabaseGetProperties.resource = SqlDatabaseGetPropertiesResource.fromJson(reader); + } else if ("options".equals(fieldName)) { + deserializedSqlDatabaseGetProperties.options = SqlDatabaseGetPropertiesOptions.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlDatabaseGetProperties; + }); + } +} 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..d44f9ac03b846 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlDatabaseGetResultsInner.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.SqlDatabaseGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.SqlDatabaseGetPropertiesResource; +import java.io.IOException; +import java.util.Map; + +/** + * An Azure Cosmos DB SQL database. + */ +@Fluent +public final class SqlDatabaseGetResultsInner extends ArmResourceProperties { + /* + * The properties of an Azure Cosmos DB SQL database + */ + private SqlDatabaseGetProperties innerProperties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of SqlDatabaseGetResultsInner class. + */ + public SqlDatabaseGetResultsInner() { + } + + /** + * Get the innerProperties property: The properties of an Azure Cosmos DB SQL database. + * + * @return the innerProperties value. + */ + private SqlDatabaseGetProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@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() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlDatabaseGetResultsInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlDatabaseGetResultsInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlDatabaseGetResultsInner. + */ + public static SqlDatabaseGetResultsInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlDatabaseGetResultsInner deserializedSqlDatabaseGetResultsInner = new SqlDatabaseGetResultsInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSqlDatabaseGetResultsInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSqlDatabaseGetResultsInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSqlDatabaseGetResultsInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedSqlDatabaseGetResultsInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedSqlDatabaseGetResultsInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedSqlDatabaseGetResultsInner.innerProperties = SqlDatabaseGetProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlDatabaseGetResultsInner; + }); + } +} 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..1176f9c143524 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlRoleAssignmentGetResultsInner.java @@ -0,0 +1,215 @@ +// Copyright (c) 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.ArmProxyResource; +import java.io.IOException; + +/** + * An Azure Cosmos DB Role Assignment. + */ +@Fluent +public final class SqlRoleAssignmentGetResultsInner extends ArmProxyResource { + /* + * Properties related to the Role Assignment. + */ + private SqlRoleAssignmentResource innerProperties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of SqlRoleAssignmentGetResultsInner class. + */ + public SqlRoleAssignmentGetResultsInner() { + } + + /** + * Get the innerProperties property: Properties related to the Role Assignment. + * + * @return the innerProperties value. + */ + private SqlRoleAssignmentResource innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * 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() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlRoleAssignmentGetResultsInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlRoleAssignmentGetResultsInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlRoleAssignmentGetResultsInner. + */ + public static SqlRoleAssignmentGetResultsInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlRoleAssignmentGetResultsInner deserializedSqlRoleAssignmentGetResultsInner + = new SqlRoleAssignmentGetResultsInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSqlRoleAssignmentGetResultsInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSqlRoleAssignmentGetResultsInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSqlRoleAssignmentGetResultsInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedSqlRoleAssignmentGetResultsInner.innerProperties + = SqlRoleAssignmentResource.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlRoleAssignmentGetResultsInner; + }); + } +} 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..7010efecddaac --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlRoleAssignmentResource.java @@ -0,0 +1,156 @@ +// Copyright (c) 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Azure Cosmos DB SQL Role Assignment resource object. + */ +@Fluent +public final class SqlRoleAssignmentResource implements JsonSerializable { + /* + * The unique identifier for the associated Role Definition. + */ + private String roleDefinitionId; + + /* + * The data plane resource path for which access is being granted through this Role Assignment. + */ + 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. + */ + private String principalId; + + /** + * Creates an instance of SqlRoleAssignmentResource class. + */ + public SqlRoleAssignmentResource() { + } + + /** + * 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("roleDefinitionId", this.roleDefinitionId); + jsonWriter.writeStringField("scope", this.scope); + jsonWriter.writeStringField("principalId", this.principalId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlRoleAssignmentResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlRoleAssignmentResource if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlRoleAssignmentResource. + */ + public static SqlRoleAssignmentResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlRoleAssignmentResource deserializedSqlRoleAssignmentResource = new SqlRoleAssignmentResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("roleDefinitionId".equals(fieldName)) { + deserializedSqlRoleAssignmentResource.roleDefinitionId = reader.getString(); + } else if ("scope".equals(fieldName)) { + deserializedSqlRoleAssignmentResource.scope = reader.getString(); + } else if ("principalId".equals(fieldName)) { + deserializedSqlRoleAssignmentResource.principalId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlRoleAssignmentResource; + }); + } +} 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..e3a307fb3e868 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlRoleDefinitionGetResultsInner.java @@ -0,0 +1,243 @@ +// Copyright (c) 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +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 java.io.IOException; +import java.util.List; + +/** + * An Azure Cosmos DB SQL Role Definition. + */ +@Fluent +public final class SqlRoleDefinitionGetResultsInner extends ArmProxyResource { + /* + * Properties related to the Role Definition. + */ + private SqlRoleDefinitionResource innerProperties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of SqlRoleDefinitionGetResultsInner class. + */ + public SqlRoleDefinitionGetResultsInner() { + } + + /** + * Get the innerProperties property: Properties related to the Role Definition. + * + * @return the innerProperties value. + */ + private SqlRoleDefinitionResource innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * 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() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlRoleDefinitionGetResultsInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlRoleDefinitionGetResultsInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlRoleDefinitionGetResultsInner. + */ + public static SqlRoleDefinitionGetResultsInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlRoleDefinitionGetResultsInner deserializedSqlRoleDefinitionGetResultsInner + = new SqlRoleDefinitionGetResultsInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSqlRoleDefinitionGetResultsInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSqlRoleDefinitionGetResultsInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSqlRoleDefinitionGetResultsInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedSqlRoleDefinitionGetResultsInner.innerProperties + = SqlRoleDefinitionResource.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlRoleDefinitionGetResultsInner; + }); + } +} 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..7d2846f870f09 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlRoleDefinitionResource.java @@ -0,0 +1,197 @@ +// Copyright (c) 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.Permission; +import com.azure.resourcemanager.cosmos.generated.models.RoleDefinitionType; +import java.io.IOException; +import java.util.List; + +/** + * Azure Cosmos DB SQL Role Definition resource object. + */ +@Fluent +public final class SqlRoleDefinitionResource implements JsonSerializable { + /* + * A user-friendly name for the Role Definition. Must be unique for the database account. + */ + private String roleName; + + /* + * Indicates whether the Role Definition was built-in or user created. + */ + 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. + */ + private List assignableScopes; + + /* + * The set of operations allowed through this Role Definition. + */ + private List permissions; + + /** + * Creates an instance of SqlRoleDefinitionResource class. + */ + public SqlRoleDefinitionResource() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("roleName", this.roleName); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeArrayField("assignableScopes", this.assignableScopes, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("permissions", this.permissions, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlRoleDefinitionResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlRoleDefinitionResource if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlRoleDefinitionResource. + */ + public static SqlRoleDefinitionResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlRoleDefinitionResource deserializedSqlRoleDefinitionResource = new SqlRoleDefinitionResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("roleName".equals(fieldName)) { + deserializedSqlRoleDefinitionResource.roleName = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSqlRoleDefinitionResource.type = RoleDefinitionType.fromString(reader.getString()); + } else if ("assignableScopes".equals(fieldName)) { + List assignableScopes = reader.readArray(reader1 -> reader1.getString()); + deserializedSqlRoleDefinitionResource.assignableScopes = assignableScopes; + } else if ("permissions".equals(fieldName)) { + List permissions = reader.readArray(reader1 -> Permission.fromJson(reader1)); + deserializedSqlRoleDefinitionResource.permissions = permissions; + } else { + reader.skipChildren(); + } + } + + return deserializedSqlRoleDefinitionResource; + }); + } +} 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..692c505516957 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlStoredProcedureCreateUpdateProperties.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.SqlStoredProcedureResource; +import java.io.IOException; + +/** + * Properties to create and update Azure Cosmos DB storedProcedure. + */ +@Fluent +public final class SqlStoredProcedureCreateUpdateProperties + implements JsonSerializable { + /* + * The standard JSON format of a storedProcedure + */ + private SqlStoredProcedureResource resource; + + /* + * A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + */ + private CreateUpdateOptions options; + + /** + * Creates an instance of SqlStoredProcedureCreateUpdateProperties class. + */ + public SqlStoredProcedureCreateUpdateProperties() { + } + + /** + * 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.atError() + .log(new IllegalArgumentException( + "Missing required property resource in model SqlStoredProcedureCreateUpdateProperties")); + } else { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlStoredProcedureCreateUpdateProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("resource", this.resource); + jsonWriter.writeJsonField("options", this.options); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlStoredProcedureCreateUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlStoredProcedureCreateUpdateProperties if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlStoredProcedureCreateUpdateProperties. + */ + public static SqlStoredProcedureCreateUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlStoredProcedureCreateUpdateProperties deserializedSqlStoredProcedureCreateUpdateProperties + = new SqlStoredProcedureCreateUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resource".equals(fieldName)) { + deserializedSqlStoredProcedureCreateUpdateProperties.resource + = SqlStoredProcedureResource.fromJson(reader); + } else if ("options".equals(fieldName)) { + deserializedSqlStoredProcedureCreateUpdateProperties.options = CreateUpdateOptions.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlStoredProcedureCreateUpdateProperties; + }); + } +} 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..9cdd1b83103a4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlStoredProcedureGetProperties.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.SqlStoredProcedureGetPropertiesResource; +import java.io.IOException; + +/** + * The properties of an Azure Cosmos DB StoredProcedure. + */ +@Fluent +public final class SqlStoredProcedureGetProperties implements JsonSerializable { + /* + * The resource property. + */ + private SqlStoredProcedureGetPropertiesResource resource; + + /** + * Creates an instance of SqlStoredProcedureGetProperties class. + */ + public SqlStoredProcedureGetProperties() { + } + + /** + * 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("resource", this.resource); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlStoredProcedureGetProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlStoredProcedureGetProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlStoredProcedureGetProperties. + */ + public static SqlStoredProcedureGetProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlStoredProcedureGetProperties deserializedSqlStoredProcedureGetProperties + = new SqlStoredProcedureGetProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resource".equals(fieldName)) { + deserializedSqlStoredProcedureGetProperties.resource + = SqlStoredProcedureGetPropertiesResource.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlStoredProcedureGetProperties; + }); + } +} 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..1f947c2046ca2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlStoredProcedureGetResultsInner.java @@ -0,0 +1,190 @@ +// Copyright (c) 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.SqlStoredProcedureGetPropertiesResource; +import java.io.IOException; +import java.util.Map; + +/** + * An Azure Cosmos DB storedProcedure. + */ +@Fluent +public final class SqlStoredProcedureGetResultsInner extends ArmResourceProperties { + /* + * The properties of an Azure Cosmos DB storedProcedure + */ + private SqlStoredProcedureGetProperties innerProperties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of SqlStoredProcedureGetResultsInner class. + */ + public SqlStoredProcedureGetResultsInner() { + } + + /** + * Get the innerProperties property: The properties of an Azure Cosmos DB storedProcedure. + * + * @return the innerProperties value. + */ + private SqlStoredProcedureGetProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@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() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlStoredProcedureGetResultsInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlStoredProcedureGetResultsInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlStoredProcedureGetResultsInner. + */ + public static SqlStoredProcedureGetResultsInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlStoredProcedureGetResultsInner deserializedSqlStoredProcedureGetResultsInner + = new SqlStoredProcedureGetResultsInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSqlStoredProcedureGetResultsInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSqlStoredProcedureGetResultsInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSqlStoredProcedureGetResultsInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedSqlStoredProcedureGetResultsInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedSqlStoredProcedureGetResultsInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedSqlStoredProcedureGetResultsInner.innerProperties + = SqlStoredProcedureGetProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlStoredProcedureGetResultsInner; + }); + } +} 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..7bc17da62df27 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlTriggerCreateUpdateProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.SqlTriggerResource; +import java.io.IOException; + +/** + * Properties to create and update Azure Cosmos DB trigger. + */ +@Fluent +public final class SqlTriggerCreateUpdateProperties implements JsonSerializable { + /* + * The standard JSON format of a trigger + */ + private SqlTriggerResource resource; + + /* + * A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + */ + private CreateUpdateOptions options; + + /** + * Creates an instance of SqlTriggerCreateUpdateProperties class. + */ + public SqlTriggerCreateUpdateProperties() { + } + + /** + * 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.atError() + .log(new IllegalArgumentException( + "Missing required property resource in model SqlTriggerCreateUpdateProperties")); + } else { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlTriggerCreateUpdateProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("resource", this.resource); + jsonWriter.writeJsonField("options", this.options); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlTriggerCreateUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlTriggerCreateUpdateProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlTriggerCreateUpdateProperties. + */ + public static SqlTriggerCreateUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlTriggerCreateUpdateProperties deserializedSqlTriggerCreateUpdateProperties + = new SqlTriggerCreateUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resource".equals(fieldName)) { + deserializedSqlTriggerCreateUpdateProperties.resource = SqlTriggerResource.fromJson(reader); + } else if ("options".equals(fieldName)) { + deserializedSqlTriggerCreateUpdateProperties.options = CreateUpdateOptions.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlTriggerCreateUpdateProperties; + }); + } +} 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..6e606802a0204 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlTriggerGetProperties.java @@ -0,0 +1,97 @@ +// Copyright (c) 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.SqlTriggerGetPropertiesResource; +import java.io.IOException; + +/** + * The properties of an Azure Cosmos DB trigger. + */ +@Fluent +public final class SqlTriggerGetProperties implements JsonSerializable { + /* + * The resource property. + */ + private SqlTriggerGetPropertiesResource resource; + + /** + * Creates an instance of SqlTriggerGetProperties class. + */ + public SqlTriggerGetProperties() { + } + + /** + * 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("resource", this.resource); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlTriggerGetProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlTriggerGetProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlTriggerGetProperties. + */ + public static SqlTriggerGetProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlTriggerGetProperties deserializedSqlTriggerGetProperties = new SqlTriggerGetProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resource".equals(fieldName)) { + deserializedSqlTriggerGetProperties.resource = SqlTriggerGetPropertiesResource.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlTriggerGetProperties; + }); + } +} 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..28adab3403e6c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlTriggerGetResultsInner.java @@ -0,0 +1,188 @@ +// Copyright (c) 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.SqlTriggerGetPropertiesResource; +import java.io.IOException; +import java.util.Map; + +/** + * An Azure Cosmos DB trigger. + */ +@Fluent +public final class SqlTriggerGetResultsInner extends ArmResourceProperties { + /* + * The properties of an Azure Cosmos DB trigger + */ + private SqlTriggerGetProperties innerProperties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of SqlTriggerGetResultsInner class. + */ + public SqlTriggerGetResultsInner() { + } + + /** + * Get the innerProperties property: The properties of an Azure Cosmos DB trigger. + * + * @return the innerProperties value. + */ + private SqlTriggerGetProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@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() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlTriggerGetResultsInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlTriggerGetResultsInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlTriggerGetResultsInner. + */ + public static SqlTriggerGetResultsInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlTriggerGetResultsInner deserializedSqlTriggerGetResultsInner = new SqlTriggerGetResultsInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSqlTriggerGetResultsInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSqlTriggerGetResultsInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSqlTriggerGetResultsInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedSqlTriggerGetResultsInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedSqlTriggerGetResultsInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedSqlTriggerGetResultsInner.innerProperties = SqlTriggerGetProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlTriggerGetResultsInner; + }); + } +} 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..9d829016d1a26 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlUserDefinedFunctionCreateUpdateProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.SqlUserDefinedFunctionResource; +import java.io.IOException; + +/** + * Properties to create and update Azure Cosmos DB userDefinedFunction. + */ +@Fluent +public final class SqlUserDefinedFunctionCreateUpdateProperties + implements JsonSerializable { + /* + * The standard JSON format of a userDefinedFunction + */ + private SqlUserDefinedFunctionResource resource; + + /* + * A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + */ + private CreateUpdateOptions options; + + /** + * Creates an instance of SqlUserDefinedFunctionCreateUpdateProperties class. + */ + public SqlUserDefinedFunctionCreateUpdateProperties() { + } + + /** + * 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.atError() + .log(new IllegalArgumentException( + "Missing required property resource in model SqlUserDefinedFunctionCreateUpdateProperties")); + } else { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlUserDefinedFunctionCreateUpdateProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("resource", this.resource); + jsonWriter.writeJsonField("options", this.options); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlUserDefinedFunctionCreateUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlUserDefinedFunctionCreateUpdateProperties if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlUserDefinedFunctionCreateUpdateProperties. + */ + public static SqlUserDefinedFunctionCreateUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlUserDefinedFunctionCreateUpdateProperties deserializedSqlUserDefinedFunctionCreateUpdateProperties + = new SqlUserDefinedFunctionCreateUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resource".equals(fieldName)) { + deserializedSqlUserDefinedFunctionCreateUpdateProperties.resource + = SqlUserDefinedFunctionResource.fromJson(reader); + } else if ("options".equals(fieldName)) { + deserializedSqlUserDefinedFunctionCreateUpdateProperties.options + = CreateUpdateOptions.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlUserDefinedFunctionCreateUpdateProperties; + }); + } +} 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..17296c0082f9c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlUserDefinedFunctionGetProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.SqlUserDefinedFunctionGetPropertiesResource; +import java.io.IOException; + +/** + * The properties of an Azure Cosmos DB userDefinedFunction. + */ +@Fluent +public final class SqlUserDefinedFunctionGetProperties + implements JsonSerializable { + /* + * The resource property. + */ + private SqlUserDefinedFunctionGetPropertiesResource resource; + + /** + * Creates an instance of SqlUserDefinedFunctionGetProperties class. + */ + public SqlUserDefinedFunctionGetProperties() { + } + + /** + * 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("resource", this.resource); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlUserDefinedFunctionGetProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlUserDefinedFunctionGetProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlUserDefinedFunctionGetProperties. + */ + public static SqlUserDefinedFunctionGetProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlUserDefinedFunctionGetProperties deserializedSqlUserDefinedFunctionGetProperties + = new SqlUserDefinedFunctionGetProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resource".equals(fieldName)) { + deserializedSqlUserDefinedFunctionGetProperties.resource + = SqlUserDefinedFunctionGetPropertiesResource.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlUserDefinedFunctionGetProperties; + }); + } +} 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..d036c56b6c1ae --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlUserDefinedFunctionGetResultsInner.java @@ -0,0 +1,190 @@ +// Copyright (c) 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.SqlUserDefinedFunctionGetPropertiesResource; +import java.io.IOException; +import java.util.Map; + +/** + * An Azure Cosmos DB userDefinedFunction. + */ +@Fluent +public final class SqlUserDefinedFunctionGetResultsInner extends ArmResourceProperties { + /* + * The properties of an Azure Cosmos DB userDefinedFunction + */ + private SqlUserDefinedFunctionGetProperties innerProperties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of SqlUserDefinedFunctionGetResultsInner class. + */ + public SqlUserDefinedFunctionGetResultsInner() { + } + + /** + * Get the innerProperties property: The properties of an Azure Cosmos DB userDefinedFunction. + * + * @return the innerProperties value. + */ + private SqlUserDefinedFunctionGetProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@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() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlUserDefinedFunctionGetResultsInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlUserDefinedFunctionGetResultsInner if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlUserDefinedFunctionGetResultsInner. + */ + public static SqlUserDefinedFunctionGetResultsInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlUserDefinedFunctionGetResultsInner deserializedSqlUserDefinedFunctionGetResultsInner + = new SqlUserDefinedFunctionGetResultsInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSqlUserDefinedFunctionGetResultsInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSqlUserDefinedFunctionGetResultsInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSqlUserDefinedFunctionGetResultsInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedSqlUserDefinedFunctionGetResultsInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedSqlUserDefinedFunctionGetResultsInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedSqlUserDefinedFunctionGetResultsInner.innerProperties + = SqlUserDefinedFunctionGetProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlUserDefinedFunctionGetResultsInner; + }); + } +} 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..7b669f19b1a70 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/TableCreateUpdateProperties.java @@ -0,0 +1,139 @@ +// Copyright (c) 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.TableResource; +import java.io.IOException; + +/** + * Properties to create and update Azure Cosmos DB Table. + */ +@Fluent +public final class TableCreateUpdateProperties implements JsonSerializable { + /* + * The standard JSON format of a Table + */ + private TableResource resource; + + /* + * A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + */ + private CreateUpdateOptions options; + + /** + * Creates an instance of TableCreateUpdateProperties class. + */ + public TableCreateUpdateProperties() { + } + + /** + * 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.atError() + .log(new IllegalArgumentException( + "Missing required property resource in model TableCreateUpdateProperties")); + } else { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(TableCreateUpdateProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("resource", this.resource); + jsonWriter.writeJsonField("options", this.options); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TableCreateUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TableCreateUpdateProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TableCreateUpdateProperties. + */ + public static TableCreateUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TableCreateUpdateProperties deserializedTableCreateUpdateProperties = new TableCreateUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resource".equals(fieldName)) { + deserializedTableCreateUpdateProperties.resource = TableResource.fromJson(reader); + } else if ("options".equals(fieldName)) { + deserializedTableCreateUpdateProperties.options = CreateUpdateOptions.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedTableCreateUpdateProperties; + }); + } +} 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..981de2e0a37dc --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/TableGetProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.TableGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.TableGetPropertiesResource; +import java.io.IOException; + +/** + * The properties of an Azure Cosmos Table. + */ +@Fluent +public final class TableGetProperties implements JsonSerializable { + /* + * The resource property. + */ + private TableGetPropertiesResource resource; + + /* + * The options property. + */ + private TableGetPropertiesOptions options; + + /** + * Creates an instance of TableGetProperties class. + */ + public TableGetProperties() { + } + + /** + * 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("resource", this.resource); + jsonWriter.writeJsonField("options", this.options); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TableGetProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TableGetProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the TableGetProperties. + */ + public static TableGetProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TableGetProperties deserializedTableGetProperties = new TableGetProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resource".equals(fieldName)) { + deserializedTableGetProperties.resource = TableGetPropertiesResource.fromJson(reader); + } else if ("options".equals(fieldName)) { + deserializedTableGetProperties.options = TableGetPropertiesOptions.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedTableGetProperties; + }); + } +} 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..a68dc6b096fbd --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/TableGetResultsInner.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.TableGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.TableGetPropertiesResource; +import java.io.IOException; +import java.util.Map; + +/** + * An Azure Cosmos DB Table. + */ +@Fluent +public final class TableGetResultsInner extends ArmResourceProperties { + /* + * The properties of an Azure Cosmos DB Table + */ + private TableGetProperties innerProperties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of TableGetResultsInner class. + */ + public TableGetResultsInner() { + } + + /** + * Get the innerProperties property: The properties of an Azure Cosmos DB Table. + * + * @return the innerProperties value. + */ + private TableGetProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@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() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TableGetResultsInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TableGetResultsInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TableGetResultsInner. + */ + public static TableGetResultsInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TableGetResultsInner deserializedTableGetResultsInner = new TableGetResultsInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedTableGetResultsInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedTableGetResultsInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedTableGetResultsInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedTableGetResultsInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedTableGetResultsInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedTableGetResultsInner.innerProperties = TableGetProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedTableGetResultsInner; + }); + } +} 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..f817b5febea5b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ThroughputSettingsGetProperties.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsGetPropertiesResource; +import java.io.IOException; + +/** + * The properties of an Azure Cosmos DB resource throughput. + */ +@Fluent +public final class ThroughputSettingsGetProperties implements JsonSerializable { + /* + * The resource property. + */ + private ThroughputSettingsGetPropertiesResource resource; + + /** + * Creates an instance of ThroughputSettingsGetProperties class. + */ + public ThroughputSettingsGetProperties() { + } + + /** + * 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("resource", this.resource); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ThroughputSettingsGetProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ThroughputSettingsGetProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ThroughputSettingsGetProperties. + */ + public static ThroughputSettingsGetProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ThroughputSettingsGetProperties deserializedThroughputSettingsGetProperties + = new ThroughputSettingsGetProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resource".equals(fieldName)) { + deserializedThroughputSettingsGetProperties.resource + = ThroughputSettingsGetPropertiesResource.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedThroughputSettingsGetProperties; + }); + } +} 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..cb741f35f5f79 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ThroughputSettingsGetResultsInner.java @@ -0,0 +1,190 @@ +// Copyright (c) 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsGetPropertiesResource; +import java.io.IOException; +import java.util.Map; + +/** + * An Azure Cosmos DB resource throughput. + */ +@Fluent +public final class ThroughputSettingsGetResultsInner extends ArmResourceProperties { + /* + * The properties of an Azure Cosmos DB resource throughput + */ + private ThroughputSettingsGetProperties innerProperties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ThroughputSettingsGetResultsInner class. + */ + public ThroughputSettingsGetResultsInner() { + } + + /** + * Get the innerProperties property: The properties of an Azure Cosmos DB resource throughput. + * + * @return the innerProperties value. + */ + private ThroughputSettingsGetProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@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() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ThroughputSettingsGetResultsInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ThroughputSettingsGetResultsInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ThroughputSettingsGetResultsInner. + */ + public static ThroughputSettingsGetResultsInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ThroughputSettingsGetResultsInner deserializedThroughputSettingsGetResultsInner + = new ThroughputSettingsGetResultsInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedThroughputSettingsGetResultsInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedThroughputSettingsGetResultsInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedThroughputSettingsGetResultsInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedThroughputSettingsGetResultsInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedThroughputSettingsGetResultsInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedThroughputSettingsGetResultsInner.innerProperties + = ThroughputSettingsGetProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedThroughputSettingsGetResultsInner; + }); + } +} 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..b76ca1dd91540 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ThroughputSettingsUpdateProperties.java @@ -0,0 +1,107 @@ +// Copyright (c) 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsResource; +import java.io.IOException; + +/** + * Properties to update Azure Cosmos DB resource throughput. + */ +@Fluent +public final class ThroughputSettingsUpdateProperties implements JsonSerializable { + /* + * The standard JSON format of a resource throughput + */ + private ThroughputSettingsResource resource; + + /** + * Creates an instance of ThroughputSettingsUpdateProperties class. + */ + public ThroughputSettingsUpdateProperties() { + } + + /** + * 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.atError() + .log(new IllegalArgumentException( + "Missing required property resource in model ThroughputSettingsUpdateProperties")); + } else { + resource().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ThroughputSettingsUpdateProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("resource", this.resource); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ThroughputSettingsUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ThroughputSettingsUpdateProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ThroughputSettingsUpdateProperties. + */ + public static ThroughputSettingsUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ThroughputSettingsUpdateProperties deserializedThroughputSettingsUpdateProperties + = new ThroughputSettingsUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resource".equals(fieldName)) { + deserializedThroughputSettingsUpdateProperties.resource + = ThroughputSettingsResource.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedThroughputSettingsUpdateProperties; + }); + } +} 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..e134bb1855cfb --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/UsageInner.java @@ -0,0 +1,205 @@ +// Copyright (c) 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.models.MetricName; +import com.azure.resourcemanager.cosmos.generated.models.UnitType; +import java.io.IOException; + +/** + * The usage data for a usage request. + */ +@Immutable +public class UsageInner implements JsonSerializable { + /* + * The unit of the metric. + */ + private UnitType unit; + + /* + * The name information for the metric. + */ + private MetricName name; + + /* + * The quota period used to summarize the usage values. + */ + private String quotaPeriod; + + /* + * Maximum value for this metric + */ + private Long limit; + + /* + * Current value for this metric + */ + private Long currentValue; + + /** + * Creates an instance of UsageInner class. + */ + public UsageInner() { + } + + /** + * Get the unit property: The unit of the metric. + * + * @return the unit value. + */ + public UnitType unit() { + return this.unit; + } + + /** + * Set the unit property: The unit of the metric. + * + * @param unit the unit value to set. + * @return the UsageInner object itself. + */ + UsageInner withUnit(UnitType unit) { + this.unit = unit; + return this; + } + + /** + * Get the name property: The name information for the metric. + * + * @return the name value. + */ + public MetricName name() { + return this.name; + } + + /** + * Set the name property: The name information for the metric. + * + * @param name the name value to set. + * @return the UsageInner object itself. + */ + UsageInner withName(MetricName name) { + this.name = name; + return this; + } + + /** + * Get the quotaPeriod property: The quota period used to summarize the usage values. + * + * @return the quotaPeriod value. + */ + public String quotaPeriod() { + return this.quotaPeriod; + } + + /** + * Set the quotaPeriod property: The quota period used to summarize the usage values. + * + * @param quotaPeriod the quotaPeriod value to set. + * @return the UsageInner object itself. + */ + UsageInner withQuotaPeriod(String quotaPeriod) { + this.quotaPeriod = quotaPeriod; + return this; + } + + /** + * Get the limit property: Maximum value for this metric. + * + * @return the limit value. + */ + public Long limit() { + return this.limit; + } + + /** + * Set the limit property: Maximum value for this metric. + * + * @param limit the limit value to set. + * @return the UsageInner object itself. + */ + UsageInner withLimit(Long limit) { + this.limit = limit; + return this; + } + + /** + * Get the currentValue property: Current value for this metric. + * + * @return the currentValue value. + */ + public Long currentValue() { + return this.currentValue; + } + + /** + * Set the currentValue property: Current value for this metric. + * + * @param currentValue the currentValue value to set. + * @return the UsageInner object itself. + */ + UsageInner withCurrentValue(Long currentValue) { + this.currentValue = currentValue; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() != null) { + name().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UsageInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UsageInner if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the UsageInner. + */ + public static UsageInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UsageInner deserializedUsageInner = new UsageInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("unit".equals(fieldName)) { + deserializedUsageInner.unit = UnitType.fromString(reader.getString()); + } else if ("name".equals(fieldName)) { + deserializedUsageInner.name = MetricName.fromJson(reader); + } else if ("quotaPeriod".equals(fieldName)) { + deserializedUsageInner.quotaPeriod = reader.getString(); + } else if ("limit".equals(fieldName)) { + deserializedUsageInner.limit = reader.getNullable(JsonReader::getLong); + } else if ("currentValue".equals(fieldName)) { + deserializedUsageInner.currentValue = reader.getNullable(JsonReader::getLong); + } else { + reader.skipChildren(); + } + } + + return deserializedUsageInner; + }); + } +} 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..1c6469e13b650 --- /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..13e5ac58d8f00 --- /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..df476f6f6b472 --- /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/CassandraClusterPublicStatusImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraClusterPublicStatusImpl.java new file mode 100644 index 0000000000000..28c462ea51b01 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraClusterPublicStatusImpl.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.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.CassandraClusterPublicStatusInner; +import com.azure.resourcemanager.cosmos.generated.models.CassandraClusterPublicStatus; +import com.azure.resourcemanager.cosmos.generated.models.CassandraClusterPublicStatusDataCentersItem; +import com.azure.resourcemanager.cosmos.generated.models.CassandraError; +import com.azure.resourcemanager.cosmos.generated.models.ConnectionError; +import com.azure.resourcemanager.cosmos.generated.models.ManagedCassandraReaperStatus; +import java.util.Collections; +import java.util.List; + +public final class CassandraClusterPublicStatusImpl implements CassandraClusterPublicStatus { + private CassandraClusterPublicStatusInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + CassandraClusterPublicStatusImpl(CassandraClusterPublicStatusInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String etag() { + return this.innerModel().etag(); + } + + public ManagedCassandraReaperStatus reaperStatus() { + return this.innerModel().reaperStatus(); + } + + public List connectionErrors() { + List inner = this.innerModel().connectionErrors(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List errors() { + List inner = this.innerModel().errors(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List dataCenters() { + List inner = this.innerModel().dataCenters(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public CassandraClusterPublicStatusInner 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..8bc35d6ee710e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraClustersClientImpl.java @@ -0,0 +1,1984 @@ +// Copyright (c) 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.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.CassandraClusterPublicStatusInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ClusterResourceInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.CommandOutputInner; +import com.azure.resourcemanager.cosmos.generated.models.CommandPostBody; +import com.azure.resourcemanager.cosmos.generated.models.ListClusters; +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 { + /** + * 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") + public 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}/invokeCommand") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> invokeCommand(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("clusterName") String clusterName, + @QueryParam("api-version") String apiVersion, @BodyParam("application/json") CommandPostBody body, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/deallocate") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> deallocate(@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" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/start") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> start(@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}/status") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> status(@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); + } + + /** + * 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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String clusterName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, clusterName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, String clusterName, + Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, clusterName, context).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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 getByResourceGroupWithResponse(resourceGroupName, clusterName, Context.NONE).getValue(); + } + + /** + * 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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link PollerFlux} for polling of long-running operation. + */ + @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, + this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String clusterName) { + return this.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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String clusterName, + Context context) { + return this.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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of representation of a managed Cassandra cluster. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ClusterResourceInner> + beginCreateUpdate(String resourceGroupName, String clusterName, ClusterResourceInner body) { + return this.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 the {@link SyncPoller} for polling of 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 this.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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of representation of a managed Cassandra cluster. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ClusterResourceInner> beginUpdate(String resourceGroupName, + String clusterName, ClusterResourceInner body) { + return this.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 the {@link SyncPoller} for polling of 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 this.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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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(); + } + + /** + * Invoke a command like nodetool for cassandra maintenance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body Specification which command to run where. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of /command api along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> invokeCommandWithResponseAsync(String resourceGroupName, + String clusterName, CommandPostBody 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.invokeCommand(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, clusterName, this.client.getApiVersion(), body, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Invoke a command like nodetool for cassandra maintenance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body Specification which command to run where. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of /command api along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> invokeCommandWithResponseAsync(String resourceGroupName, + String clusterName, CommandPostBody 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.invokeCommand(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + clusterName, this.client.getApiVersion(), body, accept, context); + } + + /** + * Invoke a command like nodetool for cassandra maintenance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body Specification which command to run where. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of response of /command api. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CommandOutputInner> + beginInvokeCommandAsync(String resourceGroupName, String clusterName, CommandPostBody body) { + Mono>> mono = invokeCommandWithResponseAsync(resourceGroupName, clusterName, body); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + CommandOutputInner.class, CommandOutputInner.class, this.client.getContext()); + } + + /** + * Invoke a command like nodetool for cassandra maintenance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body Specification which command to run where. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of response of /command api. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CommandOutputInner> + beginInvokeCommandAsync(String resourceGroupName, String clusterName, CommandPostBody body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = invokeCommandWithResponseAsync(resourceGroupName, clusterName, body, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + CommandOutputInner.class, CommandOutputInner.class, context); + } + + /** + * Invoke a command like nodetool for cassandra maintenance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body Specification which command to run where. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of response of /command api. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CommandOutputInner> beginInvokeCommand(String resourceGroupName, + String clusterName, CommandPostBody body) { + return this.beginInvokeCommandAsync(resourceGroupName, clusterName, body).getSyncPoller(); + } + + /** + * Invoke a command like nodetool for cassandra maintenance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body Specification which command to run where. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of response of /command api. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CommandOutputInner> beginInvokeCommand(String resourceGroupName, + String clusterName, CommandPostBody body, Context context) { + return this.beginInvokeCommandAsync(resourceGroupName, clusterName, body, context).getSyncPoller(); + } + + /** + * Invoke a command like nodetool for cassandra maintenance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body Specification which command to run where. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of /command api on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono invokeCommandAsync(String resourceGroupName, String clusterName, + CommandPostBody body) { + return beginInvokeCommandAsync(resourceGroupName, clusterName, body).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Invoke a command like nodetool for cassandra maintenance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body Specification which command to run where. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of /command api on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono invokeCommandAsync(String resourceGroupName, String clusterName, + CommandPostBody body, Context context) { + return beginInvokeCommandAsync(resourceGroupName, clusterName, body, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Invoke a command like nodetool for cassandra maintenance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body Specification which command to run where. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of /command api. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CommandOutputInner invokeCommand(String resourceGroupName, String clusterName, CommandPostBody body) { + return invokeCommandAsync(resourceGroupName, clusterName, body).block(); + } + + /** + * Invoke a command like nodetool for cassandra maintenance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body Specification which command to run where. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of /command api. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CommandOutputInner invokeCommand(String resourceGroupName, String clusterName, CommandPostBody body, + Context context) { + return invokeCommandAsync(resourceGroupName, clusterName, body, context).block(); + } + + /** + * Deallocate the Managed Cassandra Cluster and Associated Data Centers. Deallocation will deallocate the host + * virtual machine of this cluster, and reserved the data disk. This won't do anything on an already deallocated + * cluster. Use Start to restart the 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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deallocateWithResponseAsync(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.deallocate(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, clusterName, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deallocate the Managed Cassandra Cluster and Associated Data Centers. Deallocation will deallocate the host + * virtual machine of this cluster, and reserved the data disk. This won't do anything on an already deallocated + * cluster. Use Start to restart the 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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deallocateWithResponseAsync(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.deallocate(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + clusterName, this.client.getApiVersion(), accept, context); + } + + /** + * Deallocate the Managed Cassandra Cluster and Associated Data Centers. Deallocation will deallocate the host + * virtual machine of this cluster, and reserved the data disk. This won't do anything on an already deallocated + * cluster. Use Start to restart the 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeallocateAsync(String resourceGroupName, String clusterName) { + Mono>> mono = deallocateWithResponseAsync(resourceGroupName, clusterName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Deallocate the Managed Cassandra Cluster and Associated Data Centers. Deallocation will deallocate the host + * virtual machine of this cluster, and reserved the data disk. This won't do anything on an already deallocated + * cluster. Use Start to restart the 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeallocateAsync(String resourceGroupName, String clusterName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deallocateWithResponseAsync(resourceGroupName, clusterName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Deallocate the Managed Cassandra Cluster and Associated Data Centers. Deallocation will deallocate the host + * virtual machine of this cluster, and reserved the data disk. This won't do anything on an already deallocated + * cluster. Use Start to restart the 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeallocate(String resourceGroupName, String clusterName) { + return this.beginDeallocateAsync(resourceGroupName, clusterName).getSyncPoller(); + } + + /** + * Deallocate the Managed Cassandra Cluster and Associated Data Centers. Deallocation will deallocate the host + * virtual machine of this cluster, and reserved the data disk. This won't do anything on an already deallocated + * cluster. Use Start to restart the 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeallocate(String resourceGroupName, String clusterName, + Context context) { + return this.beginDeallocateAsync(resourceGroupName, clusterName, context).getSyncPoller(); + } + + /** + * Deallocate the Managed Cassandra Cluster and Associated Data Centers. Deallocation will deallocate the host + * virtual machine of this cluster, and reserved the data disk. This won't do anything on an already deallocated + * cluster. Use Start to restart the 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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deallocateAsync(String resourceGroupName, String clusterName) { + return beginDeallocateAsync(resourceGroupName, clusterName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deallocate the Managed Cassandra Cluster and Associated Data Centers. Deallocation will deallocate the host + * virtual machine of this cluster, and reserved the data disk. This won't do anything on an already deallocated + * cluster. Use Start to restart the 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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deallocateAsync(String resourceGroupName, String clusterName, Context context) { + return beginDeallocateAsync(resourceGroupName, clusterName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deallocate the Managed Cassandra Cluster and Associated Data Centers. Deallocation will deallocate the host + * virtual machine of this cluster, and reserved the data disk. This won't do anything on an already deallocated + * cluster. Use Start to restart the 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 deallocate(String resourceGroupName, String clusterName) { + deallocateAsync(resourceGroupName, clusterName).block(); + } + + /** + * Deallocate the Managed Cassandra Cluster and Associated Data Centers. Deallocation will deallocate the host + * virtual machine of this cluster, and reserved the data disk. This won't do anything on an already deallocated + * cluster. Use Start to restart the 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 deallocate(String resourceGroupName, String clusterName, Context context) { + deallocateAsync(resourceGroupName, clusterName, context).block(); + } + + /** + * Start the Managed Cassandra Cluster and Associated Data Centers. Start will start the host virtual machine of + * this cluster with reserved data disk. This won't do anything on an already running cluster. Use Deallocate to + * deallocate the 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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> startWithResponseAsync(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.start(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, clusterName, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Start the Managed Cassandra Cluster and Associated Data Centers. Start will start the host virtual machine of + * this cluster with reserved data disk. This won't do anything on an already running cluster. Use Deallocate to + * deallocate the 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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> startWithResponseAsync(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.start(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, clusterName, + this.client.getApiVersion(), accept, context); + } + + /** + * Start the Managed Cassandra Cluster and Associated Data Centers. Start will start the host virtual machine of + * this cluster with reserved data disk. This won't do anything on an already running cluster. Use Deallocate to + * deallocate the 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginStartAsync(String resourceGroupName, String clusterName) { + Mono>> mono = startWithResponseAsync(resourceGroupName, clusterName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Start the Managed Cassandra Cluster and Associated Data Centers. Start will start the host virtual machine of + * this cluster with reserved data disk. This won't do anything on an already running cluster. Use Deallocate to + * deallocate the 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginStartAsync(String resourceGroupName, String clusterName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = startWithResponseAsync(resourceGroupName, clusterName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Start the Managed Cassandra Cluster and Associated Data Centers. Start will start the host virtual machine of + * this cluster with reserved data disk. This won't do anything on an already running cluster. Use Deallocate to + * deallocate the 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginStart(String resourceGroupName, String clusterName) { + return this.beginStartAsync(resourceGroupName, clusterName).getSyncPoller(); + } + + /** + * Start the Managed Cassandra Cluster and Associated Data Centers. Start will start the host virtual machine of + * this cluster with reserved data disk. This won't do anything on an already running cluster. Use Deallocate to + * deallocate the 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginStart(String resourceGroupName, String clusterName, + Context context) { + return this.beginStartAsync(resourceGroupName, clusterName, context).getSyncPoller(); + } + + /** + * Start the Managed Cassandra Cluster and Associated Data Centers. Start will start the host virtual machine of + * this cluster with reserved data disk. This won't do anything on an already running cluster. Use Deallocate to + * deallocate the 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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono startAsync(String resourceGroupName, String clusterName) { + return beginStartAsync(resourceGroupName, clusterName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Start the Managed Cassandra Cluster and Associated Data Centers. Start will start the host virtual machine of + * this cluster with reserved data disk. This won't do anything on an already running cluster. Use Deallocate to + * deallocate the 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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono startAsync(String resourceGroupName, String clusterName, Context context) { + return beginStartAsync(resourceGroupName, clusterName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Start the Managed Cassandra Cluster and Associated Data Centers. Start will start the host virtual machine of + * this cluster with reserved data disk. This won't do anything on an already running cluster. Use Deallocate to + * deallocate the 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 start(String resourceGroupName, String clusterName) { + startAsync(resourceGroupName, clusterName).block(); + } + + /** + * Start the Managed Cassandra Cluster and Associated Data Centers. Start will start the host virtual machine of + * this cluster with reserved data disk. This won't do anything on an already running cluster. Use Deallocate to + * deallocate the 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 start(String resourceGroupName, String clusterName, Context context) { + startAsync(resourceGroupName, clusterName, context).block(); + } + + /** + * Gets the CPU, memory, and disk usage statistics for each Cassandra node in a 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 CPU, memory, and disk usage statistics for each Cassandra node in a cluster along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> statusWithResponseAsync(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.status(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, clusterName, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the CPU, memory, and disk usage statistics for each Cassandra node in a 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 CPU, memory, and disk usage statistics for each Cassandra node in a cluster along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> statusWithResponseAsync(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.status(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + clusterName, this.client.getApiVersion(), accept, context); + } + + /** + * Gets the CPU, memory, and disk usage statistics for each Cassandra node in a 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 CPU, memory, and disk usage statistics for each Cassandra node in a cluster on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono statusAsync(String resourceGroupName, String clusterName) { + return statusWithResponseAsync(resourceGroupName, clusterName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the CPU, memory, and disk usage statistics for each Cassandra node in a 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 CPU, memory, and disk usage statistics for each Cassandra node in a cluster along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response statusWithResponse(String resourceGroupName, String clusterName, + Context context) { + return statusWithResponseAsync(resourceGroupName, clusterName, context).block(); + } + + /** + * Gets the CPU, memory, and disk usage statistics for each Cassandra node in a 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 CPU, memory, and disk usage statistics for each Cassandra node in a cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CassandraClusterPublicStatusInner status(String resourceGroupName, String clusterName) { + return statusWithResponse(resourceGroupName, clusterName, Context.NONE).getValue(); + } +} 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..0683452e36c00 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraClustersImpl.java @@ -0,0 +1,208 @@ +// Copyright (c) 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.CassandraClusterPublicStatusInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ClusterResourceInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.CommandOutputInner; +import com.azure.resourcemanager.cosmos.generated.models.CassandraClusterPublicStatus; +import com.azure.resourcemanager.cosmos.generated.models.CassandraClusters; +import com.azure.resourcemanager.cosmos.generated.models.ClusterResource; +import com.azure.resourcemanager.cosmos.generated.models.CommandOutput; +import com.azure.resourcemanager.cosmos.generated.models.CommandPostBody; + +public final class CassandraClustersImpl implements CassandraClusters { + private static 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 ResourceManagerUtils.mapPage(inner, inner1 -> new ClusterResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ClusterResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ClusterResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ClusterResourceImpl(inner1, this.manager())); + } + + 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 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 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 CommandOutput invokeCommand(String resourceGroupName, String clusterName, CommandPostBody body) { + CommandOutputInner inner = this.serviceClient().invokeCommand(resourceGroupName, clusterName, body); + if (inner != null) { + return new CommandOutputImpl(inner, this.manager()); + } else { + return null; + } + } + + public CommandOutput invokeCommand(String resourceGroupName, String clusterName, CommandPostBody body, + Context context) { + CommandOutputInner inner = this.serviceClient().invokeCommand(resourceGroupName, clusterName, body, context); + if (inner != null) { + return new CommandOutputImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deallocate(String resourceGroupName, String clusterName) { + this.serviceClient().deallocate(resourceGroupName, clusterName); + } + + public void deallocate(String resourceGroupName, String clusterName, Context context) { + this.serviceClient().deallocate(resourceGroupName, clusterName, context); + } + + public void start(String resourceGroupName, String clusterName) { + this.serviceClient().start(resourceGroupName, clusterName); + } + + public void start(String resourceGroupName, String clusterName, Context context) { + this.serviceClient().start(resourceGroupName, clusterName, context); + } + + public Response statusWithResponse(String resourceGroupName, String clusterName, + Context context) { + Response inner + = this.serviceClient().statusWithResponse(resourceGroupName, clusterName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new CassandraClusterPublicStatusImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CassandraClusterPublicStatus status(String resourceGroupName, String clusterName) { + CassandraClusterPublicStatusInner inner = this.serviceClient().status(resourceGroupName, clusterName); + if (inner != null) { + return new CassandraClusterPublicStatusImpl(inner, this.manager()); + } else { + return null; + } + } + + public ClusterResource getById(String id) { + String resourceGroupName = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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..08205d7de9707 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraDataCentersClientImpl.java @@ -0,0 +1,1131 @@ +// Copyright (c) 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.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 { + /** + * 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") + public 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 along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with + * {@link PagedIterable}. + */ + @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 as paginated response with + * {@link PagedIterable}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String clusterName, + String dataCenterName) { + return getWithResponseAsync(resourceGroupName, clusterName, dataCenterName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String clusterName, + String dataCenterName, Context context) { + return getWithResponseAsync(resourceGroupName, clusterName, dataCenterName, context).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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 getWithResponse(resourceGroupName, clusterName, dataCenterName, Context.NONE).getValue(); + } + + /** + * 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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link PollerFlux} for polling of long-running operation. + */ + @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, + this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String clusterName, + String dataCenterName) { + return this.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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String clusterName, + String dataCenterName, Context context) { + return this.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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of a managed Cassandra data center. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DataCenterResourceInner> beginCreateUpdate( + String resourceGroupName, String clusterName, String dataCenterName, DataCenterResourceInner body) { + return this.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 the {@link SyncPoller} for polling of 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 this.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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of a managed Cassandra data center. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DataCenterResourceInner> + beginUpdate(String resourceGroupName, String clusterName, String dataCenterName, DataCenterResourceInner body) { + return this.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 the {@link SyncPoller} for polling of 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 this.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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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..4ec7dc5cdecac --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraDataCentersImpl.java @@ -0,0 +1,157 @@ +// Copyright (c) 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; + +public final class CassandraDataCentersImpl implements CassandraDataCenters { + private static 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 ResourceManagerUtils.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 ResourceManagerUtils.mapPage(inner, inner1 -> new DataCenterResourceImpl(inner1, this.manager())); + } + + 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 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 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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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..0e9774ae3685c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraKeyspaceGetResultsImpl.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.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 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 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 String resourceGroupName() { + return resourceGroupName; + } + + 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 = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.keyspaceName = ResourceManagerUtils.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 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..c89ca08063271 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraResourcesClientImpl.java @@ -0,0 +1,3740 @@ +// Copyright (c) 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.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.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.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 { + /** + * 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") + public 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); + } + + /** + * 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 along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 as paginated + * response with {@link PagedFlux}. + */ + @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 as paginated + * response with {@link PagedFlux}. + */ + @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 as paginated + * response with {@link PagedIterable}. + */ + @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 as paginated + * response with {@link PagedIterable}. + */ + @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 along + * with {@link Response} on successful completion of {@link Mono}. + */ + @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 along + * with {@link Response} on successful completion of {@link Mono}. + */ + @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 on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getCassandraKeyspaceAsync(String resourceGroupName, + String accountName, String keyspaceName) { + return getCassandraKeyspaceWithResponseAsync(resourceGroupName, accountName, keyspaceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getCassandraKeyspaceWithResponse(String resourceGroupName, + String accountName, String keyspaceName, Context context) { + return getCassandraKeyspaceWithResponseAsync(resourceGroupName, accountName, keyspaceName, context).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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 getCassandraKeyspaceWithResponse(resourceGroupName, accountName, keyspaceName, Context.NONE).getValue(); + } + + /** + * 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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of 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 this + .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 the {@link SyncPoller} for polling of 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 this + .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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link PollerFlux} for polling of long-running operation. + */ + @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, + this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteCassandraKeyspace(String resourceGroupName, String accountName, + String keyspaceName) { + return this.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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteCassandraKeyspace(String resourceGroupName, String accountName, + String keyspaceName, Context context) { + return this.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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getCassandraKeyspaceThroughputAsync(String resourceGroupName, + String accountName, String keyspaceName) { + return getCassandraKeyspaceThroughputWithResponseAsync(resourceGroupName, accountName, keyspaceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getCassandraKeyspaceThroughputWithResponse( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + return getCassandraKeyspaceThroughputWithResponseAsync(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) + public ThroughputSettingsGetResultsInner getCassandraKeyspaceThroughput(String resourceGroupName, + String accountName, String keyspaceName) { + return getCassandraKeyspaceThroughputWithResponse(resourceGroupName, accountName, keyspaceName, Context.NONE) + .getValue(); + } + + /** + * 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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of 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 this + .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 the {@link SyncPoller} for polling of 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 this + .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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateCassandraKeyspaceToAutoscale(String resourceGroupName, String accountName, String keyspaceName) { + return this.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 the {@link SyncPoller} for polling of 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 this.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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateCassandraKeyspaceToManualThroughput(String resourceGroupName, String accountName, + String keyspaceName) { + return this.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 the {@link SyncPoller} for polling of 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 this + .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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 as paginated + * response with {@link PagedFlux}. + */ + @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 as paginated + * response with {@link PagedFlux}. + */ + @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 as paginated + * response with {@link PagedIterable}. + */ + @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 as paginated + * response with {@link PagedIterable}. + */ + @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 along with {@link Response} on + * successful completion of {@link Mono}. + */ + @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 along with {@link Response} on + * successful completion of {@link Mono}. + */ + @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 on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getCassandraTableAsync(String resourceGroupName, String accountName, + String keyspaceName, String tableName) { + return getCassandraTableWithResponseAsync(resourceGroupName, accountName, keyspaceName, tableName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 along with {@link Response}. + */ + @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(); + } + + /** + * 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 getCassandraTableWithResponse(resourceGroupName, accountName, keyspaceName, tableName, Context.NONE) + .getValue(); + } + + /** + * 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of 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 this + .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 the {@link SyncPoller} for polling of 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 this + .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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link PollerFlux} for polling of long-running operation. + */ + @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, + this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteCassandraTable(String resourceGroupName, String accountName, + String keyspaceName, String tableName) { + return this.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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteCassandraTable(String resourceGroupName, String accountName, + String keyspaceName, String tableName, Context context) { + return this.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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getCassandraTableThroughputAsync(String resourceGroupName, + String accountName, String keyspaceName, String tableName) { + return getCassandraTableThroughputWithResponseAsync(resourceGroupName, accountName, keyspaceName, tableName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 along with {@link Response}. + */ + @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(); + } + + /** + * 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 getCassandraTableThroughputWithResponse(resourceGroupName, accountName, keyspaceName, tableName, + Context.NONE).getValue(); + } + + /** + * 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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of 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 this + .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 the {@link SyncPoller} for polling of 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 this + .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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of 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 this.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 the {@link SyncPoller} for polling of 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 this + .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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of 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 this + .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 the {@link SyncPoller} for polling of 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 this + .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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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(); + } +} 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..f6c7ee1987d24 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraResourcesImpl.java @@ -0,0 +1,502 @@ +// Copyright (c) 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.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.ThroughputSettingsGetResults; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; + +public final class CassandraResourcesImpl implements CassandraResources { + private static 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 ResourceManagerUtils.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 ResourceManagerUtils.mapPage(inner, + inner1 -> new CassandraKeyspaceGetResultsImpl(inner1, this.manager())); + } + + 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 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 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 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 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 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 ResourceManagerUtils.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 ResourceManagerUtils.mapPage(inner, inner1 -> new CassandraTableGetResultsImpl(inner1, this.manager())); + } + + 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 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 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 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 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 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 CassandraKeyspaceGetResults getCassandraKeyspaceById(String id) { + String resourceGroupName = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 void deleteCassandraKeyspaceById(String id) { + String resourceGroupName = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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); + } + + 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()); + } +} 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..d89975b956f0f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraTableGetResultsImpl.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.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 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 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 String resourceGroupName() { + return resourceGroupName; + } + + 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 = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.keyspaceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "cassandraKeyspaces"); + this.tableName = ResourceManagerUtils.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 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/ClientEncryptionKeyGetResultsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/ClientEncryptionKeyGetResultsImpl.java new file mode 100644 index 0000000000000..cf31ec6841279 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/ClientEncryptionKeyGetResultsImpl.java @@ -0,0 +1,155 @@ +// Copyright (c) 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.ClientEncryptionKeyGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.ClientEncryptionKeyCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.ClientEncryptionKeyGetPropertiesResource; +import com.azure.resourcemanager.cosmos.generated.models.ClientEncryptionKeyGetResults; +import com.azure.resourcemanager.cosmos.generated.models.ClientEncryptionKeyResource; + +public final class ClientEncryptionKeyGetResultsImpl implements ClientEncryptionKeyGetResults, + ClientEncryptionKeyGetResults.Definition, ClientEncryptionKeyGetResults.Update { + private ClientEncryptionKeyGetResultsInner 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 ClientEncryptionKeyGetPropertiesResource resource() { + return this.innerModel().resource(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ClientEncryptionKeyGetResultsInner 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 clientEncryptionKeyName; + + private ClientEncryptionKeyCreateUpdateParameters createCreateUpdateClientEncryptionKeyParameters; + + private ClientEncryptionKeyCreateUpdateParameters updateCreateUpdateClientEncryptionKeyParameters; + + public ClientEncryptionKeyGetResultsImpl withExistingSqlDatabase(String resourceGroupName, String accountName, + String databaseName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + this.databaseName = databaseName; + return this; + } + + public ClientEncryptionKeyGetResults create() { + this.innerObject = serviceManager.serviceClient() + .getSqlResources() + .createUpdateClientEncryptionKey(resourceGroupName, accountName, databaseName, clientEncryptionKeyName, + createCreateUpdateClientEncryptionKeyParameters, Context.NONE); + return this; + } + + public ClientEncryptionKeyGetResults create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSqlResources() + .createUpdateClientEncryptionKey(resourceGroupName, accountName, databaseName, clientEncryptionKeyName, + createCreateUpdateClientEncryptionKeyParameters, context); + return this; + } + + ClientEncryptionKeyGetResultsImpl(String name, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = new ClientEncryptionKeyGetResultsInner(); + this.serviceManager = serviceManager; + this.clientEncryptionKeyName = name; + this.createCreateUpdateClientEncryptionKeyParameters = new ClientEncryptionKeyCreateUpdateParameters(); + } + + public ClientEncryptionKeyGetResultsImpl update() { + this.updateCreateUpdateClientEncryptionKeyParameters = new ClientEncryptionKeyCreateUpdateParameters(); + return this; + } + + public ClientEncryptionKeyGetResults apply() { + this.innerObject = serviceManager.serviceClient() + .getSqlResources() + .createUpdateClientEncryptionKey(resourceGroupName, accountName, databaseName, clientEncryptionKeyName, + updateCreateUpdateClientEncryptionKeyParameters, Context.NONE); + return this; + } + + public ClientEncryptionKeyGetResults apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSqlResources() + .createUpdateClientEncryptionKey(resourceGroupName, accountName, databaseName, clientEncryptionKeyName, + updateCreateUpdateClientEncryptionKeyParameters, context); + return this; + } + + ClientEncryptionKeyGetResultsImpl(ClientEncryptionKeyGetResultsInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.databaseName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "sqlDatabases"); + this.clientEncryptionKeyName + = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "clientEncryptionKeys"); + } + + public ClientEncryptionKeyGetResults refresh() { + this.innerObject = serviceManager.serviceClient() + .getSqlResources() + .getClientEncryptionKeyWithResponse(resourceGroupName, accountName, databaseName, clientEncryptionKeyName, + Context.NONE) + .getValue(); + return this; + } + + public ClientEncryptionKeyGetResults refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSqlResources() + .getClientEncryptionKeyWithResponse(resourceGroupName, accountName, databaseName, clientEncryptionKeyName, + context) + .getValue(); + return this; + } + + public ClientEncryptionKeyGetResultsImpl withResource(ClientEncryptionKeyResource resource) { + if (isInCreateMode()) { + this.createCreateUpdateClientEncryptionKeyParameters.withResource(resource); + return this; + } else { + this.updateCreateUpdateClientEncryptionKeyParameters.withResource(resource); + 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/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..1250b3640644c --- /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.ClusterResource; +import com.azure.resourcemanager.cosmos.generated.models.ClusterResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.CommandOutput; +import com.azure.resourcemanager.cosmos.generated.models.CommandPostBody; +import com.azure.resourcemanager.cosmos.generated.models.ManagedCassandraManagedServiceIdentity; +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 ManagedCassandraManagedServiceIdentity 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 String resourceGroupName() { + return resourceGroupName; + } + + 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 = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.clusterName = ResourceManagerUtils.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 CommandOutput invokeCommand(CommandPostBody body) { + return serviceManager.cassandraClusters().invokeCommand(resourceGroupName, clusterName, body); + } + + public CommandOutput invokeCommand(CommandPostBody body, Context context) { + return serviceManager.cassandraClusters().invokeCommand(resourceGroupName, clusterName, body, context); + } + + public void deallocate() { + serviceManager.cassandraClusters().deallocate(resourceGroupName, clusterName); + } + + public void deallocate(Context context) { + serviceManager.cassandraClusters().deallocate(resourceGroupName, clusterName, context); + } + + public void start() { + serviceManager.cassandraClusters().start(resourceGroupName, clusterName); + } + + public void start(Context context) { + serviceManager.cassandraClusters().start(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(ManagedCassandraManagedServiceIdentity 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..e6f66106f59e1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionPartitionRegionsClientImpl.java @@ -0,0 +1,284 @@ +// Copyright (c) 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.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 { + /** + * 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") + public 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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..b87c2c8e14c70 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionPartitionRegionsImpl.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.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; + +public final class CollectionPartitionRegionsImpl implements CollectionPartitionRegions { + private static 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 ResourceManagerUtils.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 ResourceManagerUtils.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..a8e15aa4e0098 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionPartitionsClientImpl.java @@ -0,0 +1,487 @@ +// Copyright (c) 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.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 { + /** + * 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") + public 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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..83ce5f75ed623 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionPartitionsImpl.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.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; + +public final class CollectionPartitionsImpl implements CollectionPartitions { + private static 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 ResourceManagerUtils.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 ResourceManagerUtils.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 ResourceManagerUtils.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 ResourceManagerUtils.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..15fd795f90681 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionRegionsClientImpl.java @@ -0,0 +1,284 @@ +// Copyright (c) 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.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 { + /** + * 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") + public 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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..e0a46b89e9bb4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionRegionsImpl.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.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; + +public final class CollectionRegionsImpl implements CollectionRegions { + private static 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 ResourceManagerUtils.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 ResourceManagerUtils.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..530e51eb24dfb --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionsClientImpl.java @@ -0,0 +1,671 @@ +// Copyright (c) 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.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 { + /** + * 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") + public 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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..eab6a56a3fd44 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionsImpl.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.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; + +public final class CollectionsImpl implements Collections { + private static 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 ResourceManagerUtils.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 ResourceManagerUtils.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 ResourceManagerUtils.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 ResourceManagerUtils.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 ResourceManagerUtils.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 ResourceManagerUtils.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/CommandOutputImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CommandOutputImpl.java new file mode 100644 index 0000000000000..e46ee004121d4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CommandOutputImpl.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.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.CommandOutputInner; +import com.azure.resourcemanager.cosmos.generated.models.CommandOutput; + +public final class CommandOutputImpl implements CommandOutput { + private CommandOutputInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + CommandOutputImpl(CommandOutputInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String commandOutput() { + return this.innerModel().commandOutput(); + } + + public CommandOutputInner 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/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..8bc62995ec903 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CosmosDBManagementClientBuilder.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.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.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 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 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 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() { + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = (pipeline != null) + ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval + = (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = (serializerAdapter != null) + ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + CosmosDBManagementClientImpl client = new CosmosDBManagementClientImpl(localPipeline, localSerializerAdapter, + localDefaultPollInterval, localEnvironment, this.subscriptionId, localEndpoint); + 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..90c33a5d9ab5b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CosmosDBManagementClientImpl.java @@ -0,0 +1,864 @@ +// Copyright (c) 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.HttpHeaderName; +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.CoreUtils; +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.GremlinResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.LocationsClient; +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.RestorableDatabaseAccountsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.RestorableGremlinDatabasesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.RestorableGremlinGraphsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.RestorableGremlinResourcesClient; +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.RestorableTableResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.RestorableTablesClient; +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 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 { + /** + * 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 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 LocationsClient object to access its operations. + */ + private final LocationsClient locations; + + /** + * Gets the LocationsClient object to access its operations. + * + * @return the LocationsClient object. + */ + public LocationsClient getLocations() { + return this.locations; + } + + /** + * 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 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 RestorableGremlinDatabasesClient object to access its operations. + */ + private final RestorableGremlinDatabasesClient restorableGremlinDatabases; + + /** + * Gets the RestorableGremlinDatabasesClient object to access its operations. + * + * @return the RestorableGremlinDatabasesClient object. + */ + public RestorableGremlinDatabasesClient getRestorableGremlinDatabases() { + return this.restorableGremlinDatabases; + } + + /** + * The RestorableGremlinGraphsClient object to access its operations. + */ + private final RestorableGremlinGraphsClient restorableGremlinGraphs; + + /** + * Gets the RestorableGremlinGraphsClient object to access its operations. + * + * @return the RestorableGremlinGraphsClient object. + */ + public RestorableGremlinGraphsClient getRestorableGremlinGraphs() { + return this.restorableGremlinGraphs; + } + + /** + * The RestorableGremlinResourcesClient object to access its operations. + */ + private final RestorableGremlinResourcesClient restorableGremlinResources; + + /** + * Gets the RestorableGremlinResourcesClient object to access its operations. + * + * @return the RestorableGremlinResourcesClient object. + */ + public RestorableGremlinResourcesClient getRestorableGremlinResources() { + return this.restorableGremlinResources; + } + + /** + * The RestorableTablesClient object to access its operations. + */ + private final RestorableTablesClient restorableTables; + + /** + * Gets the RestorableTablesClient object to access its operations. + * + * @return the RestorableTablesClient object. + */ + public RestorableTablesClient getRestorableTables() { + return this.restorableTables; + } + + /** + * The RestorableTableResourcesClient object to access its operations. + */ + private final RestorableTableResourcesClient restorableTableResources; + + /** + * Gets the RestorableTableResourcesClient object to access its operations. + * + * @return the RestorableTableResourcesClient object. + */ + public RestorableTableResourcesClient getRestorableTableResources() { + return this.restorableTableResources; + } + + /** + * 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 = "2024-11-15"; + 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.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.locations = new LocationsClientImpl(this); + this.cassandraClusters = new CassandraClustersClientImpl(this); + this.cassandraDataCenters = new CassandraDataCentersClientImpl(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.restorableGremlinDatabases = new RestorableGremlinDatabasesClientImpl(this); + this.restorableGremlinGraphs = new RestorableGremlinGraphsClientImpl(this); + this.restorableGremlinResources = new RestorableGremlinResourcesClientImpl(this); + this.restorableTables = new RestorableTablesClientImpl(this); + this.restorableTableResources = new RestorableTableResourcesClientImpl(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) { + return CoreUtils.mergeContexts(this.getContext(), 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(HttpHeaderName.fromString(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)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CosmosDBManagementClientImpl.class); +} 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..1cb7e1d846520 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DataCenterResourceImpl.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.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 String resourceGroupName() { + return resourceGroupName; + } + + 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 = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.clusterName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "cassandraClusters"); + this.dataCenterName = ResourceManagerUtils.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..078129e7a27d1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountGetResultsImpl.java @@ -0,0 +1,805 @@ +// Copyright (c) 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.Capacity; +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.DatabaseAccountKeysMetadata; +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.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.MinimalTlsVersion; +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 DatabaseAccountKind kind() { + return this.innerModel().kind(); + } + + public ManagedServiceIdentity identity() { + return this.innerModel().identity(); + } + + 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 Boolean disableLocalAuth() { + return this.innerModel().disableLocalAuth(); + } + + public Capacity capacity() { + return this.innerModel().capacity(); + } + + public DatabaseAccountKeysMetadata keysMetadata() { + return this.innerModel().keysMetadata(); + } + + public Boolean enablePartitionMerge() { + return this.innerModel().enablePartitionMerge(); + } + + public MinimalTlsVersion minimalTlsVersion() { + return this.innerModel().minimalTlsVersion(); + } + + public Boolean enableBurstCapacity() { + return this.innerModel().enableBurstCapacity(); + } + + public String customerManagedKeyStatus() { + return this.innerModel().customerManagedKeyStatus(); + } + + public Boolean enablePerRegionPerPartitionAutoscale() { + return this.innerModel().enablePerRegionPerPartitionAutoscale(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + 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 = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = ResourceManagerUtils.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 Response listKeysWithResponse(Context context) { + return serviceManager.databaseAccounts().listKeysWithResponse(resourceGroupName, accountName, context); + } + + public DatabaseAccountListKeysResult listKeys() { + return serviceManager.databaseAccounts().listKeys(resourceGroupName, accountName); + } + + public Response listConnectionStringsWithResponse(Context context) { + return serviceManager.databaseAccounts() + .listConnectionStringsWithResponse(resourceGroupName, accountName, context); + } + + public DatabaseAccountListConnectionStringsResult listConnectionStrings() { + return serviceManager.databaseAccounts().listConnectionStrings(resourceGroupName, accountName); + } + + 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 Response listReadOnlyKeysWithResponse(Context context) { + return serviceManager.databaseAccounts().listReadOnlyKeysWithResponse(resourceGroupName, accountName, context); + } + + public DatabaseAccountListReadOnlyKeysResult listReadOnlyKeys() { + return serviceManager.databaseAccounts().listReadOnlyKeys(resourceGroupName, accountName); + } + + 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 withTags(Map tags) { + if (isInCreateMode()) { + this.createCreateUpdateParameters.withTags(tags); + return this; + } else { + this.updateUpdateParameters.withTags(tags); + return this; + } + } + + public DatabaseAccountGetResultsImpl withKind(DatabaseAccountKind kind) { + this.createCreateUpdateParameters.withKind(kind); + return this; + } + + public DatabaseAccountGetResultsImpl withIdentity(ManagedServiceIdentity identity) { + if (isInCreateMode()) { + this.createCreateUpdateParameters.withIdentity(identity); + return this; + } else { + this.updateUpdateParameters.withIdentity(identity); + 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 withCreateMode(CreateMode createMode) { + this.createCreateUpdateParameters.withCreateMode(createMode); + 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 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; + } + + public DatabaseAccountGetResultsImpl withCapacity(Capacity capacity) { + if (isInCreateMode()) { + this.createCreateUpdateParameters.withCapacity(capacity); + return this; + } else { + this.updateUpdateParameters.withCapacity(capacity); + return this; + } + } + + public DatabaseAccountGetResultsImpl withEnablePartitionMerge(Boolean enablePartitionMerge) { + if (isInCreateMode()) { + this.createCreateUpdateParameters.withEnablePartitionMerge(enablePartitionMerge); + return this; + } else { + this.updateUpdateParameters.withEnablePartitionMerge(enablePartitionMerge); + return this; + } + } + + public DatabaseAccountGetResultsImpl withMinimalTlsVersion(MinimalTlsVersion minimalTlsVersion) { + if (isInCreateMode()) { + this.createCreateUpdateParameters.withMinimalTlsVersion(minimalTlsVersion); + return this; + } else { + this.updateUpdateParameters.withMinimalTlsVersion(minimalTlsVersion); + return this; + } + } + + public DatabaseAccountGetResultsImpl withEnableBurstCapacity(Boolean enableBurstCapacity) { + if (isInCreateMode()) { + this.createCreateUpdateParameters.withEnableBurstCapacity(enableBurstCapacity); + return this; + } else { + this.updateUpdateParameters.withEnableBurstCapacity(enableBurstCapacity); + return this; + } + } + + public DatabaseAccountGetResultsImpl withCustomerManagedKeyStatus(String customerManagedKeyStatus) { + if (isInCreateMode()) { + this.createCreateUpdateParameters.withCustomerManagedKeyStatus(customerManagedKeyStatus); + return this; + } else { + this.updateUpdateParameters.withCustomerManagedKeyStatus(customerManagedKeyStatus); + return this; + } + } + + public DatabaseAccountGetResultsImpl + withEnablePerRegionPerPartitionAutoscale(Boolean enablePerRegionPerPartitionAutoscale) { + if (isInCreateMode()) { + this.createCreateUpdateParameters + .withEnablePerRegionPerPartitionAutoscale(enablePerRegionPerPartitionAutoscale); + return this; + } else { + this.updateUpdateParameters.withEnablePerRegionPerPartitionAutoscale(enablePerRegionPerPartitionAutoscale); + 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..e0d72201319b6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountListConnectionStringsResultImpl.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.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..b5a275afd2894 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountListKeysResultImpl.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.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..e6adc29cbf9e5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountListReadOnlyKeysResultImpl.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.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..c9561022f5df6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountRegionsClientImpl.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.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 { + /** + * 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") + public 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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..98f9857fdf2b0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountRegionsImpl.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.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; + +public final class DatabaseAccountRegionsImpl implements DatabaseAccountRegions { + private static 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 ResourceManagerUtils.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 ResourceManagerUtils.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..4b8804ed5e82e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountsClientImpl.java @@ -0,0 +1,3309 @@ +// Copyright (c) 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.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 { + /** + * 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") + public 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String accountName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, accountName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String accountName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, accountName, context).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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the 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 getByResourceGroupWithResponse(resourceGroupName, accountName, Context.NONE).getValue(); + } + + /** + * 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DatabaseAccountGetResultsInner> + beginUpdate(String resourceGroupName, String accountName, DatabaseAccountUpdateParameters updateParameters) { + return this.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 the {@link SyncPoller} for polling of 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 this.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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DatabaseAccountGetResultsInner> beginCreateOrUpdate( + String resourceGroupName, String accountName, DatabaseAccountCreateUpdateParameters createUpdateParameters) { + return this.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 the {@link SyncPoller} for polling of 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 this.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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link PollerFlux} for polling of long-running operation. + */ + @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, + this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String accountName) { + return this.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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String accountName, + Context context) { + return this.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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link PollerFlux} for polling of long-running operation. + */ + @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, + this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginFailoverPriorityChange(String resourceGroupName, String accountName, + FailoverPolicies failoverParameters) { + return this.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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginFailoverPriorityChange(String resourceGroupName, String accountName, + FailoverPolicies failoverParameters, Context context) { + return this.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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 as paginated + * response with {@link PagedFlux}. + */ + @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 as paginated + * response with {@link PagedFlux}. + */ + @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 as paginated + * response with {@link PagedIterable}. + */ + @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 as paginated + * response with {@link PagedIterable}. + */ + @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 along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 as paginated + * response with {@link PagedFlux}. + */ + @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 as paginated + * response with {@link PagedFlux}. + */ + @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 as paginated + * response with {@link PagedIterable}. + */ + @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 as paginated + * response with {@link PagedIterable}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listKeysAsync(String resourceGroupName, String accountName) { + return listKeysWithResponseAsync(resourceGroupName, accountName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listKeysWithResponse(String resourceGroupName, + String accountName, Context context) { + return listKeysWithResponseAsync(resourceGroupName, accountName, context).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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 listKeysWithResponse(resourceGroupName, accountName, Context.NONE).getValue(); + } + + /** + * 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 along with {@link Response} on successful + * completion of {@link Mono}. + */ + @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 along with {@link Response} on successful + * completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listConnectionStringsAsync(String resourceGroupName, + String accountName) { + return listConnectionStringsWithResponseAsync(resourceGroupName, accountName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response + listConnectionStringsWithResponse(String resourceGroupName, String accountName, Context context) { + return listConnectionStringsWithResponseAsync(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) + public DatabaseAccountListConnectionStringsResultInner listConnectionStrings(String resourceGroupName, + String accountName) { + return listConnectionStringsWithResponse(resourceGroupName, accountName, Context.NONE).getValue(); + } + + /** + * 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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link PollerFlux} for polling of long-running operation. + */ + @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, + this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginOfflineRegion(String resourceGroupName, String accountName, + RegionForOnlineOffline regionParameterForOffline) { + return this.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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginOfflineRegion(String resourceGroupName, String accountName, + RegionForOnlineOffline regionParameterForOffline, Context context) { + return this.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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link PollerFlux} for polling of long-running operation. + */ + @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, + this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginOnlineRegion(String resourceGroupName, String accountName, + RegionForOnlineOffline regionParameterForOnline) { + return this.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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginOnlineRegion(String resourceGroupName, String accountName, + RegionForOnlineOffline regionParameterForOnline, Context context) { + return this.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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with {@link Response} on successful + * completion of {@link Mono}. + */ + @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 along with {@link Response} on successful + * completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getReadOnlyKeysAsync(String resourceGroupName, + String accountName) { + return getReadOnlyKeysWithResponseAsync(resourceGroupName, accountName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 along with {@link Response}. + */ + @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) + public DatabaseAccountListReadOnlyKeysResultInner getReadOnlyKeys(String resourceGroupName, String accountName) { + return getReadOnlyKeysWithResponse(resourceGroupName, accountName, Context.NONE).getValue(); + } + + /** + * 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 along with {@link Response} on successful + * completion of {@link Mono}. + */ + @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 along with {@link Response} on successful + * completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listReadOnlyKeysAsync(String resourceGroupName, + String accountName) { + return listReadOnlyKeysWithResponseAsync(resourceGroupName, accountName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listReadOnlyKeysWithResponse(String resourceGroupName, + String accountName, Context context) { + return listReadOnlyKeysWithResponseAsync(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) + public DatabaseAccountListReadOnlyKeysResultInner listReadOnlyKeys(String resourceGroupName, String accountName) { + return listReadOnlyKeysWithResponse(resourceGroupName, accountName, Context.NONE).getValue(); + } + + /** + * 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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link PollerFlux} for polling of long-running operation. + */ + @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, + this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRegenerateKey(String resourceGroupName, String accountName, + DatabaseAccountRegenerateKeyParameters keyToRegenerate) { + return this.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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRegenerateKey(String resourceGroupName, String accountName, + DatabaseAccountRegenerateKeyParameters keyToRegenerate, Context context) { + return this.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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkNameExistsAsync(String accountName) { + return checkNameExistsWithResponseAsync(accountName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkNameExistsWithResponse(String accountName, Context context) { + return checkNameExistsWithResponseAsync(accountName, 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) + public boolean checkNameExists(String accountName) { + return checkNameExistsWithResponse(accountName, Context.NONE).getValue(); + } + + /** + * 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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..5c178633e6b78 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountsImpl.java @@ -0,0 +1,336 @@ +// Copyright (c) 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; + +public final class DatabaseAccountsImpl implements DatabaseAccounts { + private static 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 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 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 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 ResourceManagerUtils.mapPage(inner, inner1 -> new DatabaseAccountGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new DatabaseAccountGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new DatabaseAccountGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new DatabaseAccountGetResultsImpl(inner1, this.manager())); + } + + 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 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 + 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 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 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 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 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 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 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 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 Response checkNameExistsWithResponse(String accountName, Context context) { + return this.serviceClient().checkNameExistsWithResponse(accountName, context); + } + + public boolean checkNameExists(String accountName) { + return this.serviceClient().checkNameExists(accountName); + } + + public PagedIterable listMetrics(String resourceGroupName, String accountName, String filter) { + PagedIterable inner = this.serviceClient().listMetrics(resourceGroupName, accountName, filter); + return ResourceManagerUtils.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 ResourceManagerUtils.mapPage(inner, inner1 -> new MetricImpl(inner1, this.manager())); + } + + public PagedIterable listUsages(String resourceGroupName, String accountName) { + PagedIterable inner = this.serviceClient().listUsages(resourceGroupName, accountName); + return ResourceManagerUtils.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 ResourceManagerUtils.mapPage(inner, inner1 -> new UsageImpl(inner1, this.manager())); + } + + public PagedIterable listMetricDefinitions(String resourceGroupName, String accountName) { + PagedIterable inner + = this.serviceClient().listMetricDefinitions(resourceGroupName, accountName); + return ResourceManagerUtils.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 ResourceManagerUtils.mapPage(inner, inner1 -> new MetricDefinitionImpl(inner1, this.manager())); + } + + public DatabaseAccountGetResults getById(String id) { + String resourceGroupName = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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/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..ca3f035e987ae --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabasesClientImpl.java @@ -0,0 +1,619 @@ +// Copyright (c) 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.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 { + /** + * 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") + public 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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..49d61f99c1c5c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabasesImpl.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.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; + +public final class DatabasesImpl implements Databases { + private static 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 ResourceManagerUtils.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 ResourceManagerUtils.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 ResourceManagerUtils.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 ResourceManagerUtils.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 ResourceManagerUtils.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 ResourceManagerUtils.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/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..45ab50a86d1b8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/GremlinDatabaseGetResultsImpl.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.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 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 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 String resourceGroupName() { + return resourceGroupName; + } + + 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 = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.databaseName = ResourceManagerUtils.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 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..97b1d8ded55fd --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/GremlinGraphGetResultsImpl.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.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.BackupInformation; +import com.azure.resourcemanager.cosmos.generated.models.ContinuousBackupRestoreLocation; +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 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 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 String resourceGroupName() { + return resourceGroupName; + } + + 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 = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.databaseName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "gremlinDatabases"); + this.graphName = ResourceManagerUtils.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 BackupInformation retrieveContinuousBackupInformation(ContinuousBackupRestoreLocation location) { + return serviceManager.gremlinResources() + .retrieveContinuousBackupInformation(resourceGroupName, accountName, databaseName, graphName, location); + } + + public BackupInformation retrieveContinuousBackupInformation(ContinuousBackupRestoreLocation location, + Context context) { + return serviceManager.gremlinResources() + .retrieveContinuousBackupInformation(resourceGroupName, accountName, databaseName, graphName, location, + context); + } + + 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 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..7530f1e1849c7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/GremlinResourcesClientImpl.java @@ -0,0 +1,4008 @@ +// Copyright (c) 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.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.BackupInformationInner; +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.ContinuousBackupRestoreLocation; +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 { + /** + * 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") + public 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); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/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("graphName") String graphName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ContinuousBackupRestoreLocation location, + @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 along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 as paginated + * response with {@link PagedFlux}. + */ + @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 as paginated + * response with {@link PagedFlux}. + */ + @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 as paginated + * response with {@link PagedIterable}. + */ + @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 as paginated + * response with {@link PagedIterable}. + */ + @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 along + * with {@link Response} on successful completion of {@link Mono}. + */ + @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 along + * with {@link Response} on successful completion of {@link Mono}. + */ + @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 on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getGremlinDatabaseAsync(String resourceGroupName, String accountName, + String databaseName) { + return getGremlinDatabaseWithResponseAsync(resourceGroupName, accountName, databaseName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getGremlinDatabaseWithResponse(String resourceGroupName, + String accountName, String databaseName, Context context) { + return getGremlinDatabaseWithResponseAsync(resourceGroupName, accountName, databaseName, context).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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 getGremlinDatabaseWithResponse(resourceGroupName, accountName, databaseName, Context.NONE).getValue(); + } + + /** + * 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of 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 this + .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 the {@link SyncPoller} for polling of 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 this + .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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link PollerFlux} for polling of long-running operation. + */ + @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, + this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteGremlinDatabase(String resourceGroupName, String accountName, + String databaseName) { + return this.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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteGremlinDatabase(String resourceGroupName, String accountName, + String databaseName, Context context) { + return this.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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getGremlinDatabaseThroughputAsync(String resourceGroupName, + String accountName, String databaseName) { + return getGremlinDatabaseThroughputWithResponseAsync(resourceGroupName, accountName, databaseName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getGremlinDatabaseThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context) { + return getGremlinDatabaseThroughputWithResponseAsync(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) + public ThroughputSettingsGetResultsInner getGremlinDatabaseThroughput(String resourceGroupName, String accountName, + String databaseName) { + return getGremlinDatabaseThroughputWithResponse(resourceGroupName, accountName, databaseName, Context.NONE) + .getValue(); + } + + /** + * 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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of 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 this + .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 the {@link SyncPoller} for polling of 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 this + .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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateGremlinDatabaseToAutoscale(String resourceGroupName, String accountName, String databaseName) { + return this.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 the {@link SyncPoller} for polling of 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 this.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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateGremlinDatabaseToManualThroughput(String resourceGroupName, String accountName, + String databaseName) { + return this.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 the {@link SyncPoller} for polling of 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 this + .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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 as paginated response with + * {@link PagedFlux}. + */ + @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 as paginated response with + * {@link PagedFlux}. + */ + @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 as paginated response with + * {@link PagedIterable}. + */ + @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 as paginated response with + * {@link PagedIterable}. + */ + @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 along with {@link Response} on + * successful completion of {@link Mono}. + */ + @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 along with {@link Response} on + * successful completion of {@link Mono}. + */ + @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 on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getGremlinGraphAsync(String resourceGroupName, String accountName, + String databaseName, String graphName) { + return getGremlinGraphWithResponseAsync(resourceGroupName, accountName, databaseName, graphName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 along with {@link Response}. + */ + @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(); + } + + /** + * 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 getGremlinGraphWithResponse(resourceGroupName, accountName, databaseName, graphName, Context.NONE) + .getValue(); + } + + /** + * 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of 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 this + .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 the {@link SyncPoller} for polling of 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 this + .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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link PollerFlux} for polling of long-running operation. + */ + @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, + this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteGremlinGraph(String resourceGroupName, String accountName, + String databaseName, String graphName) { + return this.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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteGremlinGraph(String resourceGroupName, String accountName, + String databaseName, String graphName, Context context) { + return this.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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 + * along with {@link Response} on successful completion of {@link Mono}. + */ + @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 + * along with {@link Response} on successful completion of {@link Mono}. + */ + @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 on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getGremlinGraphThroughputAsync(String resourceGroupName, + String accountName, String databaseName, String graphName) { + return getGremlinGraphThroughputWithResponseAsync(resourceGroupName, accountName, databaseName, graphName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 + * along with {@link Response}. + */ + @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(); + } + + /** + * 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 getGremlinGraphThroughputWithResponse(resourceGroupName, accountName, databaseName, graphName, + Context.NONE).getValue(); + } + + /** + * 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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of 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 this + .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 the {@link SyncPoller} for polling of 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 this + .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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of 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 this.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 the {@link SyncPoller} for polling of 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 this + .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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of 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 this + .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 the {@link SyncPoller} for polling of 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 this + .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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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(); + } + + /** + * Retrieves continuous backup information for a 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 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> retrieveContinuousBackupInformationWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String graphName, + 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 (graphName == null) { + return Mono.error(new IllegalArgumentException("Parameter graphName 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, graphName, + this.client.getApiVersion(), location, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves continuous backup information for a 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 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> retrieveContinuousBackupInformationWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String graphName, + 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 (graphName == null) { + return Mono.error(new IllegalArgumentException("Parameter graphName 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, graphName, this.client.getApiVersion(), location, accept, + context); + } + + /** + * Retrieves continuous backup information for a 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 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 the {@link PollerFlux} for polling of backup information of a resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, BackupInformationInner> + beginRetrieveContinuousBackupInformationAsync(String resourceGroupName, String accountName, String databaseName, + String graphName, ContinuousBackupRestoreLocation location) { + Mono>> mono = retrieveContinuousBackupInformationWithResponseAsync(resourceGroupName, + accountName, databaseName, graphName, location); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), BackupInformationInner.class, BackupInformationInner.class, + this.client.getContext()); + } + + /** + * Retrieves continuous backup information for a 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 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 the {@link PollerFlux} for polling of backup information of a resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, BackupInformationInner> + beginRetrieveContinuousBackupInformationAsync(String resourceGroupName, String accountName, String databaseName, + String graphName, ContinuousBackupRestoreLocation location, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = retrieveContinuousBackupInformationWithResponseAsync(resourceGroupName, + accountName, databaseName, graphName, location, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), BackupInformationInner.class, BackupInformationInner.class, context); + } + + /** + * Retrieves continuous backup information for a 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 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 the {@link SyncPoller} for polling of backup information of a resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, BackupInformationInner> + beginRetrieveContinuousBackupInformation(String resourceGroupName, String accountName, String databaseName, + String graphName, ContinuousBackupRestoreLocation location) { + return this + .beginRetrieveContinuousBackupInformationAsync(resourceGroupName, accountName, databaseName, graphName, + location) + .getSyncPoller(); + } + + /** + * Retrieves continuous backup information for a 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 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 the {@link SyncPoller} for polling of backup information of a resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, BackupInformationInner> + beginRetrieveContinuousBackupInformation(String resourceGroupName, String accountName, String databaseName, + String graphName, ContinuousBackupRestoreLocation location, Context context) { + return this + .beginRetrieveContinuousBackupInformationAsync(resourceGroupName, accountName, databaseName, graphName, + location, context) + .getSyncPoller(); + } + + /** + * Retrieves continuous backup information for a 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 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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono retrieveContinuousBackupInformationAsync(String resourceGroupName, + String accountName, String databaseName, String graphName, ContinuousBackupRestoreLocation location) { + return beginRetrieveContinuousBackupInformationAsync(resourceGroupName, accountName, databaseName, graphName, + location).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Retrieves continuous backup information for a 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 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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono retrieveContinuousBackupInformationAsync(String resourceGroupName, + String accountName, String databaseName, String graphName, ContinuousBackupRestoreLocation location, + Context context) { + return beginRetrieveContinuousBackupInformationAsync(resourceGroupName, accountName, databaseName, graphName, + location, context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Retrieves continuous backup information for a 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 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 graphName, ContinuousBackupRestoreLocation location) { + return retrieveContinuousBackupInformationAsync(resourceGroupName, accountName, databaseName, graphName, + location).block(); + } + + /** + * Retrieves continuous backup information for a 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 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 graphName, ContinuousBackupRestoreLocation location, Context context) { + return retrieveContinuousBackupInformationAsync(resourceGroupName, accountName, databaseName, graphName, + location, 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..087d9edd384d7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/GremlinResourcesImpl.java @@ -0,0 +1,524 @@ +// Copyright (c) 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.BackupInformationInner; +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.BackupInformation; +import com.azure.resourcemanager.cosmos.generated.models.ContinuousBackupRestoreLocation; +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; + +public final class GremlinResourcesImpl implements GremlinResources { + private static 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 ResourceManagerUtils.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 ResourceManagerUtils.mapPage(inner, inner1 -> new GremlinDatabaseGetResultsImpl(inner1, this.manager())); + } + + 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 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 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 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 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 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 ResourceManagerUtils.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 ResourceManagerUtils.mapPage(inner, inner1 -> new GremlinGraphGetResultsImpl(inner1, this.manager())); + } + + 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 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 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 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 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 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 BackupInformation retrieveContinuousBackupInformation(String resourceGroupName, String accountName, + String databaseName, String graphName, ContinuousBackupRestoreLocation location) { + BackupInformationInner inner = this.serviceClient() + .retrieveContinuousBackupInformation(resourceGroupName, accountName, databaseName, graphName, location); + if (inner != null) { + return new BackupInformationImpl(inner, this.manager()); + } else { + return null; + } + } + + public BackupInformation retrieveContinuousBackupInformation(String resourceGroupName, String accountName, + String databaseName, String graphName, ContinuousBackupRestoreLocation location, Context context) { + BackupInformationInner inner = this.serviceClient() + .retrieveContinuousBackupInformation(resourceGroupName, accountName, databaseName, graphName, location, + context); + if (inner != null) { + return new BackupInformationImpl(inner, this.manager()); + } else { + return null; + } + } + + public GremlinDatabaseGetResults getGremlinDatabaseById(String id) { + String resourceGroupName = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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..ebadcc94e6acd --- /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/LocationsClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/LocationsClientImpl.java new file mode 100644 index 0000000000000..998f898fa84b6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/LocationsClientImpl.java @@ -0,0 +1,296 @@ +// Copyright (c) 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.resourcemanager.cosmos.generated.fluent.LocationsClient; +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 LocationsClient. + */ +public final class LocationsClientImpl implements LocationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final LocationsService service; + + /** + * The service client containing this operation class. + */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of LocationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LocationsClientImpl(CosmosDBManagementClientImpl client) { + this.service + = RestProxy.create(LocationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientLocations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + public interface LocationsService { + @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> get(@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 along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 as paginated response + * with {@link PagedFlux}. + */ + @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 as paginated response + * with {@link PagedFlux}. + */ + @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 as paginated response + * with {@link PagedIterable}. + */ + @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 as paginated response + * with {@link PagedIterable}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(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.get(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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(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.get(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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String location) { + return getWithResponseAsync(location).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String location, Context context) { + return getWithResponseAsync(location, context).block(); + } + + /** + * 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 get(String location) { + return getWithResponse(location, Context.NONE).getValue(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/LocationsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/LocationsImpl.java new file mode 100644 index 0000000000000..370734e12109f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/LocationsImpl.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.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.LocationsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.LocationGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.LocationGetResult; +import com.azure.resourcemanager.cosmos.generated.models.Locations; + +public final class LocationsImpl implements Locations { + private static final ClientLogger LOGGER = new ClientLogger(LocationsImpl.class); + + private final LocationsClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public LocationsImpl(LocationsClient innerClient, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new LocationGetResultImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new LocationGetResultImpl(inner1, this.manager())); + } + + public Response getWithResponse(String location, Context context) { + Response inner = this.serviceClient().getWithResponse(location, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new LocationGetResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public LocationGetResult get(String location) { + LocationGetResultInner inner = this.serviceClient().get(location); + if (inner != null) { + return new LocationGetResultImpl(inner, this.manager()); + } else { + return null; + } + } + + private LocationsClient 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/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..37c97e8d9d16f --- /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..93021061eca1e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MongoDBCollectionGetResultsImpl.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.MongoDBCollectionGetResultsInner; +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.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 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 String resourceGroupName() { + return resourceGroupName; + } + + 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 = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.databaseName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "mongodbDatabases"); + this.collectionName = ResourceManagerUtils.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 BackupInformation retrieveContinuousBackupInformation(ContinuousBackupRestoreLocation location) { + return serviceManager.mongoDBResources() + .retrieveContinuousBackupInformation(resourceGroupName, accountName, databaseName, collectionName, + location); + } + + public BackupInformation retrieveContinuousBackupInformation(ContinuousBackupRestoreLocation location, + Context context) { + return serviceManager.mongoDBResources() + .retrieveContinuousBackupInformation(resourceGroupName, accountName, databaseName, collectionName, location, + context); + } + + 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 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..574a3bff3e15a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MongoDBDatabaseGetResultsImpl.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.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.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 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 String resourceGroupName() { + return resourceGroupName; + } + + 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 = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.databaseName = ResourceManagerUtils.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 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..e653409d305d4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MongoDBResourcesClientImpl.java @@ -0,0 +1,5700 @@ +// Copyright (c) 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.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.BackupInformationInner; +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.MongoRoleDefinitionGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MongoUserDefinitionGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ThroughputSettingsGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.ContinuousBackupRestoreLocation; +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.MongoRoleDefinitionCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.MongoRoleDefinitionListResult; +import com.azure.resourcemanager.cosmos.generated.models.MongoUserDefinitionCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.MongoUserDefinitionListResult; +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 { + /** + * 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") + public 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); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions/{mongoRoleDefinitionId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getMongoRoleDefinition(@HostParam("$host") String endpoint, + @PathParam("mongoRoleDefinitionId") String mongoRoleDefinitionId, + @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}/mongodbRoleDefinitions/{mongoRoleDefinitionId}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createUpdateMongoRoleDefinition(@HostParam("$host") String endpoint, + @PathParam("mongoRoleDefinitionId") String mongoRoleDefinitionId, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") MongoRoleDefinitionCreateUpdateParameters createUpdateMongoRoleDefinitionParameters, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions/{mongoRoleDefinitionId}") + @ExpectedResponses({ 200, 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> deleteMongoRoleDefinition(@HostParam("$host") String endpoint, + @PathParam("mongoRoleDefinitionId") String mongoRoleDefinitionId, + @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}/mongodbRoleDefinitions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMongoRoleDefinitions(@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}/mongodbUserDefinitions/{mongoUserDefinitionId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getMongoUserDefinition(@HostParam("$host") String endpoint, + @PathParam("mongoUserDefinitionId") String mongoUserDefinitionId, + @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}/mongodbUserDefinitions/{mongoUserDefinitionId}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createUpdateMongoUserDefinition(@HostParam("$host") String endpoint, + @PathParam("mongoUserDefinitionId") String mongoUserDefinitionId, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") MongoUserDefinitionCreateUpdateParameters createUpdateMongoUserDefinitionParameters, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions/{mongoUserDefinitionId}") + @ExpectedResponses({ 200, 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> deleteMongoUserDefinition(@HostParam("$host") String endpoint, + @PathParam("mongoUserDefinitionId") String mongoUserDefinitionId, + @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}/mongodbUserDefinitions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMongoUserDefinitions(@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}/mongodbDatabases/{databaseName}/collections/{collectionName}/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("collectionName") String collectionName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ContinuousBackupRestoreLocation location, + @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 along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 as paginated + * response with {@link PagedFlux}. + */ + @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 as paginated + * response with {@link PagedFlux}. + */ + @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 as paginated + * response with {@link PagedIterable}. + */ + @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 as paginated + * response with {@link PagedIterable}. + */ + @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 along + * with {@link Response} on successful completion of {@link Mono}. + */ + @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 along + * with {@link Response} on successful completion of {@link Mono}. + */ + @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 on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getMongoDBDatabaseAsync(String resourceGroupName, String accountName, + String databaseName) { + return getMongoDBDatabaseWithResponseAsync(resourceGroupName, accountName, databaseName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getMongoDBDatabaseWithResponse(String resourceGroupName, + String accountName, String databaseName, Context context) { + return getMongoDBDatabaseWithResponseAsync(resourceGroupName, accountName, databaseName, context).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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 getMongoDBDatabaseWithResponse(resourceGroupName, accountName, databaseName, Context.NONE).getValue(); + } + + /** + * 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of 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 this + .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 the {@link SyncPoller} for polling of 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 this + .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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link PollerFlux} for polling of long-running operation. + */ + @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, + this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteMongoDBDatabase(String resourceGroupName, String accountName, + String databaseName) { + return this.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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteMongoDBDatabase(String resourceGroupName, String accountName, + String databaseName, Context context) { + return this.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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getMongoDBDatabaseThroughputAsync(String resourceGroupName, + String accountName, String databaseName) { + return getMongoDBDatabaseThroughputWithResponseAsync(resourceGroupName, accountName, databaseName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getMongoDBDatabaseThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context) { + return getMongoDBDatabaseThroughputWithResponseAsync(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) + public ThroughputSettingsGetResultsInner getMongoDBDatabaseThroughput(String resourceGroupName, String accountName, + String databaseName) { + return getMongoDBDatabaseThroughputWithResponse(resourceGroupName, accountName, databaseName, Context.NONE) + .getValue(); + } + + /** + * 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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of 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 this + .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 the {@link SyncPoller} for polling of 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 this + .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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBDatabaseToAutoscale(String resourceGroupName, String accountName, String databaseName) { + return this.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 the {@link SyncPoller} for polling of 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 this.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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBDatabaseToManualThroughput(String resourceGroupName, String accountName, + String databaseName) { + return this.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 the {@link SyncPoller} for polling of 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 this + .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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 as paginated + * response with {@link PagedFlux}. + */ + @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 as paginated + * response with {@link PagedFlux}. + */ + @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 as paginated + * response with {@link PagedIterable}. + */ + @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 as paginated + * response with {@link PagedIterable}. + */ + @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 along with {@link Response} on + * successful completion of {@link Mono}. + */ + @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 along with {@link Response} on + * successful completion of {@link Mono}. + */ + @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 on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getMongoDBCollectionAsync(String resourceGroupName, + String accountName, String databaseName, String collectionName) { + return getMongoDBCollectionWithResponseAsync(resourceGroupName, accountName, databaseName, collectionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 along with {@link Response}. + */ + @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(); + } + + /** + * 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 getMongoDBCollectionWithResponse(resourceGroupName, accountName, databaseName, collectionName, + Context.NONE).getValue(); + } + + /** + * 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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of 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 this + .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 the {@link SyncPoller} for polling of 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 this + .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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link PollerFlux} for polling of long-running operation. + */ + @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, + this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteMongoDBCollection(String resourceGroupName, String accountName, + String databaseName, String collectionName) { + return this.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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteMongoDBCollection(String resourceGroupName, String accountName, + String databaseName, String collectionName, Context context) { + return this + .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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getMongoDBCollectionThroughputAsync(String resourceGroupName, + String accountName, String databaseName, String collectionName) { + return getMongoDBCollectionThroughputWithResponseAsync(resourceGroupName, accountName, databaseName, + collectionName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 along with {@link Response}. + */ + @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(); + } + + /** + * 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 getMongoDBCollectionThroughputWithResponse(resourceGroupName, accountName, databaseName, collectionName, + Context.NONE).getValue(); + } + + /** + * 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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of 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 this + .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 the {@link SyncPoller} for polling of 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 this + .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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of 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 this + .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 the {@link SyncPoller} for polling of 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 this + .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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of 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 this + .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 the {@link SyncPoller} for polling of 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 this + .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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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(); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB Mongo Role Definition with the given Id. + * + * @param mongoRoleDefinitionId The ID for the Role Definition {dbName.roleName}. + * @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 Mongo Role Definition along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getMongoRoleDefinitionWithResponseAsync( + String mongoRoleDefinitionId, 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 (mongoRoleDefinitionId == null) { + return Mono + .error(new IllegalArgumentException("Parameter mongoRoleDefinitionId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("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.getMongoRoleDefinition(this.client.getEndpoint(), mongoRoleDefinitionId, + 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 Mongo Role Definition with the given Id. + * + * @param mongoRoleDefinitionId The ID for the Role Definition {dbName.roleName}. + * @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 Mongo Role Definition along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getMongoRoleDefinitionWithResponseAsync( + String mongoRoleDefinitionId, 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 (mongoRoleDefinitionId == null) { + return Mono + .error(new IllegalArgumentException("Parameter mongoRoleDefinitionId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("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.getMongoRoleDefinition(this.client.getEndpoint(), mongoRoleDefinitionId, + this.client.getSubscriptionId(), resourceGroupName, accountName, this.client.getApiVersion(), accept, + context); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB Mongo Role Definition with the given Id. + * + * @param mongoRoleDefinitionId The ID for the Role Definition {dbName.roleName}. + * @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 Mongo Role Definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getMongoRoleDefinitionAsync(String mongoRoleDefinitionId, + String resourceGroupName, String accountName) { + return getMongoRoleDefinitionWithResponseAsync(mongoRoleDefinitionId, resourceGroupName, accountName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB Mongo Role Definition with the given Id. + * + * @param mongoRoleDefinitionId The ID for the Role Definition {dbName.roleName}. + * @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 Mongo Role Definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getMongoRoleDefinitionWithResponse(String mongoRoleDefinitionId, + String resourceGroupName, String accountName, Context context) { + return getMongoRoleDefinitionWithResponseAsync(mongoRoleDefinitionId, resourceGroupName, accountName, context) + .block(); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB Mongo Role Definition with the given Id. + * + * @param mongoRoleDefinitionId The ID for the Role Definition {dbName.roleName}. + * @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 Mongo Role Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MongoRoleDefinitionGetResultsInner getMongoRoleDefinition(String mongoRoleDefinitionId, + String resourceGroupName, String accountName) { + return getMongoRoleDefinitionWithResponse(mongoRoleDefinitionId, resourceGroupName, accountName, Context.NONE) + .getValue(); + } + + /** + * Creates or updates an Azure Cosmos DB Mongo Role Definition. + * + * @param mongoRoleDefinitionId The ID for the Role Definition {dbName.roleName}. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateMongoRoleDefinitionParameters 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 Mongo Role Definition along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateMongoRoleDefinitionWithResponseAsync( + String mongoRoleDefinitionId, String resourceGroupName, String accountName, + MongoRoleDefinitionCreateUpdateParameters createUpdateMongoRoleDefinitionParameters) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mongoRoleDefinitionId == null) { + return Mono + .error(new IllegalArgumentException("Parameter mongoRoleDefinitionId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (createUpdateMongoRoleDefinitionParameters == null) { + return Mono.error(new IllegalArgumentException( + "Parameter createUpdateMongoRoleDefinitionParameters is required and cannot be null.")); + } else { + createUpdateMongoRoleDefinitionParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createUpdateMongoRoleDefinition(this.client.getEndpoint(), + mongoRoleDefinitionId, this.client.getSubscriptionId(), resourceGroupName, accountName, + this.client.getApiVersion(), createUpdateMongoRoleDefinitionParameters, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates an Azure Cosmos DB Mongo Role Definition. + * + * @param mongoRoleDefinitionId The ID for the Role Definition {dbName.roleName}. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateMongoRoleDefinitionParameters 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 Mongo Role Definition along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateMongoRoleDefinitionWithResponseAsync( + String mongoRoleDefinitionId, String resourceGroupName, String accountName, + MongoRoleDefinitionCreateUpdateParameters createUpdateMongoRoleDefinitionParameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mongoRoleDefinitionId == null) { + return Mono + .error(new IllegalArgumentException("Parameter mongoRoleDefinitionId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (createUpdateMongoRoleDefinitionParameters == null) { + return Mono.error(new IllegalArgumentException( + "Parameter createUpdateMongoRoleDefinitionParameters is required and cannot be null.")); + } else { + createUpdateMongoRoleDefinitionParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createUpdateMongoRoleDefinition(this.client.getEndpoint(), mongoRoleDefinitionId, + this.client.getSubscriptionId(), resourceGroupName, accountName, this.client.getApiVersion(), + createUpdateMongoRoleDefinitionParameters, accept, context); + } + + /** + * Creates or updates an Azure Cosmos DB Mongo Role Definition. + * + * @param mongoRoleDefinitionId The ID for the Role Definition {dbName.roleName}. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateMongoRoleDefinitionParameters 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 the {@link PollerFlux} for polling of an Azure Cosmos DB Mongo Role Definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, MongoRoleDefinitionGetResultsInner> + beginCreateUpdateMongoRoleDefinitionAsync(String mongoRoleDefinitionId, String resourceGroupName, + String accountName, MongoRoleDefinitionCreateUpdateParameters createUpdateMongoRoleDefinitionParameters) { + Mono>> mono = createUpdateMongoRoleDefinitionWithResponseAsync(mongoRoleDefinitionId, + resourceGroupName, accountName, createUpdateMongoRoleDefinitionParameters); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), MongoRoleDefinitionGetResultsInner.class, + MongoRoleDefinitionGetResultsInner.class, this.client.getContext()); + } + + /** + * Creates or updates an Azure Cosmos DB Mongo Role Definition. + * + * @param mongoRoleDefinitionId The ID for the Role Definition {dbName.roleName}. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateMongoRoleDefinitionParameters 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 the {@link PollerFlux} for polling of an Azure Cosmos DB Mongo Role Definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, MongoRoleDefinitionGetResultsInner> + beginCreateUpdateMongoRoleDefinitionAsync(String mongoRoleDefinitionId, String resourceGroupName, + String accountName, MongoRoleDefinitionCreateUpdateParameters createUpdateMongoRoleDefinitionParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = createUpdateMongoRoleDefinitionWithResponseAsync(mongoRoleDefinitionId, + resourceGroupName, accountName, createUpdateMongoRoleDefinitionParameters, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), MongoRoleDefinitionGetResultsInner.class, + MongoRoleDefinitionGetResultsInner.class, context); + } + + /** + * Creates or updates an Azure Cosmos DB Mongo Role Definition. + * + * @param mongoRoleDefinitionId The ID for the Role Definition {dbName.roleName}. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateMongoRoleDefinitionParameters 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 the {@link SyncPoller} for polling of an Azure Cosmos DB Mongo Role Definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, MongoRoleDefinitionGetResultsInner> + beginCreateUpdateMongoRoleDefinition(String mongoRoleDefinitionId, String resourceGroupName, String accountName, + MongoRoleDefinitionCreateUpdateParameters createUpdateMongoRoleDefinitionParameters) { + return this + .beginCreateUpdateMongoRoleDefinitionAsync(mongoRoleDefinitionId, resourceGroupName, accountName, + createUpdateMongoRoleDefinitionParameters) + .getSyncPoller(); + } + + /** + * Creates or updates an Azure Cosmos DB Mongo Role Definition. + * + * @param mongoRoleDefinitionId The ID for the Role Definition {dbName.roleName}. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateMongoRoleDefinitionParameters 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 the {@link SyncPoller} for polling of an Azure Cosmos DB Mongo Role Definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, MongoRoleDefinitionGetResultsInner> + beginCreateUpdateMongoRoleDefinition(String mongoRoleDefinitionId, String resourceGroupName, String accountName, + MongoRoleDefinitionCreateUpdateParameters createUpdateMongoRoleDefinitionParameters, Context context) { + return this + .beginCreateUpdateMongoRoleDefinitionAsync(mongoRoleDefinitionId, resourceGroupName, accountName, + createUpdateMongoRoleDefinitionParameters, context) + .getSyncPoller(); + } + + /** + * Creates or updates an Azure Cosmos DB Mongo Role Definition. + * + * @param mongoRoleDefinitionId The ID for the Role Definition {dbName.roleName}. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateMongoRoleDefinitionParameters 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 Mongo Role Definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateMongoRoleDefinitionAsync(String mongoRoleDefinitionId, + String resourceGroupName, String accountName, + MongoRoleDefinitionCreateUpdateParameters createUpdateMongoRoleDefinitionParameters) { + return beginCreateUpdateMongoRoleDefinitionAsync(mongoRoleDefinitionId, resourceGroupName, accountName, + createUpdateMongoRoleDefinitionParameters).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an Azure Cosmos DB Mongo Role Definition. + * + * @param mongoRoleDefinitionId The ID for the Role Definition {dbName.roleName}. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateMongoRoleDefinitionParameters 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 Mongo Role Definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateMongoRoleDefinitionAsync(String mongoRoleDefinitionId, + String resourceGroupName, String accountName, + MongoRoleDefinitionCreateUpdateParameters createUpdateMongoRoleDefinitionParameters, Context context) { + return beginCreateUpdateMongoRoleDefinitionAsync(mongoRoleDefinitionId, resourceGroupName, accountName, + createUpdateMongoRoleDefinitionParameters, context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an Azure Cosmos DB Mongo Role Definition. + * + * @param mongoRoleDefinitionId The ID for the Role Definition {dbName.roleName}. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateMongoRoleDefinitionParameters 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 Mongo Role Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MongoRoleDefinitionGetResultsInner createUpdateMongoRoleDefinition(String mongoRoleDefinitionId, + String resourceGroupName, String accountName, + MongoRoleDefinitionCreateUpdateParameters createUpdateMongoRoleDefinitionParameters) { + return createUpdateMongoRoleDefinitionAsync(mongoRoleDefinitionId, resourceGroupName, accountName, + createUpdateMongoRoleDefinitionParameters).block(); + } + + /** + * Creates or updates an Azure Cosmos DB Mongo Role Definition. + * + * @param mongoRoleDefinitionId The ID for the Role Definition {dbName.roleName}. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateMongoRoleDefinitionParameters 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 Mongo Role Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MongoRoleDefinitionGetResultsInner createUpdateMongoRoleDefinition(String mongoRoleDefinitionId, + String resourceGroupName, String accountName, + MongoRoleDefinitionCreateUpdateParameters createUpdateMongoRoleDefinitionParameters, Context context) { + return createUpdateMongoRoleDefinitionAsync(mongoRoleDefinitionId, resourceGroupName, accountName, + createUpdateMongoRoleDefinitionParameters, context).block(); + } + + /** + * Deletes an existing Azure Cosmos DB Mongo Role Definition. + * + * @param mongoRoleDefinitionId The ID for the Role Definition {dbName.roleName}. + * @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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteMongoRoleDefinitionWithResponseAsync(String mongoRoleDefinitionId, + 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 (mongoRoleDefinitionId == null) { + return Mono + .error(new IllegalArgumentException("Parameter mongoRoleDefinitionId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("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.deleteMongoRoleDefinition(this.client.getEndpoint(), mongoRoleDefinitionId, + 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 Mongo Role Definition. + * + * @param mongoRoleDefinitionId The ID for the Role Definition {dbName.roleName}. + * @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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteMongoRoleDefinitionWithResponseAsync(String mongoRoleDefinitionId, + 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 (mongoRoleDefinitionId == null) { + return Mono + .error(new IllegalArgumentException("Parameter mongoRoleDefinitionId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("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.deleteMongoRoleDefinition(this.client.getEndpoint(), mongoRoleDefinitionId, + this.client.getSubscriptionId(), resourceGroupName, accountName, this.client.getApiVersion(), accept, + context); + } + + /** + * Deletes an existing Azure Cosmos DB Mongo Role Definition. + * + * @param mongoRoleDefinitionId The ID for the Role Definition {dbName.roleName}. + * @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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteMongoRoleDefinitionAsync(String mongoRoleDefinitionId, + String resourceGroupName, String accountName) { + Mono>> mono + = deleteMongoRoleDefinitionWithResponseAsync(mongoRoleDefinitionId, resourceGroupName, accountName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Deletes an existing Azure Cosmos DB Mongo Role Definition. + * + * @param mongoRoleDefinitionId The ID for the Role Definition {dbName.roleName}. + * @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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteMongoRoleDefinitionAsync(String mongoRoleDefinitionId, + String resourceGroupName, String accountName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteMongoRoleDefinitionWithResponseAsync(mongoRoleDefinitionId, + resourceGroupName, accountName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Deletes an existing Azure Cosmos DB Mongo Role Definition. + * + * @param mongoRoleDefinitionId The ID for the Role Definition {dbName.roleName}. + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteMongoRoleDefinition(String mongoRoleDefinitionId, + String resourceGroupName, String accountName) { + return this.beginDeleteMongoRoleDefinitionAsync(mongoRoleDefinitionId, resourceGroupName, accountName) + .getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB Mongo Role Definition. + * + * @param mongoRoleDefinitionId The ID for the Role Definition {dbName.roleName}. + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteMongoRoleDefinition(String mongoRoleDefinitionId, + String resourceGroupName, String accountName, Context context) { + return this.beginDeleteMongoRoleDefinitionAsync(mongoRoleDefinitionId, resourceGroupName, accountName, context) + .getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB Mongo Role Definition. + * + * @param mongoRoleDefinitionId The ID for the Role Definition {dbName.roleName}. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteMongoRoleDefinitionAsync(String mongoRoleDefinitionId, String resourceGroupName, + String accountName) { + return beginDeleteMongoRoleDefinitionAsync(mongoRoleDefinitionId, resourceGroupName, accountName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB Mongo Role Definition. + * + * @param mongoRoleDefinitionId The ID for the Role Definition {dbName.roleName}. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteMongoRoleDefinitionAsync(String mongoRoleDefinitionId, String resourceGroupName, + String accountName, Context context) { + return beginDeleteMongoRoleDefinitionAsync(mongoRoleDefinitionId, resourceGroupName, accountName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB Mongo Role Definition. + * + * @param mongoRoleDefinitionId The ID for the Role Definition {dbName.roleName}. + * @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 deleteMongoRoleDefinition(String mongoRoleDefinitionId, String resourceGroupName, String accountName) { + deleteMongoRoleDefinitionAsync(mongoRoleDefinitionId, resourceGroupName, accountName).block(); + } + + /** + * Deletes an existing Azure Cosmos DB Mongo Role Definition. + * + * @param mongoRoleDefinitionId The ID for the Role Definition {dbName.roleName}. + * @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 deleteMongoRoleDefinition(String mongoRoleDefinitionId, String resourceGroupName, String accountName, + Context context) { + deleteMongoRoleDefinitionAsync(mongoRoleDefinitionId, resourceGroupName, accountName, context).block(); + } + + /** + * Retrieves the list of all Azure Cosmos DB Mongo 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 Mongo Role Definitions along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listMongoRoleDefinitionsSinglePageAsync(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.listMongoRoleDefinitions(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 Mongo 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 Mongo Role Definitions along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listMongoRoleDefinitionsSinglePageAsync(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 + .listMongoRoleDefinitions(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 Mongo 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 Mongo Role Definitions as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMongoRoleDefinitionsAsync(String resourceGroupName, + String accountName) { + return new PagedFlux<>(() -> listMongoRoleDefinitionsSinglePageAsync(resourceGroupName, accountName)); + } + + /** + * Retrieves the list of all Azure Cosmos DB Mongo 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 Mongo Role Definitions as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMongoRoleDefinitionsAsync(String resourceGroupName, + String accountName, Context context) { + return new PagedFlux<>(() -> listMongoRoleDefinitionsSinglePageAsync(resourceGroupName, accountName, context)); + } + + /** + * Retrieves the list of all Azure Cosmos DB Mongo 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 Mongo Role Definitions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMongoRoleDefinitions(String resourceGroupName, + String accountName) { + return new PagedIterable<>(listMongoRoleDefinitionsAsync(resourceGroupName, accountName)); + } + + /** + * Retrieves the list of all Azure Cosmos DB Mongo 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 Mongo Role Definitions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMongoRoleDefinitions(String resourceGroupName, + String accountName, Context context) { + return new PagedIterable<>(listMongoRoleDefinitionsAsync(resourceGroupName, accountName, context)); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB Mongo User Definition with the given Id. + * + * @param mongoUserDefinitionId The ID for the User Definition {dbName.userName}. + * @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 User Definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getMongoUserDefinitionWithResponseAsync( + String mongoUserDefinitionId, 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 (mongoUserDefinitionId == null) { + return Mono + .error(new IllegalArgumentException("Parameter mongoUserDefinitionId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("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.getMongoUserDefinition(this.client.getEndpoint(), mongoUserDefinitionId, + 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 Mongo User Definition with the given Id. + * + * @param mongoUserDefinitionId The ID for the User Definition {dbName.userName}. + * @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 User Definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getMongoUserDefinitionWithResponseAsync( + String mongoUserDefinitionId, 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 (mongoUserDefinitionId == null) { + return Mono + .error(new IllegalArgumentException("Parameter mongoUserDefinitionId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("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.getMongoUserDefinition(this.client.getEndpoint(), mongoUserDefinitionId, + this.client.getSubscriptionId(), resourceGroupName, accountName, this.client.getApiVersion(), accept, + context); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB Mongo User Definition with the given Id. + * + * @param mongoUserDefinitionId The ID for the User Definition {dbName.userName}. + * @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 User Definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getMongoUserDefinitionAsync(String mongoUserDefinitionId, + String resourceGroupName, String accountName) { + return getMongoUserDefinitionWithResponseAsync(mongoUserDefinitionId, resourceGroupName, accountName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB Mongo User Definition with the given Id. + * + * @param mongoUserDefinitionId The ID for the User Definition {dbName.userName}. + * @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 User Definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getMongoUserDefinitionWithResponse(String mongoUserDefinitionId, + String resourceGroupName, String accountName, Context context) { + return getMongoUserDefinitionWithResponseAsync(mongoUserDefinitionId, resourceGroupName, accountName, context) + .block(); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB Mongo User Definition with the given Id. + * + * @param mongoUserDefinitionId The ID for the User Definition {dbName.userName}. + * @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 User Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MongoUserDefinitionGetResultsInner getMongoUserDefinition(String mongoUserDefinitionId, + String resourceGroupName, String accountName) { + return getMongoUserDefinitionWithResponse(mongoUserDefinitionId, resourceGroupName, accountName, Context.NONE) + .getValue(); + } + + /** + * Creates or updates an Azure Cosmos DB Mongo User Definition. + * + * @param mongoUserDefinitionId The ID for the User Definition {dbName.userName}. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateMongoUserDefinitionParameters The properties required to create or update a User 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 User Definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateMongoUserDefinitionWithResponseAsync( + String mongoUserDefinitionId, String resourceGroupName, String accountName, + MongoUserDefinitionCreateUpdateParameters createUpdateMongoUserDefinitionParameters) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mongoUserDefinitionId == null) { + return Mono + .error(new IllegalArgumentException("Parameter mongoUserDefinitionId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (createUpdateMongoUserDefinitionParameters == null) { + return Mono.error(new IllegalArgumentException( + "Parameter createUpdateMongoUserDefinitionParameters is required and cannot be null.")); + } else { + createUpdateMongoUserDefinitionParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createUpdateMongoUserDefinition(this.client.getEndpoint(), + mongoUserDefinitionId, this.client.getSubscriptionId(), resourceGroupName, accountName, + this.client.getApiVersion(), createUpdateMongoUserDefinitionParameters, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates an Azure Cosmos DB Mongo User Definition. + * + * @param mongoUserDefinitionId The ID for the User Definition {dbName.userName}. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateMongoUserDefinitionParameters The properties required to create or update a User 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 User Definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateMongoUserDefinitionWithResponseAsync( + String mongoUserDefinitionId, String resourceGroupName, String accountName, + MongoUserDefinitionCreateUpdateParameters createUpdateMongoUserDefinitionParameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mongoUserDefinitionId == null) { + return Mono + .error(new IllegalArgumentException("Parameter mongoUserDefinitionId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (createUpdateMongoUserDefinitionParameters == null) { + return Mono.error(new IllegalArgumentException( + "Parameter createUpdateMongoUserDefinitionParameters is required and cannot be null.")); + } else { + createUpdateMongoUserDefinitionParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createUpdateMongoUserDefinition(this.client.getEndpoint(), mongoUserDefinitionId, + this.client.getSubscriptionId(), resourceGroupName, accountName, this.client.getApiVersion(), + createUpdateMongoUserDefinitionParameters, accept, context); + } + + /** + * Creates or updates an Azure Cosmos DB Mongo User Definition. + * + * @param mongoUserDefinitionId The ID for the User Definition {dbName.userName}. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateMongoUserDefinitionParameters The properties required to create or update a User 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 the {@link PollerFlux} for polling of an Azure Cosmos DB User Definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, MongoUserDefinitionGetResultsInner> + beginCreateUpdateMongoUserDefinitionAsync(String mongoUserDefinitionId, String resourceGroupName, + String accountName, MongoUserDefinitionCreateUpdateParameters createUpdateMongoUserDefinitionParameters) { + Mono>> mono = createUpdateMongoUserDefinitionWithResponseAsync(mongoUserDefinitionId, + resourceGroupName, accountName, createUpdateMongoUserDefinitionParameters); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), MongoUserDefinitionGetResultsInner.class, + MongoUserDefinitionGetResultsInner.class, this.client.getContext()); + } + + /** + * Creates or updates an Azure Cosmos DB Mongo User Definition. + * + * @param mongoUserDefinitionId The ID for the User Definition {dbName.userName}. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateMongoUserDefinitionParameters The properties required to create or update a User 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 the {@link PollerFlux} for polling of an Azure Cosmos DB User Definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, MongoUserDefinitionGetResultsInner> + beginCreateUpdateMongoUserDefinitionAsync(String mongoUserDefinitionId, String resourceGroupName, + String accountName, MongoUserDefinitionCreateUpdateParameters createUpdateMongoUserDefinitionParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = createUpdateMongoUserDefinitionWithResponseAsync(mongoUserDefinitionId, + resourceGroupName, accountName, createUpdateMongoUserDefinitionParameters, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), MongoUserDefinitionGetResultsInner.class, + MongoUserDefinitionGetResultsInner.class, context); + } + + /** + * Creates or updates an Azure Cosmos DB Mongo User Definition. + * + * @param mongoUserDefinitionId The ID for the User Definition {dbName.userName}. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateMongoUserDefinitionParameters The properties required to create or update a User 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 the {@link SyncPoller} for polling of an Azure Cosmos DB User Definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, MongoUserDefinitionGetResultsInner> + beginCreateUpdateMongoUserDefinition(String mongoUserDefinitionId, String resourceGroupName, String accountName, + MongoUserDefinitionCreateUpdateParameters createUpdateMongoUserDefinitionParameters) { + return this + .beginCreateUpdateMongoUserDefinitionAsync(mongoUserDefinitionId, resourceGroupName, accountName, + createUpdateMongoUserDefinitionParameters) + .getSyncPoller(); + } + + /** + * Creates or updates an Azure Cosmos DB Mongo User Definition. + * + * @param mongoUserDefinitionId The ID for the User Definition {dbName.userName}. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateMongoUserDefinitionParameters The properties required to create or update a User 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 the {@link SyncPoller} for polling of an Azure Cosmos DB User Definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, MongoUserDefinitionGetResultsInner> + beginCreateUpdateMongoUserDefinition(String mongoUserDefinitionId, String resourceGroupName, String accountName, + MongoUserDefinitionCreateUpdateParameters createUpdateMongoUserDefinitionParameters, Context context) { + return this + .beginCreateUpdateMongoUserDefinitionAsync(mongoUserDefinitionId, resourceGroupName, accountName, + createUpdateMongoUserDefinitionParameters, context) + .getSyncPoller(); + } + + /** + * Creates or updates an Azure Cosmos DB Mongo User Definition. + * + * @param mongoUserDefinitionId The ID for the User Definition {dbName.userName}. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateMongoUserDefinitionParameters The properties required to create or update a User 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 User Definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateMongoUserDefinitionAsync(String mongoUserDefinitionId, + String resourceGroupName, String accountName, + MongoUserDefinitionCreateUpdateParameters createUpdateMongoUserDefinitionParameters) { + return beginCreateUpdateMongoUserDefinitionAsync(mongoUserDefinitionId, resourceGroupName, accountName, + createUpdateMongoUserDefinitionParameters).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an Azure Cosmos DB Mongo User Definition. + * + * @param mongoUserDefinitionId The ID for the User Definition {dbName.userName}. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateMongoUserDefinitionParameters The properties required to create or update a User 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 User Definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateMongoUserDefinitionAsync(String mongoUserDefinitionId, + String resourceGroupName, String accountName, + MongoUserDefinitionCreateUpdateParameters createUpdateMongoUserDefinitionParameters, Context context) { + return beginCreateUpdateMongoUserDefinitionAsync(mongoUserDefinitionId, resourceGroupName, accountName, + createUpdateMongoUserDefinitionParameters, context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an Azure Cosmos DB Mongo User Definition. + * + * @param mongoUserDefinitionId The ID for the User Definition {dbName.userName}. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateMongoUserDefinitionParameters The properties required to create or update a User 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 User Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MongoUserDefinitionGetResultsInner createUpdateMongoUserDefinition(String mongoUserDefinitionId, + String resourceGroupName, String accountName, + MongoUserDefinitionCreateUpdateParameters createUpdateMongoUserDefinitionParameters) { + return createUpdateMongoUserDefinitionAsync(mongoUserDefinitionId, resourceGroupName, accountName, + createUpdateMongoUserDefinitionParameters).block(); + } + + /** + * Creates or updates an Azure Cosmos DB Mongo User Definition. + * + * @param mongoUserDefinitionId The ID for the User Definition {dbName.userName}. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateMongoUserDefinitionParameters The properties required to create or update a User 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 User Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MongoUserDefinitionGetResultsInner createUpdateMongoUserDefinition(String mongoUserDefinitionId, + String resourceGroupName, String accountName, + MongoUserDefinitionCreateUpdateParameters createUpdateMongoUserDefinitionParameters, Context context) { + return createUpdateMongoUserDefinitionAsync(mongoUserDefinitionId, resourceGroupName, accountName, + createUpdateMongoUserDefinitionParameters, context).block(); + } + + /** + * Deletes an existing Azure Cosmos DB Mongo User Definition. + * + * @param mongoUserDefinitionId The ID for the User Definition {dbName.userName}. + * @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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteMongoUserDefinitionWithResponseAsync(String mongoUserDefinitionId, + 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 (mongoUserDefinitionId == null) { + return Mono + .error(new IllegalArgumentException("Parameter mongoUserDefinitionId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("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.deleteMongoUserDefinition(this.client.getEndpoint(), mongoUserDefinitionId, + 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 Mongo User Definition. + * + * @param mongoUserDefinitionId The ID for the User Definition {dbName.userName}. + * @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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteMongoUserDefinitionWithResponseAsync(String mongoUserDefinitionId, + 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 (mongoUserDefinitionId == null) { + return Mono + .error(new IllegalArgumentException("Parameter mongoUserDefinitionId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("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.deleteMongoUserDefinition(this.client.getEndpoint(), mongoUserDefinitionId, + this.client.getSubscriptionId(), resourceGroupName, accountName, this.client.getApiVersion(), accept, + context); + } + + /** + * Deletes an existing Azure Cosmos DB Mongo User Definition. + * + * @param mongoUserDefinitionId The ID for the User Definition {dbName.userName}. + * @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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteMongoUserDefinitionAsync(String mongoUserDefinitionId, + String resourceGroupName, String accountName) { + Mono>> mono + = deleteMongoUserDefinitionWithResponseAsync(mongoUserDefinitionId, resourceGroupName, accountName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Deletes an existing Azure Cosmos DB Mongo User Definition. + * + * @param mongoUserDefinitionId The ID for the User Definition {dbName.userName}. + * @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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteMongoUserDefinitionAsync(String mongoUserDefinitionId, + String resourceGroupName, String accountName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteMongoUserDefinitionWithResponseAsync(mongoUserDefinitionId, + resourceGroupName, accountName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Deletes an existing Azure Cosmos DB Mongo User Definition. + * + * @param mongoUserDefinitionId The ID for the User Definition {dbName.userName}. + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteMongoUserDefinition(String mongoUserDefinitionId, + String resourceGroupName, String accountName) { + return this.beginDeleteMongoUserDefinitionAsync(mongoUserDefinitionId, resourceGroupName, accountName) + .getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB Mongo User Definition. + * + * @param mongoUserDefinitionId The ID for the User Definition {dbName.userName}. + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteMongoUserDefinition(String mongoUserDefinitionId, + String resourceGroupName, String accountName, Context context) { + return this.beginDeleteMongoUserDefinitionAsync(mongoUserDefinitionId, resourceGroupName, accountName, context) + .getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB Mongo User Definition. + * + * @param mongoUserDefinitionId The ID for the User Definition {dbName.userName}. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteMongoUserDefinitionAsync(String mongoUserDefinitionId, String resourceGroupName, + String accountName) { + return beginDeleteMongoUserDefinitionAsync(mongoUserDefinitionId, resourceGroupName, accountName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB Mongo User Definition. + * + * @param mongoUserDefinitionId The ID for the User Definition {dbName.userName}. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteMongoUserDefinitionAsync(String mongoUserDefinitionId, String resourceGroupName, + String accountName, Context context) { + return beginDeleteMongoUserDefinitionAsync(mongoUserDefinitionId, resourceGroupName, accountName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB Mongo User Definition. + * + * @param mongoUserDefinitionId The ID for the User Definition {dbName.userName}. + * @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 deleteMongoUserDefinition(String mongoUserDefinitionId, String resourceGroupName, String accountName) { + deleteMongoUserDefinitionAsync(mongoUserDefinitionId, resourceGroupName, accountName).block(); + } + + /** + * Deletes an existing Azure Cosmos DB Mongo User Definition. + * + * @param mongoUserDefinitionId The ID for the User Definition {dbName.userName}. + * @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 deleteMongoUserDefinition(String mongoUserDefinitionId, String resourceGroupName, String accountName, + Context context) { + deleteMongoUserDefinitionAsync(mongoUserDefinitionId, resourceGroupName, accountName, context).block(); + } + + /** + * Retrieves the list of all Azure Cosmos DB Mongo User 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 relevant User Definition along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listMongoUserDefinitionsSinglePageAsync(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.listMongoUserDefinitions(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 Mongo User 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 relevant User Definition along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listMongoUserDefinitionsSinglePageAsync(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 + .listMongoUserDefinitions(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 Mongo User 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 relevant User Definition as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMongoUserDefinitionsAsync(String resourceGroupName, + String accountName) { + return new PagedFlux<>(() -> listMongoUserDefinitionsSinglePageAsync(resourceGroupName, accountName)); + } + + /** + * Retrieves the list of all Azure Cosmos DB Mongo User 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 relevant User Definition as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMongoUserDefinitionsAsync(String resourceGroupName, + String accountName, Context context) { + return new PagedFlux<>(() -> listMongoUserDefinitionsSinglePageAsync(resourceGroupName, accountName, context)); + } + + /** + * Retrieves the list of all Azure Cosmos DB Mongo User 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 relevant User Definition as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMongoUserDefinitions(String resourceGroupName, + String accountName) { + return new PagedIterable<>(listMongoUserDefinitionsAsync(resourceGroupName, accountName)); + } + + /** + * Retrieves the list of all Azure Cosmos DB Mongo User 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 relevant User Definition as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMongoUserDefinitions(String resourceGroupName, + String accountName, Context context) { + return new PagedIterable<>(listMongoUserDefinitionsAsync(resourceGroupName, accountName, context)); + } + + /** + * Retrieves continuous backup information for a 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 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> retrieveContinuousBackupInformationWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName, + 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 (collectionName == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionName 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, collectionName, + this.client.getApiVersion(), location, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves continuous backup information for a 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 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> retrieveContinuousBackupInformationWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName, + 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 (collectionName == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionName 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, collectionName, this.client.getApiVersion(), location, accept, + context); + } + + /** + * Retrieves continuous backup information for a 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 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 the {@link PollerFlux} for polling of backup information of a resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, BackupInformationInner> + beginRetrieveContinuousBackupInformationAsync(String resourceGroupName, String accountName, String databaseName, + String collectionName, ContinuousBackupRestoreLocation location) { + Mono>> mono = retrieveContinuousBackupInformationWithResponseAsync(resourceGroupName, + accountName, databaseName, collectionName, location); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), BackupInformationInner.class, BackupInformationInner.class, + this.client.getContext()); + } + + /** + * Retrieves continuous backup information for a 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 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 the {@link PollerFlux} for polling of backup information of a resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, BackupInformationInner> + beginRetrieveContinuousBackupInformationAsync(String resourceGroupName, String accountName, String databaseName, + String collectionName, ContinuousBackupRestoreLocation location, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = retrieveContinuousBackupInformationWithResponseAsync(resourceGroupName, + accountName, databaseName, collectionName, location, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), BackupInformationInner.class, BackupInformationInner.class, context); + } + + /** + * Retrieves continuous backup information for a 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 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 the {@link SyncPoller} for polling of backup information of a resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, BackupInformationInner> + beginRetrieveContinuousBackupInformation(String resourceGroupName, String accountName, String databaseName, + String collectionName, ContinuousBackupRestoreLocation location) { + return this + .beginRetrieveContinuousBackupInformationAsync(resourceGroupName, accountName, databaseName, collectionName, + location) + .getSyncPoller(); + } + + /** + * Retrieves continuous backup information for a 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 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 the {@link SyncPoller} for polling of backup information of a resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, BackupInformationInner> + beginRetrieveContinuousBackupInformation(String resourceGroupName, String accountName, String databaseName, + String collectionName, ContinuousBackupRestoreLocation location, Context context) { + return this + .beginRetrieveContinuousBackupInformationAsync(resourceGroupName, accountName, databaseName, collectionName, + location, context) + .getSyncPoller(); + } + + /** + * Retrieves continuous backup information for a 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 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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono retrieveContinuousBackupInformationAsync(String resourceGroupName, + String accountName, String databaseName, String collectionName, ContinuousBackupRestoreLocation location) { + return beginRetrieveContinuousBackupInformationAsync(resourceGroupName, accountName, databaseName, + collectionName, location).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Retrieves continuous backup information for a 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 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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono retrieveContinuousBackupInformationAsync(String resourceGroupName, + String accountName, String databaseName, String collectionName, ContinuousBackupRestoreLocation location, + Context context) { + return beginRetrieveContinuousBackupInformationAsync(resourceGroupName, accountName, databaseName, + collectionName, location, context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Retrieves continuous backup information for a 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 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 collectionName, ContinuousBackupRestoreLocation location) { + return retrieveContinuousBackupInformationAsync(resourceGroupName, accountName, databaseName, collectionName, + location).block(); + } + + /** + * Retrieves continuous backup information for a 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 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 collectionName, ContinuousBackupRestoreLocation location, Context context) { + return retrieveContinuousBackupInformationAsync(resourceGroupName, accountName, databaseName, collectionName, + location, 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..c3c930be11bfe --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MongoDBResourcesImpl.java @@ -0,0 +1,797 @@ +// Copyright (c) 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.BackupInformationInner; +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.MongoRoleDefinitionGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MongoUserDefinitionGetResultsInner; +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.MongoDBCollectionGetResults; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBDatabaseGetResults; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBResources; +import com.azure.resourcemanager.cosmos.generated.models.MongoRoleDefinitionGetResults; +import com.azure.resourcemanager.cosmos.generated.models.MongoUserDefinitionGetResults; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsGetResults; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; + +public final class MongoDBResourcesImpl implements MongoDBResources { + private static 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 ResourceManagerUtils.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 ResourceManagerUtils.mapPage(inner, inner1 -> new MongoDBDatabaseGetResultsImpl(inner1, this.manager())); + } + + 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 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 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 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 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 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 ResourceManagerUtils.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 ResourceManagerUtils.mapPage(inner, + inner1 -> new MongoDBCollectionGetResultsImpl(inner1, this.manager())); + } + + 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 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 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 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 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 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 Response getMongoRoleDefinitionWithResponse(String mongoRoleDefinitionId, + String resourceGroupName, String accountName, Context context) { + Response inner = this.serviceClient() + .getMongoRoleDefinitionWithResponse(mongoRoleDefinitionId, resourceGroupName, accountName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new MongoRoleDefinitionGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public MongoRoleDefinitionGetResults getMongoRoleDefinition(String mongoRoleDefinitionId, String resourceGroupName, + String accountName) { + MongoRoleDefinitionGetResultsInner inner + = this.serviceClient().getMongoRoleDefinition(mongoRoleDefinitionId, resourceGroupName, accountName); + if (inner != null) { + return new MongoRoleDefinitionGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteMongoRoleDefinition(String mongoRoleDefinitionId, String resourceGroupName, String accountName) { + this.serviceClient().deleteMongoRoleDefinition(mongoRoleDefinitionId, resourceGroupName, accountName); + } + + public void deleteMongoRoleDefinition(String mongoRoleDefinitionId, String resourceGroupName, String accountName, + Context context) { + this.serviceClient().deleteMongoRoleDefinition(mongoRoleDefinitionId, resourceGroupName, accountName, context); + } + + public PagedIterable listMongoRoleDefinitions(String resourceGroupName, + String accountName) { + PagedIterable inner + = this.serviceClient().listMongoRoleDefinitions(resourceGroupName, accountName); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new MongoRoleDefinitionGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listMongoRoleDefinitions(String resourceGroupName, + String accountName, Context context) { + PagedIterable inner + = this.serviceClient().listMongoRoleDefinitions(resourceGroupName, accountName, context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new MongoRoleDefinitionGetResultsImpl(inner1, this.manager())); + } + + public Response getMongoUserDefinitionWithResponse(String mongoUserDefinitionId, + String resourceGroupName, String accountName, Context context) { + Response inner = this.serviceClient() + .getMongoUserDefinitionWithResponse(mongoUserDefinitionId, resourceGroupName, accountName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new MongoUserDefinitionGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public MongoUserDefinitionGetResults getMongoUserDefinition(String mongoUserDefinitionId, String resourceGroupName, + String accountName) { + MongoUserDefinitionGetResultsInner inner + = this.serviceClient().getMongoUserDefinition(mongoUserDefinitionId, resourceGroupName, accountName); + if (inner != null) { + return new MongoUserDefinitionGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteMongoUserDefinition(String mongoUserDefinitionId, String resourceGroupName, String accountName) { + this.serviceClient().deleteMongoUserDefinition(mongoUserDefinitionId, resourceGroupName, accountName); + } + + public void deleteMongoUserDefinition(String mongoUserDefinitionId, String resourceGroupName, String accountName, + Context context) { + this.serviceClient().deleteMongoUserDefinition(mongoUserDefinitionId, resourceGroupName, accountName, context); + } + + public PagedIterable listMongoUserDefinitions(String resourceGroupName, + String accountName) { + PagedIterable inner + = this.serviceClient().listMongoUserDefinitions(resourceGroupName, accountName); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new MongoUserDefinitionGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listMongoUserDefinitions(String resourceGroupName, + String accountName, Context context) { + PagedIterable inner + = this.serviceClient().listMongoUserDefinitions(resourceGroupName, accountName, context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new MongoUserDefinitionGetResultsImpl(inner1, this.manager())); + } + + public BackupInformation retrieveContinuousBackupInformation(String resourceGroupName, String accountName, + String databaseName, String collectionName, ContinuousBackupRestoreLocation location) { + BackupInformationInner inner = this.serviceClient() + .retrieveContinuousBackupInformation(resourceGroupName, accountName, databaseName, collectionName, + location); + if (inner != null) { + return new BackupInformationImpl(inner, this.manager()); + } else { + return null; + } + } + + public BackupInformation retrieveContinuousBackupInformation(String resourceGroupName, String accountName, + String databaseName, String collectionName, ContinuousBackupRestoreLocation location, Context context) { + BackupInformationInner inner = this.serviceClient() + .retrieveContinuousBackupInformation(resourceGroupName, accountName, databaseName, collectionName, location, + context); + if (inner != null) { + return new BackupInformationImpl(inner, this.manager()); + } else { + return null; + } + } + + public MongoDBDatabaseGetResults getMongoDBDatabaseById(String id) { + String resourceGroupName = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 MongoRoleDefinitionGetResults getMongoRoleDefinitionById(String id) { + String mongoRoleDefinitionId = ResourceManagerUtils.getValueFromIdByName(id, "mongodbRoleDefinitions"); + if (mongoRoleDefinitionId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'mongodbRoleDefinitions'.", id))); + } + String resourceGroupName = ResourceManagerUtils.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 = ResourceManagerUtils.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 + .getMongoRoleDefinitionWithResponse(mongoRoleDefinitionId, resourceGroupName, accountName, Context.NONE) + .getValue(); + } + + public Response getMongoRoleDefinitionByIdWithResponse(String id, Context context) { + String mongoRoleDefinitionId = ResourceManagerUtils.getValueFromIdByName(id, "mongodbRoleDefinitions"); + if (mongoRoleDefinitionId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'mongodbRoleDefinitions'.", id))); + } + String resourceGroupName = ResourceManagerUtils.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 = ResourceManagerUtils.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.getMongoRoleDefinitionWithResponse(mongoRoleDefinitionId, resourceGroupName, accountName, context); + } + + public MongoUserDefinitionGetResults getMongoUserDefinitionById(String id) { + String mongoUserDefinitionId = ResourceManagerUtils.getValueFromIdByName(id, "mongodbUserDefinitions"); + if (mongoUserDefinitionId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'mongodbUserDefinitions'.", id))); + } + String resourceGroupName = ResourceManagerUtils.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 = ResourceManagerUtils.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 + .getMongoUserDefinitionWithResponse(mongoUserDefinitionId, resourceGroupName, accountName, Context.NONE) + .getValue(); + } + + public Response getMongoUserDefinitionByIdWithResponse(String id, Context context) { + String mongoUserDefinitionId = ResourceManagerUtils.getValueFromIdByName(id, "mongodbUserDefinitions"); + if (mongoUserDefinitionId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'mongodbUserDefinitions'.", id))); + } + String resourceGroupName = ResourceManagerUtils.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 = ResourceManagerUtils.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.getMongoUserDefinitionWithResponse(mongoUserDefinitionId, resourceGroupName, accountName, context); + } + + public void deleteMongoDBDatabaseById(String id) { + String resourceGroupName = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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); + } + + public void deleteMongoRoleDefinitionById(String id) { + String mongoRoleDefinitionId = ResourceManagerUtils.getValueFromIdByName(id, "mongodbRoleDefinitions"); + if (mongoRoleDefinitionId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'mongodbRoleDefinitions'.", id))); + } + String resourceGroupName = ResourceManagerUtils.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 = ResourceManagerUtils.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.deleteMongoRoleDefinition(mongoRoleDefinitionId, resourceGroupName, accountName, Context.NONE); + } + + public void deleteMongoRoleDefinitionByIdWithResponse(String id, Context context) { + String mongoRoleDefinitionId = ResourceManagerUtils.getValueFromIdByName(id, "mongodbRoleDefinitions"); + if (mongoRoleDefinitionId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'mongodbRoleDefinitions'.", id))); + } + String resourceGroupName = ResourceManagerUtils.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 = ResourceManagerUtils.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.deleteMongoRoleDefinition(mongoRoleDefinitionId, resourceGroupName, accountName, context); + } + + public void deleteMongoUserDefinitionById(String id) { + String mongoUserDefinitionId = ResourceManagerUtils.getValueFromIdByName(id, "mongodbUserDefinitions"); + if (mongoUserDefinitionId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'mongodbUserDefinitions'.", id))); + } + String resourceGroupName = ResourceManagerUtils.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 = ResourceManagerUtils.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.deleteMongoUserDefinition(mongoUserDefinitionId, resourceGroupName, accountName, Context.NONE); + } + + public void deleteMongoUserDefinitionByIdWithResponse(String id, Context context) { + String mongoUserDefinitionId = ResourceManagerUtils.getValueFromIdByName(id, "mongodbUserDefinitions"); + if (mongoUserDefinitionId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'mongodbUserDefinitions'.", id))); + } + String resourceGroupName = ResourceManagerUtils.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 = ResourceManagerUtils.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.deleteMongoUserDefinition(mongoUserDefinitionId, resourceGroupName, accountName, 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()); + } + + public MongoRoleDefinitionGetResultsImpl defineUpdateMongoRoleDefinition(String name) { + return new MongoRoleDefinitionGetResultsImpl(name, this.manager()); + } + + public MongoUserDefinitionGetResultsImpl defineUpdateMongoUserDefinition(String name) { + return new MongoUserDefinitionGetResultsImpl(name, this.manager()); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MongoRoleDefinitionGetResultsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MongoRoleDefinitionGetResultsImpl.java new file mode 100644 index 0000000000000..4e5c0c8de9f43 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MongoRoleDefinitionGetResultsImpl.java @@ -0,0 +1,217 @@ +// Copyright (c) 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.MongoRoleDefinitionGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.MongoRoleDefinitionCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.MongoRoleDefinitionGetResults; +import com.azure.resourcemanager.cosmos.generated.models.MongoRoleDefinitionType; +import com.azure.resourcemanager.cosmos.generated.models.Privilege; +import com.azure.resourcemanager.cosmos.generated.models.Role; +import java.util.Collections; +import java.util.List; + +public final class MongoRoleDefinitionGetResultsImpl implements MongoRoleDefinitionGetResults, + MongoRoleDefinitionGetResults.Definition, MongoRoleDefinitionGetResults.Update { + private MongoRoleDefinitionGetResultsInner 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 MongoRoleDefinitionType typePropertiesType() { + return this.innerModel().typePropertiesType(); + } + + public String databaseName() { + return this.innerModel().databaseName(); + } + + public List privileges() { + List inner = this.innerModel().privileges(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List roles() { + List inner = this.innerModel().roles(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public MongoRoleDefinitionGetResultsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + private String mongoRoleDefinitionId; + + private String resourceGroupName; + + private String accountName; + + private MongoRoleDefinitionCreateUpdateParameters createCreateUpdateMongoRoleDefinitionParameters; + + private MongoRoleDefinitionCreateUpdateParameters updateCreateUpdateMongoRoleDefinitionParameters; + + public MongoRoleDefinitionGetResultsImpl withExistingDatabaseAccount(String resourceGroupName, String accountName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + return this; + } + + public MongoRoleDefinitionGetResults create() { + this.innerObject = serviceManager.serviceClient() + .getMongoDBResources() + .createUpdateMongoRoleDefinition(mongoRoleDefinitionId, resourceGroupName, accountName, + createCreateUpdateMongoRoleDefinitionParameters, Context.NONE); + return this; + } + + public MongoRoleDefinitionGetResults create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getMongoDBResources() + .createUpdateMongoRoleDefinition(mongoRoleDefinitionId, resourceGroupName, accountName, + createCreateUpdateMongoRoleDefinitionParameters, context); + return this; + } + + MongoRoleDefinitionGetResultsImpl(String name, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = new MongoRoleDefinitionGetResultsInner(); + this.serviceManager = serviceManager; + this.mongoRoleDefinitionId = name; + this.createCreateUpdateMongoRoleDefinitionParameters = new MongoRoleDefinitionCreateUpdateParameters(); + } + + public MongoRoleDefinitionGetResultsImpl update() { + this.updateCreateUpdateMongoRoleDefinitionParameters = new MongoRoleDefinitionCreateUpdateParameters(); + return this; + } + + public MongoRoleDefinitionGetResults apply() { + this.innerObject = serviceManager.serviceClient() + .getMongoDBResources() + .createUpdateMongoRoleDefinition(mongoRoleDefinitionId, resourceGroupName, accountName, + updateCreateUpdateMongoRoleDefinitionParameters, Context.NONE); + return this; + } + + public MongoRoleDefinitionGetResults apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getMongoDBResources() + .createUpdateMongoRoleDefinition(mongoRoleDefinitionId, resourceGroupName, accountName, + updateCreateUpdateMongoRoleDefinitionParameters, context); + return this; + } + + MongoRoleDefinitionGetResultsImpl(MongoRoleDefinitionGetResultsInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.mongoRoleDefinitionId + = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "mongodbRoleDefinitions"); + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + } + + public MongoRoleDefinitionGetResults refresh() { + this.innerObject = serviceManager.serviceClient() + .getMongoDBResources() + .getMongoRoleDefinitionWithResponse(mongoRoleDefinitionId, resourceGroupName, accountName, Context.NONE) + .getValue(); + return this; + } + + public MongoRoleDefinitionGetResults refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getMongoDBResources() + .getMongoRoleDefinitionWithResponse(mongoRoleDefinitionId, resourceGroupName, accountName, context) + .getValue(); + return this; + } + + public MongoRoleDefinitionGetResultsImpl withRoleName(String roleName) { + if (isInCreateMode()) { + this.createCreateUpdateMongoRoleDefinitionParameters.withRoleName(roleName); + return this; + } else { + this.updateCreateUpdateMongoRoleDefinitionParameters.withRoleName(roleName); + return this; + } + } + + public MongoRoleDefinitionGetResultsImpl withType(MongoRoleDefinitionType type) { + if (isInCreateMode()) { + this.createCreateUpdateMongoRoleDefinitionParameters.withType(type); + return this; + } else { + this.updateCreateUpdateMongoRoleDefinitionParameters.withType(type); + return this; + } + } + + public MongoRoleDefinitionGetResultsImpl withDatabaseName(String databaseName) { + if (isInCreateMode()) { + this.createCreateUpdateMongoRoleDefinitionParameters.withDatabaseName(databaseName); + return this; + } else { + this.updateCreateUpdateMongoRoleDefinitionParameters.withDatabaseName(databaseName); + return this; + } + } + + public MongoRoleDefinitionGetResultsImpl withPrivileges(List privileges) { + if (isInCreateMode()) { + this.createCreateUpdateMongoRoleDefinitionParameters.withPrivileges(privileges); + return this; + } else { + this.updateCreateUpdateMongoRoleDefinitionParameters.withPrivileges(privileges); + return this; + } + } + + public MongoRoleDefinitionGetResultsImpl withRoles(List roles) { + if (isInCreateMode()) { + this.createCreateUpdateMongoRoleDefinitionParameters.withRoles(roles); + return this; + } else { + this.updateCreateUpdateMongoRoleDefinitionParameters.withRoles(roles); + 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/MongoUserDefinitionGetResultsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MongoUserDefinitionGetResultsImpl.java new file mode 100644 index 0000000000000..8f56939b4d6eb --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MongoUserDefinitionGetResultsImpl.java @@ -0,0 +1,224 @@ +// Copyright (c) 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.MongoUserDefinitionGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.MongoUserDefinitionCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.MongoUserDefinitionGetResults; +import com.azure.resourcemanager.cosmos.generated.models.Role; +import java.util.Collections; +import java.util.List; + +public final class MongoUserDefinitionGetResultsImpl implements MongoUserDefinitionGetResults, + MongoUserDefinitionGetResults.Definition, MongoUserDefinitionGetResults.Update { + private MongoUserDefinitionGetResultsInner 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 username() { + return this.innerModel().username(); + } + + public String password() { + return this.innerModel().password(); + } + + public String databaseName() { + return this.innerModel().databaseName(); + } + + public String customData() { + return this.innerModel().customData(); + } + + public List roles() { + List inner = this.innerModel().roles(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String mechanisms() { + return this.innerModel().mechanisms(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public MongoUserDefinitionGetResultsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + private String mongoUserDefinitionId; + + private String resourceGroupName; + + private String accountName; + + private MongoUserDefinitionCreateUpdateParameters createCreateUpdateMongoUserDefinitionParameters; + + private MongoUserDefinitionCreateUpdateParameters updateCreateUpdateMongoUserDefinitionParameters; + + public MongoUserDefinitionGetResultsImpl withExistingDatabaseAccount(String resourceGroupName, String accountName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + return this; + } + + public MongoUserDefinitionGetResults create() { + this.innerObject = serviceManager.serviceClient() + .getMongoDBResources() + .createUpdateMongoUserDefinition(mongoUserDefinitionId, resourceGroupName, accountName, + createCreateUpdateMongoUserDefinitionParameters, Context.NONE); + return this; + } + + public MongoUserDefinitionGetResults create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getMongoDBResources() + .createUpdateMongoUserDefinition(mongoUserDefinitionId, resourceGroupName, accountName, + createCreateUpdateMongoUserDefinitionParameters, context); + return this; + } + + MongoUserDefinitionGetResultsImpl(String name, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = new MongoUserDefinitionGetResultsInner(); + this.serviceManager = serviceManager; + this.mongoUserDefinitionId = name; + this.createCreateUpdateMongoUserDefinitionParameters = new MongoUserDefinitionCreateUpdateParameters(); + } + + public MongoUserDefinitionGetResultsImpl update() { + this.updateCreateUpdateMongoUserDefinitionParameters = new MongoUserDefinitionCreateUpdateParameters(); + return this; + } + + public MongoUserDefinitionGetResults apply() { + this.innerObject = serviceManager.serviceClient() + .getMongoDBResources() + .createUpdateMongoUserDefinition(mongoUserDefinitionId, resourceGroupName, accountName, + updateCreateUpdateMongoUserDefinitionParameters, Context.NONE); + return this; + } + + public MongoUserDefinitionGetResults apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getMongoDBResources() + .createUpdateMongoUserDefinition(mongoUserDefinitionId, resourceGroupName, accountName, + updateCreateUpdateMongoUserDefinitionParameters, context); + return this; + } + + MongoUserDefinitionGetResultsImpl(MongoUserDefinitionGetResultsInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.mongoUserDefinitionId + = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "mongodbUserDefinitions"); + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + } + + public MongoUserDefinitionGetResults refresh() { + this.innerObject = serviceManager.serviceClient() + .getMongoDBResources() + .getMongoUserDefinitionWithResponse(mongoUserDefinitionId, resourceGroupName, accountName, Context.NONE) + .getValue(); + return this; + } + + public MongoUserDefinitionGetResults refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getMongoDBResources() + .getMongoUserDefinitionWithResponse(mongoUserDefinitionId, resourceGroupName, accountName, context) + .getValue(); + return this; + } + + public MongoUserDefinitionGetResultsImpl withUsername(String username) { + if (isInCreateMode()) { + this.createCreateUpdateMongoUserDefinitionParameters.withUsername(username); + return this; + } else { + this.updateCreateUpdateMongoUserDefinitionParameters.withUsername(username); + return this; + } + } + + public MongoUserDefinitionGetResultsImpl withPassword(String password) { + if (isInCreateMode()) { + this.createCreateUpdateMongoUserDefinitionParameters.withPassword(password); + return this; + } else { + this.updateCreateUpdateMongoUserDefinitionParameters.withPassword(password); + return this; + } + } + + public MongoUserDefinitionGetResultsImpl withDatabaseName(String databaseName) { + if (isInCreateMode()) { + this.createCreateUpdateMongoUserDefinitionParameters.withDatabaseName(databaseName); + return this; + } else { + this.updateCreateUpdateMongoUserDefinitionParameters.withDatabaseName(databaseName); + return this; + } + } + + public MongoUserDefinitionGetResultsImpl withCustomData(String customData) { + if (isInCreateMode()) { + this.createCreateUpdateMongoUserDefinitionParameters.withCustomData(customData); + return this; + } else { + this.updateCreateUpdateMongoUserDefinitionParameters.withCustomData(customData); + return this; + } + } + + public MongoUserDefinitionGetResultsImpl withRoles(List roles) { + if (isInCreateMode()) { + this.createCreateUpdateMongoUserDefinitionParameters.withRoles(roles); + return this; + } else { + this.updateCreateUpdateMongoUserDefinitionParameters.withRoles(roles); + return this; + } + } + + public MongoUserDefinitionGetResultsImpl withMechanisms(String mechanisms) { + if (isInCreateMode()) { + this.createCreateUpdateMongoUserDefinitionParameters.withMechanisms(mechanisms); + return this; + } else { + this.updateCreateUpdateMongoUserDefinitionParameters.withMechanisms(mechanisms); + 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/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..225075d3220bd --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/NotebookWorkspaceConnectionInfoResultImpl.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.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..470415b19f2dc --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/NotebookWorkspaceImpl.java @@ -0,0 +1,166 @@ +// Copyright (c) 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 String resourceGroupName() { + return resourceGroupName; + } + + 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 = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.notebookWorkspaceName = NotebookWorkspaceName + .fromString(ResourceManagerUtils.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 Response listConnectionInfoWithResponse(Context context) { + return serviceManager.notebookWorkspaces() + .listConnectionInfoWithResponse(resourceGroupName, accountName, notebookWorkspaceName, context); + } + + public NotebookWorkspaceConnectionInfoResult listConnectionInfo() { + return serviceManager.notebookWorkspaces() + .listConnectionInfo(resourceGroupName, accountName, notebookWorkspaceName); + } + + 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..eb3f377f4a802 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/NotebookWorkspacesClientImpl.java @@ -0,0 +1,1526 @@ +// Copyright (c) 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.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 { + /** + * 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") + public 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 along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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 as paginated response with + * {@link PagedFlux}. + */ + @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 as paginated response with + * {@link PagedFlux}. + */ + @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 as paginated response with + * {@link PagedIterable}. + */ + @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 as paginated response with + * {@link PagedIterable}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String accountName, + NotebookWorkspaceName notebookWorkspaceName) { + return getWithResponseAsync(resourceGroupName, accountName, notebookWorkspaceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String accountName, + NotebookWorkspaceName notebookWorkspaceName, Context context) { + return getWithResponseAsync(resourceGroupName, accountName, notebookWorkspaceName, context).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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 getWithResponse(resourceGroupName, accountName, notebookWorkspaceName, Context.NONE).getValue(); + } + + /** + * 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of a notebook workspace resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, NotebookWorkspaceInner> beginCreateOrUpdate( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, + NotebookWorkspaceCreateUpdateParameters notebookCreateUpdateParameters) { + return this + .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 the {@link SyncPoller} for polling of 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 this + .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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link PollerFlux} for polling of long-running operation. + */ + @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, + this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String accountName, + NotebookWorkspaceName notebookWorkspaceName) { + return this.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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String accountName, + NotebookWorkspaceName notebookWorkspaceName, Context context) { + return this.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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with {@link Response} on successful completion + * of {@link Mono}. + */ + @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 along with {@link Response} on successful completion + * of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listConnectionInfoAsync(String resourceGroupName, + String accountName, NotebookWorkspaceName notebookWorkspaceName) { + return listConnectionInfoWithResponseAsync(resourceGroupName, accountName, notebookWorkspaceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listConnectionInfoWithResponse(String resourceGroupName, + String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + return listConnectionInfoWithResponseAsync(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) + public NotebookWorkspaceConnectionInfoResultInner listConnectionInfo(String resourceGroupName, String accountName, + NotebookWorkspaceName notebookWorkspaceName) { + return listConnectionInfoWithResponse(resourceGroupName, accountName, notebookWorkspaceName, Context.NONE) + .getValue(); + } + + /** + * 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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link PollerFlux} for polling of long-running operation. + */ + @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, + this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRegenerateAuthToken(String resourceGroupName, String accountName, + NotebookWorkspaceName notebookWorkspaceName) { + return this.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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRegenerateAuthToken(String resourceGroupName, String accountName, + NotebookWorkspaceName notebookWorkspaceName, Context context) { + return this.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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link PollerFlux} for polling of long-running operation. + */ + @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, + this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginStart(String resourceGroupName, String accountName, + NotebookWorkspaceName notebookWorkspaceName) { + return this.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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginStart(String resourceGroupName, String accountName, + NotebookWorkspaceName notebookWorkspaceName, Context context) { + return this.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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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..03dc8d820f1bc --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/NotebookWorkspacesImpl.java @@ -0,0 +1,210 @@ +// Copyright (c) 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; + +public final class NotebookWorkspacesImpl implements NotebookWorkspaces { + private static 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 ResourceManagerUtils.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 ResourceManagerUtils.mapPage(inner, inner1 -> new NotebookWorkspaceImpl(inner1, this.manager())); + } + + 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 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 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 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 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 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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 notebookWorkspaceNameLocal = ResourceManagerUtils.getValueFromIdByName(id, "notebookWorkspaces"); + if (notebookWorkspaceNameLocal == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'notebookWorkspaces'.", id))); + } + NotebookWorkspaceName notebookWorkspaceName = NotebookWorkspaceName.fromString(notebookWorkspaceNameLocal); + return this.getWithResponse(resourceGroupName, accountName, notebookWorkspaceName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.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 = ResourceManagerUtils.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 notebookWorkspaceNameLocal = ResourceManagerUtils.getValueFromIdByName(id, "notebookWorkspaces"); + if (notebookWorkspaceNameLocal == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'notebookWorkspaces'.", id))); + } + NotebookWorkspaceName notebookWorkspaceName = NotebookWorkspaceName.fromString(notebookWorkspaceNameLocal); + return this.getWithResponse(resourceGroupName, accountName, notebookWorkspaceName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.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 = ResourceManagerUtils.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 notebookWorkspaceNameLocal = ResourceManagerUtils.getValueFromIdByName(id, "notebookWorkspaces"); + if (notebookWorkspaceNameLocal == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'notebookWorkspaces'.", id))); + } + NotebookWorkspaceName notebookWorkspaceName = NotebookWorkspaceName.fromString(notebookWorkspaceNameLocal); + this.delete(resourceGroupName, accountName, notebookWorkspaceName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.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 = ResourceManagerUtils.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 notebookWorkspaceNameLocal = ResourceManagerUtils.getValueFromIdByName(id, "notebookWorkspaces"); + if (notebookWorkspaceNameLocal == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'notebookWorkspaces'.", id))); + } + NotebookWorkspaceName notebookWorkspaceName = NotebookWorkspaceName.fromString(notebookWorkspaceNameLocal); + 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..dba7d7c9e0fbc --- /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..a97ec07856103 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/OperationsClientImpl.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.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.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 { + /** + * 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") + public 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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with + * {@link PagedIterable}. + */ + @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 as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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..d2c05c2621d72 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/OperationsImpl.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.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; + +public final class OperationsImpl implements Operations { + private static 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 ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.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..665b8119dc38c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionKeyRangeIdRegionsClientImpl.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.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.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 { + /** + * 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") + public 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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..15957479f08e7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionKeyRangeIdRegionsImpl.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.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; + +public final class PartitionKeyRangeIdRegionsImpl implements PartitionKeyRangeIdRegions { + private static 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 ResourceManagerUtils.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 ResourceManagerUtils.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..c251d95765285 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionKeyRangeIdsClientImpl.java @@ -0,0 +1,287 @@ +// Copyright (c) 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.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 { + /** + * 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") + public 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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..26784d331360d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionKeyRangeIdsImpl.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.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; + +public final class PartitionKeyRangeIdsImpl implements PartitionKeyRangeIds { + private static 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 ResourceManagerUtils.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 ResourceManagerUtils.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..fdd8a885b9b91 --- /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..517903f568805 --- /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..5a4f62cf5e963 --- /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..dd67f47ad8116 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileSourceTargetsClientImpl.java @@ -0,0 +1,290 @@ +// Copyright (c) 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.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 { + /** + * 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") + public 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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..f0108ba5b72f1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileSourceTargetsImpl.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.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; + +public final class PercentileSourceTargetsImpl implements PercentileSourceTargets { + private static 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 ResourceManagerUtils.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 ResourceManagerUtils.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..dd8cfee7bc98b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileTargetsClientImpl.java @@ -0,0 +1,267 @@ +// Copyright (c) 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.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 { + /** + * 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") + public 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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..f27da62870c79 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileTargetsImpl.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.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; + +public final class PercentileTargetsImpl implements PercentileTargets { + private static 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 ResourceManagerUtils.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 ResourceManagerUtils.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..4f2aba08f9869 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentilesClientImpl.java @@ -0,0 +1,248 @@ +// Copyright (c) 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.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 { + /** + * 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") + public 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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..c9e82ac4989df --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentilesImpl.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.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; + +public final class PercentilesImpl implements Percentiles { + private static 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 ResourceManagerUtils.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 ResourceManagerUtils.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..91415a8267303 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateEndpointConnectionImpl.java @@ -0,0 +1,158 @@ +// Copyright (c) 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 String resourceGroupName() { + return resourceGroupName; + } + + 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 = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.privateEndpointConnectionName + = ResourceManagerUtils.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..7c8df16783886 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateEndpointConnectionsClientImpl.java @@ -0,0 +1,884 @@ +// Copyright (c) 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.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 { + /** + * 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") + public 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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String accountName, + String privateEndpointConnectionName) { + return getWithResponseAsync(resourceGroupName, accountName, privateEndpointConnectionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String accountName, + String privateEndpointConnectionName, Context context) { + return getWithResponseAsync(resourceGroupName, accountName, privateEndpointConnectionName, context).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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 getWithResponse(resourceGroupName, accountName, privateEndpointConnectionName, Context.NONE).getValue(); + } + + /** + * 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 The parameters 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 a private endpoint connection along with {@link Response} on successful completion of {@link Mono}. + */ + @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 The parameters 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 a private endpoint connection along with {@link Response} on successful completion of {@link Mono}. + */ + @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 The parameters 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 the {@link PollerFlux} for polling of 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, + this.client.getContext()); + } + + /** + * 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 The parameters 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 the {@link PollerFlux} for polling of 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 The parameters 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 the {@link SyncPoller} for polling of a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( + String resourceGroupName, String accountName, String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + return this.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 The parameters 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 the {@link SyncPoller} for polling of 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 this + .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 The parameters 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 a private endpoint connection on successful completion of {@link Mono}. + */ + @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 The parameters 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 a private endpoint connection on successful completion of {@link Mono}. + */ + @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 The parameters 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 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 The parameters 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 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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link PollerFlux} for polling of long-running operation. + */ + @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, + this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String accountName, + String privateEndpointConnectionName) { + return this.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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String accountName, + String privateEndpointConnectionName, Context context) { + return this.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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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..779e09e49aaf2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateEndpointConnectionsImpl.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.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; + +public final class PrivateEndpointConnectionsImpl implements PrivateEndpointConnections { + private static 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 ResourceManagerUtils.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 ResourceManagerUtils.mapPage(inner, inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())); + } + + 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 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 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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 + = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 + = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 + = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 + = ResourceManagerUtils.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..f059dbe9722e6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateLinkResourceImpl.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.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..28fab7afd2ced --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateLinkResourcesClientImpl.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.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 { + /** + * 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") + public 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 along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 as paginated response with + * {@link PagedFlux}. + */ + @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 as paginated response with + * {@link PagedFlux}. + */ + @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 as paginated response with + * {@link PagedIterable}. + */ + @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 as paginated response with + * {@link PagedIterable}. + */ + @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 along with {@link Response} on + * successful completion of {@link Mono}. + */ + @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 along with {@link Response} on + * successful completion of {@link Mono}. + */ + @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 on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String accountName, String groupName) { + return getWithResponseAsync(resourceGroupName, accountName, groupName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String accountName, + String groupName, Context context) { + return getWithResponseAsync(resourceGroupName, accountName, groupName, context).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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 getWithResponse(resourceGroupName, accountName, groupName, Context.NONE).getValue(); + } +} 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..9afe5cc3c033a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateLinkResourcesImpl.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.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; + +public final class PrivateLinkResourcesImpl implements PrivateLinkResources { + private static 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 ResourceManagerUtils.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 ResourceManagerUtils.mapPage(inner, inner1 -> new PrivateLinkResourceImpl(inner1, this.manager())); + } + + 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; + } + } + + 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; + } + } + + 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/ResourceManagerUtils.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/ResourceManagerUtils.java new file mode 100644 index 0000000000000..fe13155240eb2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/ResourceManagerUtils.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.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 ResourceManagerUtils { + private ResourceManagerUtils() { + } + + 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.isEmpty() && 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<>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl<>(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/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..f19be43e53def --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableDatabaseAccountGetResultImpl.java @@ -0,0 +1,78 @@ +// Copyright (c) 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 OffsetDateTime oldestRestorableTime() { + return this.innerModel().oldestRestorableTime(); + } + + 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..32b5f4ead48cc --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableDatabaseAccountsClientImpl.java @@ -0,0 +1,465 @@ +// Copyright (c) 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.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 { + /** + * 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") + public 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 along + * with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along + * with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 as + * paginated response with {@link PagedFlux}. + */ + @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 as + * paginated response with {@link PagedFlux}. + */ + @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 as + * paginated response with {@link PagedIterable}. + */ + @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 as + * paginated response with {@link PagedIterable}. + */ + @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 along + * with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along + * with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 as + * paginated response with {@link PagedFlux}. + */ + @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 as + * paginated response with {@link PagedFlux}. + */ + @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 as + * paginated response with {@link PagedIterable}. + */ + @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 as + * paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByLocationAsync(String location, String instanceId) { + return getByLocationWithResponseAsync(location, instanceId).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByLocationWithResponse(String location, + String instanceId, Context context) { + return getByLocationWithResponseAsync(location, instanceId, context).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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 getByLocationWithResponse(location, instanceId, Context.NONE).getValue(); + } +} 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..8d314f4ccf030 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableDatabaseAccountsImpl.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.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; + +public final class RestorableDatabaseAccountsImpl implements RestorableDatabaseAccounts { + private static 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 ResourceManagerUtils.mapPage(inner, + inner1 -> new RestorableDatabaseAccountGetResultImpl(inner1, this.manager())); + } + + public PagedIterable listByLocation(String location, Context context) { + PagedIterable inner + = this.serviceClient().listByLocation(location, context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new RestorableDatabaseAccountGetResultImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new RestorableDatabaseAccountGetResultImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new RestorableDatabaseAccountGetResultImpl(inner1, this.manager())); + } + + 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; + } + } + + 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; + } + } + + 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/RestorableGremlinDatabaseGetResultImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableGremlinDatabaseGetResultImpl.java new file mode 100644 index 0000000000000..ef753b7f2b300 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableGremlinDatabaseGetResultImpl.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.RestorableGremlinDatabaseGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableGremlinDatabaseGetResult; +import com.azure.resourcemanager.cosmos.generated.models.RestorableGremlinDatabasePropertiesResource; + +public final class RestorableGremlinDatabaseGetResultImpl implements RestorableGremlinDatabaseGetResult { + private RestorableGremlinDatabaseGetResultInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + RestorableGremlinDatabaseGetResultImpl(RestorableGremlinDatabaseGetResultInner 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 RestorableGremlinDatabasePropertiesResource resource() { + return this.innerModel().resource(); + } + + public RestorableGremlinDatabaseGetResultInner 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/RestorableGremlinDatabasesClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableGremlinDatabasesClientImpl.java new file mode 100644 index 0000000000000..3ce78953e8aee --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableGremlinDatabasesClientImpl.java @@ -0,0 +1,229 @@ +// Copyright (c) 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.resourcemanager.cosmos.generated.fluent.RestorableGremlinDatabasesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableGremlinDatabaseGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableGremlinDatabasesListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in RestorableGremlinDatabasesClient. + */ +public final class RestorableGremlinDatabasesClientImpl implements RestorableGremlinDatabasesClient { + /** + * The proxy service used to perform REST calls. + */ + private final RestorableGremlinDatabasesService service; + + /** + * The service client containing this operation class. + */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of RestorableGremlinDatabasesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RestorableGremlinDatabasesClientImpl(CosmosDBManagementClientImpl client) { + this.service = RestProxy.create(RestorableGremlinDatabasesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientRestorableGremlinDatabases to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + public interface RestorableGremlinDatabasesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableGremlinDatabases") + @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 Gremlin 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 Gremlin database events and their properties along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 Gremlin 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 Gremlin database events and their properties along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 Gremlin 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 Gremlin database events and their properties as paginated + * response with {@link PagedFlux}. + */ + @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 Gremlin 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 Gremlin database events and their properties as paginated + * response with {@link PagedFlux}. + */ + @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 Gremlin 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 Gremlin database events and their properties as paginated + * response with {@link PagedIterable}. + */ + @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 Gremlin 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 Gremlin database events and their properties as paginated + * response with {@link PagedIterable}. + */ + @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/RestorableGremlinDatabasesImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableGremlinDatabasesImpl.java new file mode 100644 index 0000000000000..ce7f7ad27e345 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableGremlinDatabasesImpl.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.RestorableGremlinDatabasesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableGremlinDatabaseGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableGremlinDatabaseGetResult; +import com.azure.resourcemanager.cosmos.generated.models.RestorableGremlinDatabases; + +public final class RestorableGremlinDatabasesImpl implements RestorableGremlinDatabases { + private static final ClientLogger LOGGER = new ClientLogger(RestorableGremlinDatabasesImpl.class); + + private final RestorableGremlinDatabasesClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public RestorableGremlinDatabasesImpl(RestorableGremlinDatabasesClient 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 ResourceManagerUtils.mapPage(inner, + inner1 -> new RestorableGremlinDatabaseGetResultImpl(inner1, this.manager())); + } + + public PagedIterable list(String location, String instanceId, Context context) { + PagedIterable inner + = this.serviceClient().list(location, instanceId, context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new RestorableGremlinDatabaseGetResultImpl(inner1, this.manager())); + } + + private RestorableGremlinDatabasesClient 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/RestorableGremlinGraphGetResultImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableGremlinGraphGetResultImpl.java new file mode 100644 index 0000000000000..152da2f572c75 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableGremlinGraphGetResultImpl.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.RestorableGremlinGraphGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableGremlinGraphGetResult; +import com.azure.resourcemanager.cosmos.generated.models.RestorableGremlinGraphPropertiesResource; + +public final class RestorableGremlinGraphGetResultImpl implements RestorableGremlinGraphGetResult { + private RestorableGremlinGraphGetResultInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + RestorableGremlinGraphGetResultImpl(RestorableGremlinGraphGetResultInner 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 RestorableGremlinGraphPropertiesResource resource() { + return this.innerModel().resource(); + } + + public RestorableGremlinGraphGetResultInner 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/RestorableGremlinGraphsClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableGremlinGraphsClientImpl.java new file mode 100644 index 0000000000000..cf7baa7bdafcb --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableGremlinGraphsClientImpl.java @@ -0,0 +1,276 @@ +// Copyright (c) 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.resourcemanager.cosmos.generated.fluent.RestorableGremlinGraphsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableGremlinGraphGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableGremlinGraphsListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in RestorableGremlinGraphsClient. + */ +public final class RestorableGremlinGraphsClientImpl implements RestorableGremlinGraphsClient { + /** + * The proxy service used to perform REST calls. + */ + private final RestorableGremlinGraphsService service; + + /** + * The service client containing this operation class. + */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of RestorableGremlinGraphsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RestorableGremlinGraphsClientImpl(CosmosDBManagementClientImpl client) { + this.service = RestProxy.create(RestorableGremlinGraphsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientRestorableGremlinGraphs to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + public interface RestorableGremlinGraphsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableGraphs") + @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("restorableGremlinDatabaseRid") String restorableGremlinDatabaseRid, + @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 Gremlin graphs 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 restorableGremlinDatabaseRid The resource ID of the Gremlin database. + * @param startTime Restorable Gremlin graphs event feed start time. + * @param endTime Restorable Gremlin graphs event feed end time. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 graph events and their properties along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String location, + String instanceId, String restorableGremlinDatabaseRid, 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, restorableGremlinDatabaseRid, 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 Gremlin graphs 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 restorableGremlinDatabaseRid The resource ID of the Gremlin database. + * @param startTime Restorable Gremlin graphs event feed start time. + * @param endTime Restorable Gremlin graphs event feed end time. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 graph events and their properties along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String location, + String instanceId, String restorableGremlinDatabaseRid, 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, restorableGremlinDatabaseRid, 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 Gremlin graphs 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 restorableGremlinDatabaseRid The resource ID of the Gremlin database. + * @param startTime Restorable Gremlin graphs event feed start time. + * @param endTime Restorable Gremlin graphs event feed end time. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 graph events and their properties as paginated + * response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String location, String instanceId, + String restorableGremlinDatabaseRid, String startTime, String endTime) { + return new PagedFlux<>( + () -> listSinglePageAsync(location, instanceId, restorableGremlinDatabaseRid, startTime, endTime)); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB Gremlin graphs 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 Gremlin graph events and their properties as paginated + * response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String location, String instanceId) { + final String restorableGremlinDatabaseRid = null; + final String startTime = null; + final String endTime = null; + return new PagedFlux<>( + () -> listSinglePageAsync(location, instanceId, restorableGremlinDatabaseRid, startTime, endTime)); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB Gremlin graphs 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 restorableGremlinDatabaseRid The resource ID of the Gremlin database. + * @param startTime Restorable Gremlin graphs event feed start time. + * @param endTime Restorable Gremlin graphs event feed end time. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 graph events and their properties as paginated + * response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String location, String instanceId, + String restorableGremlinDatabaseRid, String startTime, String endTime, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(location, instanceId, restorableGremlinDatabaseRid, startTime, endTime, context)); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB Gremlin graphs 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 Gremlin graph events and their properties as paginated + * response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String location, String instanceId) { + final String restorableGremlinDatabaseRid = null; + final String startTime = null; + final String endTime = null; + return new PagedIterable<>(listAsync(location, instanceId, restorableGremlinDatabaseRid, startTime, endTime)); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB Gremlin graphs 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 restorableGremlinDatabaseRid The resource ID of the Gremlin database. + * @param startTime Restorable Gremlin graphs event feed start time. + * @param endTime Restorable Gremlin graphs event feed end time. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 graph events and their properties as paginated + * response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String location, String instanceId, + String restorableGremlinDatabaseRid, String startTime, String endTime, Context context) { + return new PagedIterable<>( + listAsync(location, instanceId, restorableGremlinDatabaseRid, startTime, endTime, context)); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableGremlinGraphsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableGremlinGraphsImpl.java new file mode 100644 index 0000000000000..ff4fc438c3d3c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableGremlinGraphsImpl.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.RestorableGremlinGraphsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableGremlinGraphGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableGremlinGraphGetResult; +import com.azure.resourcemanager.cosmos.generated.models.RestorableGremlinGraphs; + +public final class RestorableGremlinGraphsImpl implements RestorableGremlinGraphs { + private static final ClientLogger LOGGER = new ClientLogger(RestorableGremlinGraphsImpl.class); + + private final RestorableGremlinGraphsClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public RestorableGremlinGraphsImpl(RestorableGremlinGraphsClient 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 ResourceManagerUtils.mapPage(inner, + inner1 -> new RestorableGremlinGraphGetResultImpl(inner1, this.manager())); + } + + public PagedIterable list(String location, String instanceId, + String restorableGremlinDatabaseRid, String startTime, String endTime, Context context) { + PagedIterable inner = this.serviceClient() + .list(location, instanceId, restorableGremlinDatabaseRid, startTime, endTime, context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new RestorableGremlinGraphGetResultImpl(inner1, this.manager())); + } + + private RestorableGremlinGraphsClient 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/RestorableGremlinResourcesClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableGremlinResourcesClientImpl.java new file mode 100644 index 0000000000000..e358be92a603b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableGremlinResourcesClientImpl.java @@ -0,0 +1,266 @@ +// Copyright (c) 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.resourcemanager.cosmos.generated.fluent.RestorableGremlinResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableGremlinResourcesGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableGremlinResourcesListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in RestorableGremlinResourcesClient. + */ +public final class RestorableGremlinResourcesClientImpl implements RestorableGremlinResourcesClient { + /** + * The proxy service used to perform REST calls. + */ + private final RestorableGremlinResourcesService service; + + /** + * The service client containing this operation class. + */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of RestorableGremlinResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RestorableGremlinResourcesClientImpl(CosmosDBManagementClientImpl client) { + this.service = RestProxy.create(RestorableGremlinResourcesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientRestorableGremlinResources to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + public interface RestorableGremlinResourcesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableGremlinResources") + @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 gremlin database and graphs 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 Gremlin resources along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 gremlin database and graphs 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 Gremlin resources along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 gremlin database and graphs 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 Gremlin resources as paginated response with + * {@link PagedFlux}. + */ + @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 gremlin database and graphs 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 Gremlin resources as paginated response with + * {@link PagedFlux}. + */ + @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 gremlin database and graphs 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 Gremlin resources as paginated response with + * {@link PagedFlux}. + */ + @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 gremlin database and graphs 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 Gremlin resources as paginated response with + * {@link PagedIterable}. + */ + @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 gremlin database and graphs 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 Gremlin resources as paginated response with + * {@link PagedIterable}. + */ + @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/RestorableGremlinResourcesGetResultImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableGremlinResourcesGetResultImpl.java new file mode 100644 index 0000000000000..360b77e729de7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableGremlinResourcesGetResultImpl.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.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableGremlinResourcesGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableGremlinResourcesGetResult; +import java.util.Collections; +import java.util.List; + +public final class RestorableGremlinResourcesGetResultImpl implements RestorableGremlinResourcesGetResult { + private RestorableGremlinResourcesGetResultInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + RestorableGremlinResourcesGetResultImpl(RestorableGremlinResourcesGetResultInner 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 databaseName() { + return this.innerModel().databaseName(); + } + + public List graphNames() { + List inner = this.innerModel().graphNames(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public RestorableGremlinResourcesGetResultInner 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/RestorableGremlinResourcesImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableGremlinResourcesImpl.java new file mode 100644 index 0000000000000..b5be17a904d61 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableGremlinResourcesImpl.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.RestorableGremlinResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableGremlinResourcesGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableGremlinResources; +import com.azure.resourcemanager.cosmos.generated.models.RestorableGremlinResourcesGetResult; + +public final class RestorableGremlinResourcesImpl implements RestorableGremlinResources { + private static final ClientLogger LOGGER = new ClientLogger(RestorableGremlinResourcesImpl.class); + + private final RestorableGremlinResourcesClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public RestorableGremlinResourcesImpl(RestorableGremlinResourcesClient 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 ResourceManagerUtils.mapPage(inner, + inner1 -> new RestorableGremlinResourcesGetResultImpl(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 ResourceManagerUtils.mapPage(inner, + inner1 -> new RestorableGremlinResourcesGetResultImpl(inner1, this.manager())); + } + + private RestorableGremlinResourcesClient 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..8f0c2b7dc29c5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbCollectionGetResultImpl.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.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..154d158c113d5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbCollectionsClientImpl.java @@ -0,0 +1,276 @@ +// Copyright (c) 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.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 { + /** + * 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") + public 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, + @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 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 startTime Restorable MongoDB collections event feed start time. + * @param endTime Restorable MongoDB collections event feed end time. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String location, + String instanceId, String restorableMongodbDatabaseRid, 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, restorableMongodbDatabaseRid, 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 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 startTime Restorable MongoDB collections event feed start time. + * @param endTime Restorable MongoDB collections event feed end time. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String location, + String instanceId, String restorableMongodbDatabaseRid, 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, restorableMongodbDatabaseRid, 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 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 startTime Restorable MongoDB collections event feed start time. + * @param endTime Restorable MongoDB collections event feed end time. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 as + * paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String location, String instanceId, + String restorableMongodbDatabaseRid, String startTime, String endTime) { + return new PagedFlux<>( + () -> listSinglePageAsync(location, instanceId, restorableMongodbDatabaseRid, startTime, endTime)); + } + + /** + * 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 as + * paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String location, String instanceId) { + final String restorableMongodbDatabaseRid = null; + final String startTime = null; + final String endTime = null; + return new PagedFlux<>( + () -> listSinglePageAsync(location, instanceId, restorableMongodbDatabaseRid, startTime, endTime)); + } + + /** + * 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 startTime Restorable MongoDB collections event feed start time. + * @param endTime Restorable MongoDB collections event feed end time. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 as + * paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String location, String instanceId, + String restorableMongodbDatabaseRid, String startTime, String endTime, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(location, instanceId, restorableMongodbDatabaseRid, startTime, endTime, 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 as + * paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String location, String instanceId) { + final String restorableMongodbDatabaseRid = null; + final String startTime = null; + final String endTime = null; + return new PagedIterable<>(listAsync(location, instanceId, restorableMongodbDatabaseRid, startTime, endTime)); + } + + /** + * 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 startTime Restorable MongoDB collections event feed start time. + * @param endTime Restorable MongoDB collections event feed end time. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 as + * paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String location, String instanceId, + String restorableMongodbDatabaseRid, String startTime, String endTime, Context context) { + return new PagedIterable<>( + listAsync(location, instanceId, restorableMongodbDatabaseRid, startTime, endTime, 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..51353a469a87f --- /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; + +public final class RestorableMongodbCollectionsImpl implements RestorableMongodbCollections { + private static 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 ResourceManagerUtils.mapPage(inner, + inner1 -> new RestorableMongodbCollectionGetResultImpl(inner1, this.manager())); + } + + public PagedIterable list(String location, String instanceId, + String restorableMongodbDatabaseRid, String startTime, String endTime, Context context) { + PagedIterable inner = this.serviceClient() + .list(location, instanceId, restorableMongodbDatabaseRid, startTime, endTime, context); + return ResourceManagerUtils.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..d14493ec9c18a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbDatabaseGetResultImpl.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.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..d3f2ebf10f0cd --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbDatabasesClientImpl.java @@ -0,0 +1,229 @@ +// Copyright (c) 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.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 { + /** + * 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") + public 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 along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 as paginated + * response with {@link PagedFlux}. + */ + @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 as paginated + * response with {@link PagedFlux}. + */ + @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 as paginated + * response with {@link PagedIterable}. + */ + @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 as paginated + * response with {@link PagedIterable}. + */ + @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..4afd3299061c8 --- /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; + +public final class RestorableMongodbDatabasesImpl implements RestorableMongodbDatabases { + private static 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 ResourceManagerUtils.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 ResourceManagerUtils.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..2dd2a287ed448 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbResourcesClientImpl.java @@ -0,0 +1,266 @@ +// Copyright (c) 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.resourcemanager.cosmos.generated.fluent.RestorableMongodbResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableMongodbResourcesGetResultInner; +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 { + /** + * 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") + public 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 along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 as paginated response with + * {@link PagedFlux}. + */ + @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 as paginated response with + * {@link PagedFlux}. + */ + @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 as paginated response with + * {@link PagedFlux}. + */ + @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 as paginated response with + * {@link PagedIterable}. + */ + @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 as paginated response with + * {@link PagedIterable}. + */ + @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/RestorableMongodbResourcesGetResultImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbResourcesGetResultImpl.java new file mode 100644 index 0000000000000..73a9daea04282 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbResourcesGetResultImpl.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.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableMongodbResourcesGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbResourcesGetResult; +import java.util.Collections; +import java.util.List; + +public final class RestorableMongodbResourcesGetResultImpl implements RestorableMongodbResourcesGetResult { + private RestorableMongodbResourcesGetResultInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + RestorableMongodbResourcesGetResultImpl(RestorableMongodbResourcesGetResultInner 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 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 RestorableMongodbResourcesGetResultInner 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/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..ef59686be3c53 --- /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.RestorableMongodbResourcesGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbResources; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbResourcesGetResult; + +public final class RestorableMongodbResourcesImpl implements RestorableMongodbResources { + private static 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 ResourceManagerUtils.mapPage(inner, + inner1 -> new RestorableMongodbResourcesGetResultImpl(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 ResourceManagerUtils.mapPage(inner, + inner1 -> new RestorableMongodbResourcesGetResultImpl(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..d07edb875d3be --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlContainerGetResultImpl.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.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..5eeb3d4802976 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlContainersClientImpl.java @@ -0,0 +1,276 @@ +// Copyright (c) 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.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 { + /** + * 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") + public 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 Restorable Sql containers event feed start time. + * @param endTime Restorable Sql containers event feed end time. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 Restorable Sql containers event feed start time. + * @param endTime Restorable Sql containers event feed end time. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 Restorable Sql containers event feed start time. + * @param endTime Restorable Sql containers event feed end time. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 as paginated + * response with {@link PagedFlux}. + */ + @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 as paginated + * response with {@link PagedFlux}. + */ + @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 Restorable Sql containers event feed start time. + * @param endTime Restorable Sql containers event feed end time. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 as paginated + * response with {@link PagedFlux}. + */ + @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 as paginated + * response with {@link PagedIterable}. + */ + @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 Restorable Sql containers event feed start time. + * @param endTime Restorable Sql containers event feed end time. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 as paginated + * response with {@link PagedIterable}. + */ + @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..ca95fb49183fc --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlContainersImpl.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.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; + +public final class RestorableSqlContainersImpl implements RestorableSqlContainers { + private static 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 ResourceManagerUtils.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 ResourceManagerUtils.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..ab1dec7869449 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlDatabaseGetResultImpl.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.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..c80e03e009505 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlDatabasesClientImpl.java @@ -0,0 +1,229 @@ +// Copyright (c) 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.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 { + /** + * 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") + public 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 along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 as paginated + * response with {@link PagedFlux}. + */ + @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 as paginated + * response with {@link PagedFlux}. + */ + @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 as paginated + * response with {@link PagedIterable}. + */ + @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 as paginated + * response with {@link PagedIterable}. + */ + @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..8bf5351e7a8a4 --- /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; + +public final class RestorableSqlDatabasesImpl implements RestorableSqlDatabases { + private static 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 ResourceManagerUtils.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 ResourceManagerUtils.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..0f6625a79cbc2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlResourcesClientImpl.java @@ -0,0 +1,266 @@ +// Copyright (c) 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.resourcemanager.cosmos.generated.fluent.RestorableSqlResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableSqlResourcesGetResultInner; +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 { + /** + * 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") + public 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 along with {@link PagedResponse} + * on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} + * on successful completion of {@link Mono}. + */ + @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 as paginated response with + * {@link PagedFlux}. + */ + @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 as paginated response with + * {@link PagedFlux}. + */ + @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 as paginated response with + * {@link PagedFlux}. + */ + @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 as paginated response with + * {@link PagedIterable}. + */ + @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 as paginated response with + * {@link PagedIterable}. + */ + @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/RestorableSqlResourcesGetResultImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlResourcesGetResultImpl.java new file mode 100644 index 0000000000000..e4121cc31ec51 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlResourcesGetResultImpl.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.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableSqlResourcesGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlResourcesGetResult; +import java.util.Collections; +import java.util.List; + +public final class RestorableSqlResourcesGetResultImpl implements RestorableSqlResourcesGetResult { + private RestorableSqlResourcesGetResultInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + RestorableSqlResourcesGetResultImpl(RestorableSqlResourcesGetResultInner 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 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 RestorableSqlResourcesGetResultInner 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/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..3600c07c6fb12 --- /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.RestorableSqlResourcesGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlResources; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlResourcesGetResult; + +public final class RestorableSqlResourcesImpl implements RestorableSqlResources { + private static 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 ResourceManagerUtils.mapPage(inner, + inner1 -> new RestorableSqlResourcesGetResultImpl(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 ResourceManagerUtils.mapPage(inner, + inner1 -> new RestorableSqlResourcesGetResultImpl(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/RestorableTableGetResultImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableTableGetResultImpl.java new file mode 100644 index 0000000000000..64aab59c53e85 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableTableGetResultImpl.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.RestorableTableGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableTableGetResult; +import com.azure.resourcemanager.cosmos.generated.models.RestorableTablePropertiesResource; + +public final class RestorableTableGetResultImpl implements RestorableTableGetResult { + private RestorableTableGetResultInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + RestorableTableGetResultImpl(RestorableTableGetResultInner 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 RestorableTablePropertiesResource resource() { + return this.innerModel().resource(); + } + + public RestorableTableGetResultInner 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/RestorableTableResourcesClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableTableResourcesClientImpl.java new file mode 100644 index 0000000000000..0351e8a6b9d77 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableTableResourcesClientImpl.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.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.resourcemanager.cosmos.generated.fluent.RestorableTableResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableTableResourcesGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableTableResourcesListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in RestorableTableResourcesClient. + */ +public final class RestorableTableResourcesClientImpl implements RestorableTableResourcesClient { + /** + * The proxy service used to perform REST calls. + */ + private final RestorableTableResourcesService service; + + /** + * The service client containing this operation class. + */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of RestorableTableResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RestorableTableResourcesClientImpl(CosmosDBManagementClientImpl client) { + this.service = RestProxy.create(RestorableTableResourcesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientRestorableTableResources to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + public interface RestorableTableResourcesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableTableResources") + @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 tables 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 list of restorable table names along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 tables 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 list of restorable table names along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 tables 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 list of restorable table names as paginated response with {@link PagedFlux}. + */ + @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 tables 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 list of restorable table names as paginated response with {@link PagedFlux}. + */ + @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 tables 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 list of restorable table names as paginated response with {@link PagedFlux}. + */ + @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 tables 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 list of restorable table names as paginated response with {@link PagedIterable}. + */ + @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 tables 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 list of restorable table names as paginated response with {@link PagedIterable}. + */ + @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/RestorableTableResourcesGetResultImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableTableResourcesGetResultImpl.java new file mode 100644 index 0000000000000..d7e9c7dbc3373 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableTableResourcesGetResultImpl.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.RestorableTableResourcesGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableTableResourcesGetResult; + +public final class RestorableTableResourcesGetResultImpl implements RestorableTableResourcesGetResult { + private RestorableTableResourcesGetResultInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + RestorableTableResourcesGetResultImpl(RestorableTableResourcesGetResultInner 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 RestorableTableResourcesGetResultInner 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/RestorableTableResourcesImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableTableResourcesImpl.java new file mode 100644 index 0000000000000..c1e2d75814478 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableTableResourcesImpl.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.RestorableTableResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableTableResourcesGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableTableResources; +import com.azure.resourcemanager.cosmos.generated.models.RestorableTableResourcesGetResult; + +public final class RestorableTableResourcesImpl implements RestorableTableResources { + private static final ClientLogger LOGGER = new ClientLogger(RestorableTableResourcesImpl.class); + + private final RestorableTableResourcesClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public RestorableTableResourcesImpl(RestorableTableResourcesClient 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 ResourceManagerUtils.mapPage(inner, + inner1 -> new RestorableTableResourcesGetResultImpl(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 ResourceManagerUtils.mapPage(inner, + inner1 -> new RestorableTableResourcesGetResultImpl(inner1, this.manager())); + } + + private RestorableTableResourcesClient 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/RestorableTablesClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableTablesClientImpl.java new file mode 100644 index 0000000000000..e32c861cf93b9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableTablesClientImpl.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.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.resourcemanager.cosmos.generated.fluent.RestorableTablesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableTableGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableTablesListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in RestorableTablesClient. + */ +public final class RestorableTablesClientImpl implements RestorableTablesClient { + /** + * The proxy service used to perform REST calls. + */ + private final RestorableTablesService service; + + /** + * The service client containing this operation class. + */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of RestorableTablesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RestorableTablesClientImpl(CosmosDBManagementClientImpl client) { + this.service + = RestProxy.create(RestorableTablesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientRestorableTables to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + public interface RestorableTablesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableTables") + @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("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 Tables. This helps in scenario where table + * 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 startTime Restorable Tables event feed start time. + * @param endTime Restorable Tables event feed end time. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 events and their properties along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String location, String instanceId, + 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, 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 Tables. This helps in scenario where table + * 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 startTime Restorable Tables event feed start time. + * @param endTime Restorable Tables event feed end time. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 events and their properties along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String location, String instanceId, + 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, 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 Tables. This helps in scenario where table + * 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 startTime Restorable Tables event feed start time. + * @param endTime Restorable Tables event feed end time. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 events and their properties as paginated response + * with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String location, String instanceId, String startTime, + String endTime) { + return new PagedFlux<>(() -> listSinglePageAsync(location, instanceId, startTime, endTime)); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB Tables. This helps in scenario where table + * 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 Table events and their properties as paginated response + * with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String location, String instanceId) { + final String startTime = null; + final String endTime = null; + return new PagedFlux<>(() -> listSinglePageAsync(location, instanceId, startTime, endTime)); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB Tables. This helps in scenario where table + * 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 startTime Restorable Tables event feed start time. + * @param endTime Restorable Tables event feed end time. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 events and their properties as paginated response + * with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String location, String instanceId, String startTime, + String endTime, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(location, instanceId, startTime, endTime, context)); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB Tables. This helps in scenario where table + * 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 Table events and their properties as paginated response + * with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String location, String instanceId) { + final String startTime = null; + final String endTime = null; + return new PagedIterable<>(listAsync(location, instanceId, startTime, endTime)); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB Tables. This helps in scenario where table + * 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 startTime Restorable Tables event feed start time. + * @param endTime Restorable Tables event feed end time. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 events and their properties as paginated response + * with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String location, String instanceId, String startTime, + String endTime, Context context) { + return new PagedIterable<>(listAsync(location, instanceId, startTime, endTime, context)); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableTablesImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableTablesImpl.java new file mode 100644 index 0000000000000..ecf8f501ea394 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableTablesImpl.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.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.RestorableTablesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableTableGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableTableGetResult; +import com.azure.resourcemanager.cosmos.generated.models.RestorableTables; + +public final class RestorableTablesImpl implements RestorableTables { + private static final ClientLogger LOGGER = new ClientLogger(RestorableTablesImpl.class); + + private final RestorableTablesClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public RestorableTablesImpl(RestorableTablesClient 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 ResourceManagerUtils.mapPage(inner, inner1 -> new RestorableTableGetResultImpl(inner1, this.manager())); + } + + public PagedIterable list(String location, String instanceId, String startTime, + String endTime, Context context) { + PagedIterable inner + = this.serviceClient().list(location, instanceId, startTime, endTime, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new RestorableTableGetResultImpl(inner1, this.manager())); + } + + private RestorableTablesClient 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..ec91c7582f243 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/ServiceResourceImpl.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.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.ServiceResourceCreateUpdateProperties; +import com.azure.resourcemanager.cosmos.generated.models.ServiceResourceProperties; + +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 withProperties(ServiceResourceCreateUpdateProperties properties) { + this.createCreateUpdateParameters.withProperties(properties); + 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..26c9035efc235 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/ServicesClientImpl.java @@ -0,0 +1,854 @@ +// Copyright (c) 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.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 { + /** + * 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") + public 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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of properties for the database account. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServiceResourceInner> beginCreate(String resourceGroupName, + String accountName, String serviceName, ServiceResourceCreateUpdateParameters createUpdateParameters) { + return this.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 the {@link SyncPoller} for polling of 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 this.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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String accountName, String serviceName) { + return getWithResponseAsync(resourceGroupName, accountName, serviceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String accountName, + String serviceName, Context context) { + return getWithResponseAsync(resourceGroupName, accountName, serviceName, 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) + public ServiceResourceInner get(String resourceGroupName, String accountName, String serviceName) { + return getWithResponse(resourceGroupName, accountName, serviceName, Context.NONE).getValue(); + } + + /** + * 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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link PollerFlux} for polling of long-running operation. + */ + @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, + this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String accountName, + String serviceName) { + return this.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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String accountName, + String serviceName, Context context) { + return this.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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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..e276b190df9d4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/ServicesImpl.java @@ -0,0 +1,156 @@ +// Copyright (c) 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; + +public final class ServicesImpl implements Services { + private static 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 ResourceManagerUtils.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 ResourceManagerUtils.mapPage(inner, inner1 -> new ServiceResourceImpl(inner1, this.manager())); + } + + 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 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 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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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..55acff88df99f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlContainerGetResultsImpl.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.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.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 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 String resourceGroupName() { + return resourceGroupName; + } + + 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 = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.databaseName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "sqlDatabases"); + this.containerName = ResourceManagerUtils.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 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..8a41b9560c330 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlDatabaseGetResultsImpl.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.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.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 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 String resourceGroupName() { + return resourceGroupName; + } + + 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 = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.databaseName = ResourceManagerUtils.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 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..b0ba52d94f567 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlResourcesClientImpl.java @@ -0,0 +1,9199 @@ +// Copyright (c) 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.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.ClientEncryptionKeyGetResultsInner; +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.ClientEncryptionKeyCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.ClientEncryptionKeysListResult; +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 { + /** + * 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") + public 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}/clientEncryptionKeys") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listClientEncryptionKeys(@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}/clientEncryptionKeys/{clientEncryptionKeyName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getClientEncryptionKey(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("clientEncryptionKeyName") String clientEncryptionKeyName, + @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}/clientEncryptionKeys/{clientEncryptionKeyName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createUpdateClientEncryptionKey(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("clientEncryptionKeyName") String clientEncryptionKeyName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ClientEncryptionKeyCreateUpdateParameters createUpdateClientEncryptionKeyParameters, + @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 along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 as paginated response + * with {@link PagedFlux}. + */ + @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 as paginated response + * with {@link PagedFlux}. + */ + @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 as paginated response + * with {@link PagedIterable}. + */ + @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 as paginated response + * with {@link PagedIterable}. + */ + @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 along with + * {@link Response} on successful completion of {@link Mono}. + */ + @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 along with + * {@link Response} on successful completion of {@link Mono}. + */ + @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 on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getSqlDatabaseAsync(String resourceGroupName, String accountName, + String databaseName) { + return getSqlDatabaseWithResponseAsync(resourceGroupName, accountName, databaseName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getSqlDatabaseWithResponse(String resourceGroupName, String accountName, + String databaseName, Context context) { + return getSqlDatabaseWithResponseAsync(resourceGroupName, accountName, databaseName, context).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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 getSqlDatabaseWithResponse(resourceGroupName, accountName, databaseName, Context.NONE).getValue(); + } + + /** + * 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of 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 this + .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 the {@link SyncPoller} for polling of 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 this + .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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link PollerFlux} for polling of long-running operation. + */ + @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, + this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteSqlDatabase(String resourceGroupName, String accountName, + String databaseName) { + return this.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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteSqlDatabase(String resourceGroupName, String accountName, + String databaseName, Context context) { + return this.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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getSqlDatabaseThroughputAsync(String resourceGroupName, + String accountName, String databaseName) { + return getSqlDatabaseThroughputWithResponseAsync(resourceGroupName, accountName, databaseName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getSqlDatabaseThroughputWithResponse(String resourceGroupName, + String accountName, String databaseName, Context context) { + return getSqlDatabaseThroughputWithResponseAsync(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) + public ThroughputSettingsGetResultsInner getSqlDatabaseThroughput(String resourceGroupName, String accountName, + String databaseName) { + return getSqlDatabaseThroughputWithResponse(resourceGroupName, accountName, databaseName, Context.NONE) + .getValue(); + } + + /** + * 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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of 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 this + .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 the {@link SyncPoller} for polling of 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 this + .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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateSqlDatabaseToAutoscale(String resourceGroupName, String accountName, String databaseName) { + return this.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 the {@link SyncPoller} for polling of 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 this.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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateSqlDatabaseToManualThroughput(String resourceGroupName, String accountName, String databaseName) { + return this.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 the {@link SyncPoller} for polling of 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 this + .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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 as paginated response with + * {@link PagedFlux}. + */ + @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 as paginated response with + * {@link PagedFlux}. + */ + @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 as paginated response with + * {@link PagedIterable}. + */ + @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 as paginated response with + * {@link PagedIterable}. + */ + @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 along with {@link Response} on + * successful completion of {@link Mono}. + */ + @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 along with {@link Response} on + * successful completion of {@link Mono}. + */ + @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 on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getSqlContainerAsync(String resourceGroupName, String accountName, + String databaseName, String containerName) { + return getSqlContainerWithResponseAsync(resourceGroupName, accountName, databaseName, containerName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 along with {@link Response}. + */ + @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(); + } + + /** + * 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 getSqlContainerWithResponse(resourceGroupName, accountName, databaseName, containerName, Context.NONE) + .getValue(); + } + + /** + * 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of 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 this + .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 the {@link SyncPoller} for polling of 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 this + .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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link PollerFlux} for polling of long-running operation. + */ + @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, + this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteSqlContainer(String resourceGroupName, String accountName, + String databaseName, String containerName) { + return this.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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteSqlContainer(String resourceGroupName, String accountName, + String databaseName, String containerName, Context context) { + return this.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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with + * {@link Response} on successful completion of {@link Mono}. + */ + @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 along with + * {@link Response} on successful completion of {@link Mono}. + */ + @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 on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getSqlContainerThroughputAsync(String resourceGroupName, + String accountName, String databaseName, String containerName) { + return getSqlContainerThroughputWithResponseAsync(resourceGroupName, accountName, databaseName, containerName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 along with + * {@link Response}. + */ + @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(); + } + + /** + * 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 getSqlContainerThroughputWithResponse(resourceGroupName, accountName, databaseName, containerName, + Context.NONE).getValue(); + } + + /** + * 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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of 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 this + .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 the {@link SyncPoller} for polling of 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 this + .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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of 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 this + .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 the {@link SyncPoller} for polling of 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 this + .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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of 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 this + .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 the {@link SyncPoller} for polling of 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 this + .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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 ClientEncryptionKeys under 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 List operation response, that contains the client encryption keys and their properties along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listClientEncryptionKeysSinglePageAsync(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.listClientEncryptionKeys(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 ClientEncryptionKeys under 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 List operation response, that contains the client encryption keys and their properties along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listClientEncryptionKeysSinglePageAsync( + 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 + .listClientEncryptionKeys(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 ClientEncryptionKeys under 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 List operation response, that contains the client encryption keys and their properties as paginated + * response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listClientEncryptionKeysAsync(String resourceGroupName, + String accountName, String databaseName) { + return new PagedFlux<>( + () -> listClientEncryptionKeysSinglePageAsync(resourceGroupName, accountName, databaseName)); + } + + /** + * Lists the ClientEncryptionKeys under 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 List operation response, that contains the client encryption keys and their properties as paginated + * response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listClientEncryptionKeysAsync(String resourceGroupName, + String accountName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listClientEncryptionKeysSinglePageAsync(resourceGroupName, accountName, databaseName, context)); + } + + /** + * Lists the ClientEncryptionKeys under 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 List operation response, that contains the client encryption keys and their properties as paginated + * response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listClientEncryptionKeys(String resourceGroupName, + String accountName, String databaseName) { + return new PagedIterable<>(listClientEncryptionKeysAsync(resourceGroupName, accountName, databaseName)); + } + + /** + * Lists the ClientEncryptionKeys under 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 List operation response, that contains the client encryption keys and their properties as paginated + * response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listClientEncryptionKeys(String resourceGroupName, + String accountName, String databaseName, Context context) { + return new PagedIterable<>( + listClientEncryptionKeysAsync(resourceGroupName, accountName, databaseName, context)); + } + + /** + * Gets the ClientEncryptionKey under 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 clientEncryptionKeyName Cosmos DB ClientEncryptionKey name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the ClientEncryptionKey under an existing Azure Cosmos DB SQL database along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getClientEncryptionKeyWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String clientEncryptionKeyName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (clientEncryptionKeyName == null) { + return Mono.error( + new IllegalArgumentException("Parameter clientEncryptionKeyName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getClientEncryptionKey(this.client.getEndpoint(), + this.client.getSubscriptionId(), resourceGroupName, accountName, databaseName, clientEncryptionKeyName, + this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the ClientEncryptionKey under 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 clientEncryptionKeyName Cosmos DB ClientEncryptionKey name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the ClientEncryptionKey under an existing Azure Cosmos DB SQL database along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getClientEncryptionKeyWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String clientEncryptionKeyName, + 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 (clientEncryptionKeyName == null) { + return Mono.error( + new IllegalArgumentException("Parameter clientEncryptionKeyName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getClientEncryptionKey(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, accountName, databaseName, clientEncryptionKeyName, this.client.getApiVersion(), accept, + context); + } + + /** + * Gets the ClientEncryptionKey under 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 clientEncryptionKeyName Cosmos DB ClientEncryptionKey name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the ClientEncryptionKey under an existing Azure Cosmos DB SQL database on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getClientEncryptionKeyAsync(String resourceGroupName, + String accountName, String databaseName, String clientEncryptionKeyName) { + return getClientEncryptionKeyWithResponseAsync(resourceGroupName, accountName, databaseName, + clientEncryptionKeyName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the ClientEncryptionKey under 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 clientEncryptionKeyName Cosmos DB ClientEncryptionKey name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the ClientEncryptionKey under an existing Azure Cosmos DB SQL database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getClientEncryptionKeyWithResponse(String resourceGroupName, + String accountName, String databaseName, String clientEncryptionKeyName, Context context) { + return getClientEncryptionKeyWithResponseAsync(resourceGroupName, accountName, databaseName, + clientEncryptionKeyName, context).block(); + } + + /** + * Gets the ClientEncryptionKey under 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 clientEncryptionKeyName Cosmos DB ClientEncryptionKey name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the ClientEncryptionKey under an existing Azure Cosmos DB SQL database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ClientEncryptionKeyGetResultsInner getClientEncryptionKey(String resourceGroupName, String accountName, + String databaseName, String clientEncryptionKeyName) { + return getClientEncryptionKeyWithResponse(resourceGroupName, accountName, databaseName, clientEncryptionKeyName, + Context.NONE).getValue(); + } + + /** + * Create or update a ClientEncryptionKey. This API is meant to be invoked via tools such as the Azure Powershell + * (instead of directly). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param clientEncryptionKeyName Cosmos DB ClientEncryptionKey name. + * @param createUpdateClientEncryptionKeyParameters The parameters to provide for the client encryption key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return client Encryption Key along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateClientEncryptionKeyWithResponseAsync(String resourceGroupName, + String accountName, String databaseName, String clientEncryptionKeyName, + ClientEncryptionKeyCreateUpdateParameters createUpdateClientEncryptionKeyParameters) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (clientEncryptionKeyName == null) { + return Mono.error( + new IllegalArgumentException("Parameter clientEncryptionKeyName is required and cannot be null.")); + } + if (createUpdateClientEncryptionKeyParameters == null) { + return Mono.error(new IllegalArgumentException( + "Parameter createUpdateClientEncryptionKeyParameters is required and cannot be null.")); + } else { + createUpdateClientEncryptionKeyParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createUpdateClientEncryptionKey(this.client.getEndpoint(), + this.client.getSubscriptionId(), resourceGroupName, accountName, databaseName, clientEncryptionKeyName, + this.client.getApiVersion(), createUpdateClientEncryptionKeyParameters, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update a ClientEncryptionKey. This API is meant to be invoked via tools such as the Azure Powershell + * (instead of directly). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param clientEncryptionKeyName Cosmos DB ClientEncryptionKey name. + * @param createUpdateClientEncryptionKeyParameters The parameters to provide for the client encryption key. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return client Encryption Key along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateClientEncryptionKeyWithResponseAsync(String resourceGroupName, + String accountName, String databaseName, String clientEncryptionKeyName, + ClientEncryptionKeyCreateUpdateParameters createUpdateClientEncryptionKeyParameters, 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 (clientEncryptionKeyName == null) { + return Mono.error( + new IllegalArgumentException("Parameter clientEncryptionKeyName is required and cannot be null.")); + } + if (createUpdateClientEncryptionKeyParameters == null) { + return Mono.error(new IllegalArgumentException( + "Parameter createUpdateClientEncryptionKeyParameters is required and cannot be null.")); + } else { + createUpdateClientEncryptionKeyParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createUpdateClientEncryptionKey(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, accountName, databaseName, clientEncryptionKeyName, this.client.getApiVersion(), + createUpdateClientEncryptionKeyParameters, accept, context); + } + + /** + * Create or update a ClientEncryptionKey. This API is meant to be invoked via tools such as the Azure Powershell + * (instead of directly). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param clientEncryptionKeyName Cosmos DB ClientEncryptionKey name. + * @param createUpdateClientEncryptionKeyParameters The parameters to provide for the client encryption key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of client Encryption Key. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ClientEncryptionKeyGetResultsInner> + beginCreateUpdateClientEncryptionKeyAsync(String resourceGroupName, String accountName, String databaseName, + String clientEncryptionKeyName, + ClientEncryptionKeyCreateUpdateParameters createUpdateClientEncryptionKeyParameters) { + Mono>> mono = createUpdateClientEncryptionKeyWithResponseAsync(resourceGroupName, + accountName, databaseName, clientEncryptionKeyName, createUpdateClientEncryptionKeyParameters); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), ClientEncryptionKeyGetResultsInner.class, + ClientEncryptionKeyGetResultsInner.class, this.client.getContext()); + } + + /** + * Create or update a ClientEncryptionKey. This API is meant to be invoked via tools such as the Azure Powershell + * (instead of directly). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param clientEncryptionKeyName Cosmos DB ClientEncryptionKey name. + * @param createUpdateClientEncryptionKeyParameters The parameters to provide for the client encryption key. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of client Encryption Key. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ClientEncryptionKeyGetResultsInner> + beginCreateUpdateClientEncryptionKeyAsync(String resourceGroupName, String accountName, String databaseName, + String clientEncryptionKeyName, + ClientEncryptionKeyCreateUpdateParameters createUpdateClientEncryptionKeyParameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = createUpdateClientEncryptionKeyWithResponseAsync(resourceGroupName, + accountName, databaseName, clientEncryptionKeyName, createUpdateClientEncryptionKeyParameters, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), ClientEncryptionKeyGetResultsInner.class, + ClientEncryptionKeyGetResultsInner.class, context); + } + + /** + * Create or update a ClientEncryptionKey. This API is meant to be invoked via tools such as the Azure Powershell + * (instead of directly). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param clientEncryptionKeyName Cosmos DB ClientEncryptionKey name. + * @param createUpdateClientEncryptionKeyParameters The parameters to provide for the client encryption key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of client Encryption Key. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ClientEncryptionKeyGetResultsInner> + beginCreateUpdateClientEncryptionKey(String resourceGroupName, String accountName, String databaseName, + String clientEncryptionKeyName, + ClientEncryptionKeyCreateUpdateParameters createUpdateClientEncryptionKeyParameters) { + return this + .beginCreateUpdateClientEncryptionKeyAsync(resourceGroupName, accountName, databaseName, + clientEncryptionKeyName, createUpdateClientEncryptionKeyParameters) + .getSyncPoller(); + } + + /** + * Create or update a ClientEncryptionKey. This API is meant to be invoked via tools such as the Azure Powershell + * (instead of directly). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param clientEncryptionKeyName Cosmos DB ClientEncryptionKey name. + * @param createUpdateClientEncryptionKeyParameters The parameters to provide for the client encryption key. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of client Encryption Key. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ClientEncryptionKeyGetResultsInner> + beginCreateUpdateClientEncryptionKey(String resourceGroupName, String accountName, String databaseName, + String clientEncryptionKeyName, + ClientEncryptionKeyCreateUpdateParameters createUpdateClientEncryptionKeyParameters, Context context) { + return this + .beginCreateUpdateClientEncryptionKeyAsync(resourceGroupName, accountName, databaseName, + clientEncryptionKeyName, createUpdateClientEncryptionKeyParameters, context) + .getSyncPoller(); + } + + /** + * Create or update a ClientEncryptionKey. This API is meant to be invoked via tools such as the Azure Powershell + * (instead of directly). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param clientEncryptionKeyName Cosmos DB ClientEncryptionKey name. + * @param createUpdateClientEncryptionKeyParameters The parameters to provide for the client encryption key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return client Encryption Key on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateClientEncryptionKeyAsync(String resourceGroupName, + String accountName, String databaseName, String clientEncryptionKeyName, + ClientEncryptionKeyCreateUpdateParameters createUpdateClientEncryptionKeyParameters) { + return beginCreateUpdateClientEncryptionKeyAsync(resourceGroupName, accountName, databaseName, + clientEncryptionKeyName, createUpdateClientEncryptionKeyParameters).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a ClientEncryptionKey. This API is meant to be invoked via tools such as the Azure Powershell + * (instead of directly). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param clientEncryptionKeyName Cosmos DB ClientEncryptionKey name. + * @param createUpdateClientEncryptionKeyParameters The parameters to provide for the client encryption key. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return client Encryption Key on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateClientEncryptionKeyAsync(String resourceGroupName, + String accountName, String databaseName, String clientEncryptionKeyName, + ClientEncryptionKeyCreateUpdateParameters createUpdateClientEncryptionKeyParameters, Context context) { + return beginCreateUpdateClientEncryptionKeyAsync(resourceGroupName, accountName, databaseName, + clientEncryptionKeyName, createUpdateClientEncryptionKeyParameters, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a ClientEncryptionKey. This API is meant to be invoked via tools such as the Azure Powershell + * (instead of directly). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param clientEncryptionKeyName Cosmos DB ClientEncryptionKey name. + * @param createUpdateClientEncryptionKeyParameters The parameters to provide for the client encryption key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return client Encryption Key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ClientEncryptionKeyGetResultsInner createUpdateClientEncryptionKey(String resourceGroupName, + String accountName, String databaseName, String clientEncryptionKeyName, + ClientEncryptionKeyCreateUpdateParameters createUpdateClientEncryptionKeyParameters) { + return createUpdateClientEncryptionKeyAsync(resourceGroupName, accountName, databaseName, + clientEncryptionKeyName, createUpdateClientEncryptionKeyParameters).block(); + } + + /** + * Create or update a ClientEncryptionKey. This API is meant to be invoked via tools such as the Azure Powershell + * (instead of directly). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param clientEncryptionKeyName Cosmos DB ClientEncryptionKey name. + * @param createUpdateClientEncryptionKeyParameters The parameters to provide for the client encryption key. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return client Encryption Key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ClientEncryptionKeyGetResultsInner createUpdateClientEncryptionKey(String resourceGroupName, + String accountName, String databaseName, String clientEncryptionKeyName, + ClientEncryptionKeyCreateUpdateParameters createUpdateClientEncryptionKeyParameters, Context context) { + return createUpdateClientEncryptionKeyAsync(resourceGroupName, accountName, databaseName, + clientEncryptionKeyName, createUpdateClientEncryptionKeyParameters, 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 along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 as paginated + * response with {@link PagedFlux}. + */ + @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 as paginated + * response with {@link PagedFlux}. + */ + @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 as paginated + * response with {@link PagedIterable}. + */ + @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 as paginated + * response with {@link PagedIterable}. + */ + @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 along with {@link Response} on + * successful completion of {@link Mono}. + */ + @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 along with {@link Response} on + * successful completion of {@link Mono}. + */ + @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 on successful completion of + * {@link Mono}. + */ + @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(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 along with {@link Response}. + */ + @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(); + } + + /** + * 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 getSqlStoredProcedureWithResponse(resourceGroupName, accountName, databaseName, containerName, + storedProcedureName, Context.NONE).getValue(); + } + + /** + * 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of 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 this + .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 the {@link SyncPoller} for polling of 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 this + .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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link PollerFlux} for polling of long-running operation. + */ + @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, + this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteSqlStoredProcedure(String resourceGroupName, + String accountName, String databaseName, String containerName, String storedProcedureName) { + return this + .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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteSqlStoredProcedure(String resourceGroupName, + String accountName, String databaseName, String containerName, String storedProcedureName, Context context) { + return this + .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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 as paginated + * response with {@link PagedFlux}. + */ + @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 as paginated + * response with {@link PagedFlux}. + */ + @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 as paginated + * response with {@link PagedIterable}. + */ + @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 as paginated + * response with {@link PagedIterable}. + */ + @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 along with + * {@link Response} on successful completion of {@link Mono}. + */ + @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 along with + * {@link Response} on successful completion of {@link Mono}. + */ + @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 on successful completion + * of {@link Mono}. + */ + @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(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 along with + * {@link Response}. + */ + @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(); + } + + /** + * 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 getSqlUserDefinedFunctionWithResponse(resourceGroupName, accountName, databaseName, containerName, + userDefinedFunctionName, Context.NONE).getValue(); + } + + /** + * 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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of 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 this + .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 the {@link SyncPoller} for polling of 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 this + .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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link PollerFlux} for polling of long-running operation. + */ + @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, + this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteSqlUserDefinedFunction(String resourceGroupName, + String accountName, String databaseName, String containerName, String userDefinedFunctionName) { + return this + .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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteSqlUserDefinedFunction(String resourceGroupName, + String accountName, String databaseName, String containerName, String userDefinedFunctionName, + Context context) { + return this + .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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 as paginated response with + * {@link PagedFlux}. + */ + @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 as paginated response with + * {@link PagedFlux}. + */ + @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 as paginated response with + * {@link PagedIterable}. + */ + @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 as paginated response with + * {@link PagedIterable}. + */ + @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 along with {@link Response} on + * successful completion of {@link Mono}. + */ + @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 along with {@link Response} on + * successful completion of {@link Mono}. + */ + @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 on successful completion of + * {@link Mono}. + */ + @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(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 along with {@link Response}. + */ + @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(); + } + + /** + * 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 getSqlTriggerWithResponse(resourceGroupName, accountName, databaseName, containerName, triggerName, + Context.NONE).getValue(); + } + + /** + * 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of 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 this + .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 the {@link SyncPoller} for polling of 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 this + .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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link PollerFlux} for polling of long-running operation. + */ + @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, + this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteSqlTrigger(String resourceGroupName, String accountName, + String databaseName, String containerName, String triggerName) { + return this.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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteSqlTrigger(String resourceGroupName, String accountName, + String databaseName, String containerName, String triggerName, Context context) { + return this + .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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getSqlRoleDefinitionAsync(String roleDefinitionId, + String resourceGroupName, String accountName) { + return getSqlRoleDefinitionWithResponseAsync(roleDefinitionId, resourceGroupName, accountName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getSqlRoleDefinitionWithResponse(String roleDefinitionId, + String resourceGroupName, String accountName, Context context) { + return getSqlRoleDefinitionWithResponseAsync(roleDefinitionId, resourceGroupName, accountName, 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) + public SqlRoleDefinitionGetResultsInner getSqlRoleDefinition(String roleDefinitionId, String resourceGroupName, + String accountName) { + return getSqlRoleDefinitionWithResponse(roleDefinitionId, resourceGroupName, accountName, Context.NONE) + .getValue(); + } + + /** + * 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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of 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 this + .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 the {@link SyncPoller} for polling of 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 this + .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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link PollerFlux} for polling of long-running operation. + */ + @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, + this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteSqlRoleDefinition(String roleDefinitionId, + String resourceGroupName, String accountName) { + return this.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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteSqlRoleDefinition(String roleDefinitionId, + String resourceGroupName, String accountName, Context context) { + return this.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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getSqlRoleAssignmentAsync(String roleAssignmentId, + String resourceGroupName, String accountName) { + return getSqlRoleAssignmentWithResponseAsync(roleAssignmentId, resourceGroupName, accountName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getSqlRoleAssignmentWithResponse(String roleAssignmentId, + String resourceGroupName, String accountName, Context context) { + return getSqlRoleAssignmentWithResponseAsync(roleAssignmentId, resourceGroupName, accountName, context).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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the 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 getSqlRoleAssignmentWithResponse(roleAssignmentId, resourceGroupName, accountName, Context.NONE) + .getValue(); + } + + /** + * 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of 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 this + .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 the {@link SyncPoller} for polling of 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 this + .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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link PollerFlux} for polling of long-running operation. + */ + @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, + this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteSqlRoleAssignment(String roleAssignmentId, + String resourceGroupName, String accountName) { + return this.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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteSqlRoleAssignment(String roleAssignmentId, + String resourceGroupName, String accountName, Context context) { + return this.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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of 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 this + .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 the {@link SyncPoller} for polling of 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 this + .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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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..f140524b8bb82 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlResourcesImpl.java @@ -0,0 +1,1425 @@ +// Copyright (c) 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.ClientEncryptionKeyGetResultsInner; +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.ClientEncryptionKeyGetResults; +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; + +public final class SqlResourcesImpl implements SqlResources { + private static 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 ResourceManagerUtils.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 ResourceManagerUtils.mapPage(inner, inner1 -> new SqlDatabaseGetResultsImpl(inner1, this.manager())); + } + + 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 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 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 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 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 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 ResourceManagerUtils.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 ResourceManagerUtils.mapPage(inner, inner1 -> new SqlContainerGetResultsImpl(inner1, this.manager())); + } + + 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 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 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 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 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 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 listClientEncryptionKeys(String resourceGroupName, + String accountName, String databaseName) { + PagedIterable inner + = this.serviceClient().listClientEncryptionKeys(resourceGroupName, accountName, databaseName); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new ClientEncryptionKeyGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listClientEncryptionKeys(String resourceGroupName, + String accountName, String databaseName, Context context) { + PagedIterable inner + = this.serviceClient().listClientEncryptionKeys(resourceGroupName, accountName, databaseName, context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new ClientEncryptionKeyGetResultsImpl(inner1, this.manager())); + } + + public Response getClientEncryptionKeyWithResponse(String resourceGroupName, + String accountName, String databaseName, String clientEncryptionKeyName, Context context) { + Response inner = this.serviceClient() + .getClientEncryptionKeyWithResponse(resourceGroupName, accountName, databaseName, clientEncryptionKeyName, + context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ClientEncryptionKeyGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ClientEncryptionKeyGetResults getClientEncryptionKey(String resourceGroupName, String accountName, + String databaseName, String clientEncryptionKeyName) { + ClientEncryptionKeyGetResultsInner inner = this.serviceClient() + .getClientEncryptionKey(resourceGroupName, accountName, databaseName, clientEncryptionKeyName); + if (inner != null) { + return new ClientEncryptionKeyGetResultsImpl(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 ResourceManagerUtils.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 ResourceManagerUtils.mapPage(inner, + inner1 -> new SqlStoredProcedureGetResultsImpl(inner1, this.manager())); + } + + 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 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 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 ResourceManagerUtils.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 ResourceManagerUtils.mapPage(inner, + inner1 -> new SqlUserDefinedFunctionGetResultsImpl(inner1, this.manager())); + } + + 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 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 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 ResourceManagerUtils.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 ResourceManagerUtils.mapPage(inner, inner1 -> new SqlTriggerGetResultsImpl(inner1, this.manager())); + } + + 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 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 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 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 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 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 ResourceManagerUtils.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 ResourceManagerUtils.mapPage(inner, + inner1 -> new SqlRoleDefinitionGetResultsImpl(inner1, this.manager())); + } + + 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 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 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 ResourceManagerUtils.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 ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 ClientEncryptionKeyGetResults getClientEncryptionKeyById(String id) { + String resourceGroupName = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 clientEncryptionKeyName = ResourceManagerUtils.getValueFromIdByName(id, "clientEncryptionKeys"); + if (clientEncryptionKeyName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'clientEncryptionKeys'.", id))); + } + return this + .getClientEncryptionKeyWithResponse(resourceGroupName, accountName, databaseName, clientEncryptionKeyName, + Context.NONE) + .getValue(); + } + + public Response getClientEncryptionKeyByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 clientEncryptionKeyName = ResourceManagerUtils.getValueFromIdByName(id, "clientEncryptionKeys"); + if (clientEncryptionKeyName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'clientEncryptionKeys'.", id))); + } + return this.getClientEncryptionKeyWithResponse(resourceGroupName, accountName, databaseName, + clientEncryptionKeyName, context); + } + + public SqlStoredProcedureGetResults getSqlStoredProcedureById(String id) { + String resourceGroupName = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 ClientEncryptionKeyGetResultsImpl defineUpdateClientEncryptionKey(String name) { + return new ClientEncryptionKeyGetResultsImpl(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..a32418a90cb35 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlRoleAssignmentGetResultsImpl.java @@ -0,0 +1,173 @@ +// Copyright (c) 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 String resourceGroupName() { + return resourceGroupName; + } + + 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 = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "sqlRoleAssignments"); + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = ResourceManagerUtils.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..68a959ecacaeb --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlRoleDefinitionGetResultsImpl.java @@ -0,0 +1,201 @@ +// Copyright (c) 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 String resourceGroupName() { + return resourceGroupName; + } + + 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 = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "sqlRoleDefinitions"); + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = ResourceManagerUtils.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..c0af7f3b45b96 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlStoredProcedureGetResultsImpl.java @@ -0,0 +1,213 @@ +// Copyright (c) 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.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 SqlStoredProcedureGetPropertiesResource resource() { + return this.innerModel().resource(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + 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 = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.databaseName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "sqlDatabases"); + this.containerName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "containers"); + this.storedProcedureName = ResourceManagerUtils.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 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..89289ea45caf3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlTriggerGetResultsImpl.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.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.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 SqlTriggerGetPropertiesResource resource() { + return this.innerModel().resource(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + 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 = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.databaseName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "sqlDatabases"); + this.containerName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "containers"); + this.triggerName = ResourceManagerUtils.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 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..9c47d160eb844 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlUserDefinedFunctionGetResultsImpl.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.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.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 SqlUserDefinedFunctionGetPropertiesResource resource() { + return this.innerModel().resource(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + 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 = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.databaseName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "sqlDatabases"); + this.containerName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "containers"); + this.userDefinedFunctionName + = ResourceManagerUtils.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 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..59b2225e8d660 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/TableGetResultsImpl.java @@ -0,0 +1,216 @@ +// Copyright (c) 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.BackupInformation; +import com.azure.resourcemanager.cosmos.generated.models.ContinuousBackupRestoreLocation; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +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 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 String resourceGroupName() { + return resourceGroupName; + } + + 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 = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.tableName = ResourceManagerUtils.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 BackupInformation retrieveContinuousBackupInformation(ContinuousBackupRestoreLocation location) { + return serviceManager.tableResources() + .retrieveContinuousBackupInformation(resourceGroupName, accountName, tableName, location); + } + + public BackupInformation retrieveContinuousBackupInformation(ContinuousBackupRestoreLocation location, + Context context) { + return serviceManager.tableResources() + .retrieveContinuousBackupInformation(resourceGroupName, accountName, tableName, location, context); + } + + 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 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..e2487709c264f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/TableResourcesClientImpl.java @@ -0,0 +1,2061 @@ +// Copyright (c) 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.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.BackupInformationInner; +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.ContinuousBackupRestoreLocation; +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 { + /** + * 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") + public 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); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/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("tableName") String tableName, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ContinuousBackupRestoreLocation location, + @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 along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 as paginated response with + * {@link PagedFlux}. + */ + @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 as paginated response with + * {@link PagedFlux}. + */ + @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 as paginated response with + * {@link PagedIterable}. + */ + @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 as paginated response with + * {@link PagedIterable}. + */ + @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 along with + * {@link Response} on successful completion of {@link Mono}. + */ + @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 along with + * {@link Response} on successful completion of {@link Mono}. + */ + @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 on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getTableAsync(String resourceGroupName, String accountName, String tableName) { + return getTableWithResponseAsync(resourceGroupName, accountName, tableName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTableWithResponse(String resourceGroupName, String accountName, + String tableName, Context context) { + return getTableWithResponseAsync(resourceGroupName, accountName, tableName, context).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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 getTableWithResponse(resourceGroupName, accountName, tableName, Context.NONE).getValue(); + } + + /** + * 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of an Azure Cosmos DB Table. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, TableGetResultsInner> beginCreateUpdateTable( + String resourceGroupName, String accountName, String tableName, + TableCreateUpdateParameters createUpdateTableParameters) { + return this.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 the {@link SyncPoller} for polling of 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 this + .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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link PollerFlux} for polling of long-running operation. + */ + @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, + this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteTable(String resourceGroupName, String accountName, + String tableName) { + return this.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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteTable(String resourceGroupName, String accountName, + String tableName, Context context) { + return this.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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 + * along with {@link Response} on successful completion of {@link Mono}. + */ + @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 + * along with {@link Response} on successful completion of {@link Mono}. + */ + @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 + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getTableThroughputAsync(String resourceGroupName, + String accountName, String tableName) { + return getTableThroughputWithResponseAsync(resourceGroupName, accountName, tableName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 + * along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTableThroughputWithResponse(String resourceGroupName, + String accountName, String tableName, Context context) { + return getTableThroughputWithResponseAsync(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) + public ThroughputSettingsGetResultsInner getTableThroughput(String resourceGroupName, String accountName, + String tableName) { + return getTableThroughputWithResponse(resourceGroupName, accountName, tableName, Context.NONE).getValue(); + } + + /** + * 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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of 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 this + .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 the {@link SyncPoller} for polling of 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 this + .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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateTableToAutoscale(String resourceGroupName, String accountName, String tableName) { + return this.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 the {@link SyncPoller} for polling of 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 this.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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of 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, this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of 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 the {@link SyncPoller} for polling of an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateTableToManualThroughput(String resourceGroupName, String accountName, String tableName) { + return this.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 the {@link SyncPoller} for polling of 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 this.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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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(); + } + + /** + * Retrieves continuous backup information for a 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 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> retrieveContinuousBackupInformationWithResponseAsync( + String resourceGroupName, String accountName, String tableName, 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 (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName 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, tableName, this.client.getApiVersion(), + location, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves continuous backup information for a 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 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> retrieveContinuousBackupInformationWithResponseAsync( + String resourceGroupName, String accountName, String tableName, 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 (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName 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, tableName, this.client.getApiVersion(), location, accept, context); + } + + /** + * Retrieves continuous backup information for a 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 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 the {@link PollerFlux} for polling of backup information of a resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, BackupInformationInner> + beginRetrieveContinuousBackupInformationAsync(String resourceGroupName, String accountName, String tableName, + ContinuousBackupRestoreLocation location) { + Mono>> mono + = retrieveContinuousBackupInformationWithResponseAsync(resourceGroupName, accountName, tableName, location); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), BackupInformationInner.class, BackupInformationInner.class, + this.client.getContext()); + } + + /** + * Retrieves continuous backup information for a 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 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 the {@link PollerFlux} for polling of backup information of a resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, BackupInformationInner> + beginRetrieveContinuousBackupInformationAsync(String resourceGroupName, String accountName, String tableName, + ContinuousBackupRestoreLocation location, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = retrieveContinuousBackupInformationWithResponseAsync(resourceGroupName, + accountName, tableName, location, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), BackupInformationInner.class, BackupInformationInner.class, context); + } + + /** + * Retrieves continuous backup information for a 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 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 the {@link SyncPoller} for polling of backup information of a resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, BackupInformationInner> + beginRetrieveContinuousBackupInformation(String resourceGroupName, String accountName, String tableName, + ContinuousBackupRestoreLocation location) { + return this.beginRetrieveContinuousBackupInformationAsync(resourceGroupName, accountName, tableName, location) + .getSyncPoller(); + } + + /** + * Retrieves continuous backup information for a 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 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 the {@link SyncPoller} for polling of backup information of a resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, BackupInformationInner> + beginRetrieveContinuousBackupInformation(String resourceGroupName, String accountName, String tableName, + ContinuousBackupRestoreLocation location, Context context) { + return this + .beginRetrieveContinuousBackupInformationAsync(resourceGroupName, accountName, tableName, location, context) + .getSyncPoller(); + } + + /** + * Retrieves continuous backup information for a 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 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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono retrieveContinuousBackupInformationAsync(String resourceGroupName, + String accountName, String tableName, ContinuousBackupRestoreLocation location) { + return beginRetrieveContinuousBackupInformationAsync(resourceGroupName, accountName, tableName, location).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Retrieves continuous backup information for a 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 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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono retrieveContinuousBackupInformationAsync(String resourceGroupName, + String accountName, String tableName, ContinuousBackupRestoreLocation location, Context context) { + return beginRetrieveContinuousBackupInformationAsync(resourceGroupName, accountName, tableName, location, + context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Retrieves continuous backup information for a 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 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 tableName, ContinuousBackupRestoreLocation location) { + return retrieveContinuousBackupInformationAsync(resourceGroupName, accountName, tableName, location).block(); + } + + /** + * Retrieves continuous backup information for a 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 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 tableName, ContinuousBackupRestoreLocation location, Context context) { + return retrieveContinuousBackupInformationAsync(resourceGroupName, accountName, tableName, location, 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..21538b7c40e5a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/TableResourcesImpl.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.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.BackupInformationInner; +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.BackupInformation; +import com.azure.resourcemanager.cosmos.generated.models.ContinuousBackupRestoreLocation; +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; + +public final class TableResourcesImpl implements TableResources { + private static 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 ResourceManagerUtils.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 ResourceManagerUtils.mapPage(inner, inner1 -> new TableGetResultsImpl(inner1, this.manager())); + } + + 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 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 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 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 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 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 BackupInformation retrieveContinuousBackupInformation(String resourceGroupName, String accountName, + String tableName, ContinuousBackupRestoreLocation location) { + BackupInformationInner inner = this.serviceClient() + .retrieveContinuousBackupInformation(resourceGroupName, accountName, tableName, location); + if (inner != null) { + return new BackupInformationImpl(inner, this.manager()); + } else { + return null; + } + } + + public BackupInformation retrieveContinuousBackupInformation(String resourceGroupName, String accountName, + String tableName, ContinuousBackupRestoreLocation location, Context context) { + BackupInformationInner inner = this.serviceClient() + .retrieveContinuousBackupInformation(resourceGroupName, accountName, tableName, location, context); + if (inner != null) { + return new BackupInformationImpl(inner, this.manager()); + } else { + return null; + } + } + + public TableGetResults getTableById(String id) { + String resourceGroupName = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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..3a684ff67372f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/ThroughputSettingsGetResultsImpl.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.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.ThroughputSettingsGetResultsInner; +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 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/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..8a37c4f48ca68 --- /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/AccountKeyMetadata.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AccountKeyMetadata.java new file mode 100644 index 0000000000000..905701acc1c30 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AccountKeyMetadata.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.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * The metadata related to an access key for a given database account. + */ +@Immutable +public final class AccountKeyMetadata implements JsonSerializable { + /* + * Generation time in UTC of the key in ISO-8601 format. If the value is missing from the object, it means that the + * last key regeneration was triggered before 2022-06-18. + */ + private OffsetDateTime generationTime; + + /** + * Creates an instance of AccountKeyMetadata class. + */ + public AccountKeyMetadata() { + } + + /** + * Get the generationTime property: Generation time in UTC of the key in ISO-8601 format. If the value is missing + * from the object, it means that the last key regeneration was triggered before 2022-06-18. + * + * @return the generationTime value. + */ + public OffsetDateTime generationTime() { + return this.generationTime; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AccountKeyMetadata from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AccountKeyMetadata if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the AccountKeyMetadata. + */ + public static AccountKeyMetadata fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AccountKeyMetadata deserializedAccountKeyMetadata = new AccountKeyMetadata(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("generationTime".equals(fieldName)) { + deserializedAccountKeyMetadata.generationTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedAccountKeyMetadata; + }); + } +} 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..2e231db144235 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AnalyticalStorageConfiguration.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Analytical storage specific properties. + */ +@Fluent +public final class AnalyticalStorageConfiguration implements JsonSerializable { + /* + * Describes the types of schema for analytical storage. + */ + private AnalyticalStorageSchemaType schemaType; + + /** + * Creates an instance of AnalyticalStorageConfiguration class. + */ + public AnalyticalStorageConfiguration() { + } + + /** + * 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("schemaType", this.schemaType == null ? null : this.schemaType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AnalyticalStorageConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AnalyticalStorageConfiguration if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AnalyticalStorageConfiguration. + */ + public static AnalyticalStorageConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AnalyticalStorageConfiguration deserializedAnalyticalStorageConfiguration + = new AnalyticalStorageConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("schemaType".equals(fieldName)) { + deserializedAnalyticalStorageConfiguration.schemaType + = AnalyticalStorageSchemaType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAnalyticalStorageConfiguration; + }); + } +} 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..9ea9fc6969fce --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AnalyticalStorageSchemaType.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.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Describes the types of schema for analytical storage. + */ +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 a new instance of AnalyticalStorageSchemaType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AnalyticalStorageSchemaType() { + } + + /** + * Creates or finds a AnalyticalStorageSchemaType from its string representation. + * + * @param name a name to look for. + * @return the corresponding AnalyticalStorageSchemaType. + */ + public static AnalyticalStorageSchemaType fromString(String name) { + return fromString(name, AnalyticalStorageSchemaType.class); + } + + /** + * Gets known AnalyticalStorageSchemaType values. + * + * @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..6c4d6dc0125ef --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ApiProperties.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ApiProperties model. + */ +@Fluent +public final class ApiProperties implements JsonSerializable { + /* + * Describes the version of the MongoDB account. + */ + private ServerVersion serverVersion; + + /** + * Creates an instance of ApiProperties class. + */ + public ApiProperties() { + } + + /** + * Get the serverVersion property: Describes the version of the MongoDB account. + * + * @return the serverVersion value. + */ + public ServerVersion serverVersion() { + return this.serverVersion; + } + + /** + * Set the serverVersion property: Describes the version of the 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("serverVersion", this.serverVersion == null ? null : this.serverVersion.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ApiProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ApiProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ApiProperties. + */ + public static ApiProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ApiProperties deserializedApiProperties = new ApiProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("serverVersion".equals(fieldName)) { + deserializedApiProperties.serverVersion = ServerVersion.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedApiProperties; + }); + } +} 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..f454f38b94b9b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ApiType.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.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Enum to indicate the API type of the restorable database account. + */ +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 a new instance of ApiType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ApiType() { + } + + /** + * Creates or finds a ApiType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ApiType. + */ + public static ApiType fromString(String name) { + return fromString(name, ApiType.class); + } + + /** + * Gets known ApiType values. + * + * @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..950eac13a7c42 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ArmProxyResource.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.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * 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 { + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ArmProxyResource class. + */ + public ArmProxyResource() { + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ArmProxyResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ArmProxyResource if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ArmProxyResource. + */ + public static ArmProxyResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ArmProxyResource deserializedArmProxyResource = new ArmProxyResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedArmProxyResource.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedArmProxyResource.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedArmProxyResource.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedArmProxyResource; + }); + } +} 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..bdb200b3ff5a8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ArmResourceProperties.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.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * The core properties of ARM resources. + */ +@Fluent +public class ArmResourceProperties extends Resource { + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ArmResourceProperties class. + */ + public ArmResourceProperties() { + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ArmResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ArmResourceProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ArmResourceProperties. + */ + public static ArmResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ArmResourceProperties deserializedArmResourceProperties = new ArmResourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedArmResourceProperties.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedArmResourceProperties.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedArmResourceProperties.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedArmResourceProperties.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedArmResourceProperties.withTags(tags); + } else { + reader.skipChildren(); + } + } + + return deserializedArmResourceProperties; + }); + } +} 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..75706f05a9657 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AuthenticationMethod.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.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * 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'. + */ +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"); + + /** + * Static value Ldap for AuthenticationMethod. + */ + public static final AuthenticationMethod LDAP = fromString("Ldap"); + + /** + * Creates a new instance of AuthenticationMethod value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AuthenticationMethod() { + } + + /** + * Creates or finds a AuthenticationMethod from its string representation. + * + * @param name a name to look for. + * @return the corresponding AuthenticationMethod. + */ + public static AuthenticationMethod fromString(String name) { + return fromString(name, AuthenticationMethod.class); + } + + /** + * Gets known AuthenticationMethod values. + * + * @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/AuthenticationMethodLdapProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AuthenticationMethodLdapProperties.java new file mode 100644 index 0000000000000..498c86dbd823d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AuthenticationMethodLdapProperties.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.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Ldap authentication method properties. This feature is in preview. + */ +@Fluent +public final class AuthenticationMethodLdapProperties implements JsonSerializable { + /* + * Hostname of the LDAP server. + */ + private String serverHostname; + + /* + * Port of the LDAP server. + */ + private Integer serverPort; + + /* + * Distinguished name of the look up user account, who can look up user details on authentication. + */ + private String serviceUserDistinguishedName; + + /* + * Password of the look up user. + */ + private String serviceUserPassword; + + /* + * Distinguished name of the object to start the recursive search of users from. + */ + private String searchBaseDistinguishedName; + + /* + * Template to use for searching. Defaults to (cn=%s) where %s will be replaced by the username used to login. + */ + private String searchFilterTemplate; + + /* + * The serverCertificates property. + */ + private List serverCertificates; + + /* + * Timeout for connecting to the LDAP server in miliseconds. The default is 5000 ms. + */ + private Integer connectionTimeoutInMs; + + /** + * Creates an instance of AuthenticationMethodLdapProperties class. + */ + public AuthenticationMethodLdapProperties() { + } + + /** + * Get the serverHostname property: Hostname of the LDAP server. + * + * @return the serverHostname value. + */ + public String serverHostname() { + return this.serverHostname; + } + + /** + * Set the serverHostname property: Hostname of the LDAP server. + * + * @param serverHostname the serverHostname value to set. + * @return the AuthenticationMethodLdapProperties object itself. + */ + public AuthenticationMethodLdapProperties withServerHostname(String serverHostname) { + this.serverHostname = serverHostname; + return this; + } + + /** + * Get the serverPort property: Port of the LDAP server. + * + * @return the serverPort value. + */ + public Integer serverPort() { + return this.serverPort; + } + + /** + * Set the serverPort property: Port of the LDAP server. + * + * @param serverPort the serverPort value to set. + * @return the AuthenticationMethodLdapProperties object itself. + */ + public AuthenticationMethodLdapProperties withServerPort(Integer serverPort) { + this.serverPort = serverPort; + return this; + } + + /** + * Get the serviceUserDistinguishedName property: Distinguished name of the look up user account, who can look up + * user details on authentication. + * + * @return the serviceUserDistinguishedName value. + */ + public String serviceUserDistinguishedName() { + return this.serviceUserDistinguishedName; + } + + /** + * Set the serviceUserDistinguishedName property: Distinguished name of the look up user account, who can look up + * user details on authentication. + * + * @param serviceUserDistinguishedName the serviceUserDistinguishedName value to set. + * @return the AuthenticationMethodLdapProperties object itself. + */ + public AuthenticationMethodLdapProperties withServiceUserDistinguishedName(String serviceUserDistinguishedName) { + this.serviceUserDistinguishedName = serviceUserDistinguishedName; + return this; + } + + /** + * Get the serviceUserPassword property: Password of the look up user. + * + * @return the serviceUserPassword value. + */ + public String serviceUserPassword() { + return this.serviceUserPassword; + } + + /** + * Set the serviceUserPassword property: Password of the look up user. + * + * @param serviceUserPassword the serviceUserPassword value to set. + * @return the AuthenticationMethodLdapProperties object itself. + */ + public AuthenticationMethodLdapProperties withServiceUserPassword(String serviceUserPassword) { + this.serviceUserPassword = serviceUserPassword; + return this; + } + + /** + * Get the searchBaseDistinguishedName property: Distinguished name of the object to start the recursive search of + * users from. + * + * @return the searchBaseDistinguishedName value. + */ + public String searchBaseDistinguishedName() { + return this.searchBaseDistinguishedName; + } + + /** + * Set the searchBaseDistinguishedName property: Distinguished name of the object to start the recursive search of + * users from. + * + * @param searchBaseDistinguishedName the searchBaseDistinguishedName value to set. + * @return the AuthenticationMethodLdapProperties object itself. + */ + public AuthenticationMethodLdapProperties withSearchBaseDistinguishedName(String searchBaseDistinguishedName) { + this.searchBaseDistinguishedName = searchBaseDistinguishedName; + return this; + } + + /** + * Get the searchFilterTemplate property: Template to use for searching. Defaults to (cn=%s) where %s will be + * replaced by the username used to login. + * + * @return the searchFilterTemplate value. + */ + public String searchFilterTemplate() { + return this.searchFilterTemplate; + } + + /** + * Set the searchFilterTemplate property: Template to use for searching. Defaults to (cn=%s) where %s will be + * replaced by the username used to login. + * + * @param searchFilterTemplate the searchFilterTemplate value to set. + * @return the AuthenticationMethodLdapProperties object itself. + */ + public AuthenticationMethodLdapProperties withSearchFilterTemplate(String searchFilterTemplate) { + this.searchFilterTemplate = searchFilterTemplate; + return this; + } + + /** + * Get the serverCertificates property: The serverCertificates property. + * + * @return the serverCertificates value. + */ + public List serverCertificates() { + return this.serverCertificates; + } + + /** + * Set the serverCertificates property: The serverCertificates property. + * + * @param serverCertificates the serverCertificates value to set. + * @return the AuthenticationMethodLdapProperties object itself. + */ + public AuthenticationMethodLdapProperties withServerCertificates(List serverCertificates) { + this.serverCertificates = serverCertificates; + return this; + } + + /** + * Get the connectionTimeoutInMs property: Timeout for connecting to the LDAP server in miliseconds. The default is + * 5000 ms. + * + * @return the connectionTimeoutInMs value. + */ + public Integer connectionTimeoutInMs() { + return this.connectionTimeoutInMs; + } + + /** + * Set the connectionTimeoutInMs property: Timeout for connecting to the LDAP server in miliseconds. The default is + * 5000 ms. + * + * @param connectionTimeoutInMs the connectionTimeoutInMs value to set. + * @return the AuthenticationMethodLdapProperties object itself. + */ + public AuthenticationMethodLdapProperties withConnectionTimeoutInMs(Integer connectionTimeoutInMs) { + this.connectionTimeoutInMs = connectionTimeoutInMs; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (serverCertificates() != null) { + serverCertificates().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("serverHostname", this.serverHostname); + jsonWriter.writeNumberField("serverPort", this.serverPort); + jsonWriter.writeStringField("serviceUserDistinguishedName", this.serviceUserDistinguishedName); + jsonWriter.writeStringField("serviceUserPassword", this.serviceUserPassword); + jsonWriter.writeStringField("searchBaseDistinguishedName", this.searchBaseDistinguishedName); + jsonWriter.writeStringField("searchFilterTemplate", this.searchFilterTemplate); + jsonWriter.writeArrayField("serverCertificates", this.serverCertificates, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeNumberField("connectionTimeoutInMs", this.connectionTimeoutInMs); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AuthenticationMethodLdapProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AuthenticationMethodLdapProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AuthenticationMethodLdapProperties. + */ + public static AuthenticationMethodLdapProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AuthenticationMethodLdapProperties deserializedAuthenticationMethodLdapProperties + = new AuthenticationMethodLdapProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("serverHostname".equals(fieldName)) { + deserializedAuthenticationMethodLdapProperties.serverHostname = reader.getString(); + } else if ("serverPort".equals(fieldName)) { + deserializedAuthenticationMethodLdapProperties.serverPort = reader.getNullable(JsonReader::getInt); + } else if ("serviceUserDistinguishedName".equals(fieldName)) { + deserializedAuthenticationMethodLdapProperties.serviceUserDistinguishedName = reader.getString(); + } else if ("serviceUserPassword".equals(fieldName)) { + deserializedAuthenticationMethodLdapProperties.serviceUserPassword = reader.getString(); + } else if ("searchBaseDistinguishedName".equals(fieldName)) { + deserializedAuthenticationMethodLdapProperties.searchBaseDistinguishedName = reader.getString(); + } else if ("searchFilterTemplate".equals(fieldName)) { + deserializedAuthenticationMethodLdapProperties.searchFilterTemplate = reader.getString(); + } else if ("serverCertificates".equals(fieldName)) { + List serverCertificates = reader.readArray(reader1 -> Certificate.fromJson(reader1)); + deserializedAuthenticationMethodLdapProperties.serverCertificates = serverCertificates; + } else if ("connectionTimeoutInMs".equals(fieldName)) { + deserializedAuthenticationMethodLdapProperties.connectionTimeoutInMs + = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedAuthenticationMethodLdapProperties; + }); + } +} 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..5d365a305beef --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AutoUpgradePolicyResource.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Cosmos DB resource auto-upgrade policy. + */ +@Fluent +public final class AutoUpgradePolicyResource implements JsonSerializable { + /* + * Represents throughput policy which service must adhere to for auto-upgrade + */ + private ThroughputPolicyResource throughputPolicy; + + /** + * Creates an instance of AutoUpgradePolicyResource class. + */ + public AutoUpgradePolicyResource() { + } + + /** + * 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("throughputPolicy", this.throughputPolicy); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AutoUpgradePolicyResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AutoUpgradePolicyResource if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AutoUpgradePolicyResource. + */ + public static AutoUpgradePolicyResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AutoUpgradePolicyResource deserializedAutoUpgradePolicyResource = new AutoUpgradePolicyResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("throughputPolicy".equals(fieldName)) { + deserializedAutoUpgradePolicyResource.throughputPolicy = ThroughputPolicyResource.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAutoUpgradePolicyResource; + }); + } +} 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..1fab45a03ace9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AutoscaleSettings.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The AutoscaleSettings model. + */ +@Fluent +public final class AutoscaleSettings implements JsonSerializable { + /* + * Represents maximum throughput, the resource can scale up to. + */ + private Integer maxThroughput; + + /** + * Creates an instance of AutoscaleSettings class. + */ + public AutoscaleSettings() { + } + + /** + * 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("maxThroughput", this.maxThroughput); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AutoscaleSettings from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AutoscaleSettings if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the AutoscaleSettings. + */ + public static AutoscaleSettings fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AutoscaleSettings deserializedAutoscaleSettings = new AutoscaleSettings(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("maxThroughput".equals(fieldName)) { + deserializedAutoscaleSettings.maxThroughput = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedAutoscaleSettings; + }); + } +} 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..89b021d5c56f6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AutoscaleSettingsResource.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.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Cosmos DB provisioned throughput settings object. + */ +@Fluent +public final class AutoscaleSettingsResource implements JsonSerializable { + /* + * Represents maximum throughput container can scale up to. + */ + private int maxThroughput; + + /* + * Cosmos DB resource auto-upgrade policy + */ + private AutoUpgradePolicyResource autoUpgradePolicy; + + /* + * Represents target maximum throughput container can scale up to once offer is no longer in pending state. + */ + private Integer targetMaxThroughput; + + /** + * Creates an instance of AutoscaleSettingsResource class. + */ + public AutoscaleSettingsResource() { + } + + /** + * 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("maxThroughput", this.maxThroughput); + jsonWriter.writeJsonField("autoUpgradePolicy", this.autoUpgradePolicy); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AutoscaleSettingsResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AutoscaleSettingsResource if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AutoscaleSettingsResource. + */ + public static AutoscaleSettingsResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AutoscaleSettingsResource deserializedAutoscaleSettingsResource = new AutoscaleSettingsResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("maxThroughput".equals(fieldName)) { + deserializedAutoscaleSettingsResource.maxThroughput = reader.getInt(); + } else if ("autoUpgradePolicy".equals(fieldName)) { + deserializedAutoscaleSettingsResource.autoUpgradePolicy + = AutoUpgradePolicyResource.fromJson(reader); + } else if ("targetMaxThroughput".equals(fieldName)) { + deserializedAutoscaleSettingsResource.targetMaxThroughput = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedAutoscaleSettingsResource; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AzureConnectionType.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AzureConnectionType.java new file mode 100644 index 0000000000000..0ca0007fa556d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AzureConnectionType.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.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * How to connect to the azure services needed for running the cluster. + */ +public final class AzureConnectionType extends ExpandableStringEnum { + /** + * Static value None for AzureConnectionType. + */ + public static final AzureConnectionType NONE = fromString("None"); + + /** + * Static value VPN for AzureConnectionType. + */ + public static final AzureConnectionType VPN = fromString("VPN"); + + /** + * Creates a new instance of AzureConnectionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AzureConnectionType() { + } + + /** + * Creates or finds a AzureConnectionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding AzureConnectionType. + */ + public static AzureConnectionType fromString(String name) { + return fromString(name, AzureConnectionType.class); + } + + /** + * Gets known AzureConnectionType values. + * + * @return known AzureConnectionType values. + */ + public static Collection values() { + return values(AzureConnectionType.class); + } +} 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..6c8f3eed53ee5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupInformation.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.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..129651daafb9d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupPolicy.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The object representing the policy for taking backups on an account. + */ +@Fluent +public class BackupPolicy implements JsonSerializable { + /* + * Describes the mode of backups. + */ + private BackupPolicyType type = BackupPolicyType.fromString("BackupPolicy"); + + /* + * The object representing the state of the migration between the backup policies. + */ + private BackupPolicyMigrationState migrationState; + + /** + * Creates an instance of BackupPolicy class. + */ + public BackupPolicy() { + } + + /** + * Get the type property: Describes the mode of backups. + * + * @return the type value. + */ + public BackupPolicyType type() { + return this.type; + } + + /** + * 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeJsonField("migrationState", this.migrationState); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BackupPolicy from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BackupPolicy if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the BackupPolicy. + */ + public static BackupPolicy fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("type".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("Periodic".equals(discriminatorValue)) { + return PeriodicModeBackupPolicy.fromJson(readerToUse.reset()); + } else if ("Continuous".equals(discriminatorValue)) { + return ContinuousModeBackupPolicy.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static BackupPolicy fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BackupPolicy deserializedBackupPolicy = new BackupPolicy(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedBackupPolicy.type = BackupPolicyType.fromString(reader.getString()); + } else if ("migrationState".equals(fieldName)) { + deserializedBackupPolicy.migrationState = BackupPolicyMigrationState.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedBackupPolicy; + }); + } +} 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..91c21e243a763 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupPolicyMigrationState.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * The object representing the state of the migration between the backup policies. + */ +@Fluent +public final class BackupPolicyMigrationState implements JsonSerializable { + /* + * Describes the status of migration between backup policy types. + */ + private BackupPolicyMigrationStatus status; + + /* + * Describes the target backup policy type of the backup policy migration. + */ + private BackupPolicyType targetType; + + /* + * Time at which the backup policy migration started (ISO-8601 format). + */ + private OffsetDateTime startTime; + + /** + * Creates an instance of BackupPolicyMigrationState class. + */ + public BackupPolicyMigrationState() { + } + + /** + * 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeStringField("targetType", this.targetType == null ? null : this.targetType.toString()); + jsonWriter.writeStringField("startTime", + this.startTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.startTime)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BackupPolicyMigrationState from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BackupPolicyMigrationState if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the BackupPolicyMigrationState. + */ + public static BackupPolicyMigrationState fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BackupPolicyMigrationState deserializedBackupPolicyMigrationState = new BackupPolicyMigrationState(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("status".equals(fieldName)) { + deserializedBackupPolicyMigrationState.status + = BackupPolicyMigrationStatus.fromString(reader.getString()); + } else if ("targetType".equals(fieldName)) { + deserializedBackupPolicyMigrationState.targetType = BackupPolicyType.fromString(reader.getString()); + } else if ("startTime".equals(fieldName)) { + deserializedBackupPolicyMigrationState.startTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedBackupPolicyMigrationState; + }); + } +} 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..c1309fcefadbb --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupPolicyMigrationStatus.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.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Describes the status of migration between backup policy types. + */ +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 a new instance of BackupPolicyMigrationStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public BackupPolicyMigrationStatus() { + } + + /** + * Creates or finds a BackupPolicyMigrationStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding BackupPolicyMigrationStatus. + */ + public static BackupPolicyMigrationStatus fromString(String name) { + return fromString(name, BackupPolicyMigrationStatus.class); + } + + /** + * Gets known BackupPolicyMigrationStatus values. + * + * @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..c93b5745319fe --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupPolicyType.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.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Describes the mode of backups. + */ +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 a new instance of BackupPolicyType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public BackupPolicyType() { + } + + /** + * Creates or finds a BackupPolicyType from its string representation. + * + * @param name a name to look for. + * @return the corresponding BackupPolicyType. + */ + public static BackupPolicyType fromString(String name) { + return fromString(name, BackupPolicyType.class); + } + + /** + * Gets known BackupPolicyType values. + * + * @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/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..fec267c806930 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupStorageRedundancy.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.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Enum to indicate type of backup storage redundancy. + */ +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 a new instance of BackupStorageRedundancy value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public BackupStorageRedundancy() { + } + + /** + * Creates or finds a BackupStorageRedundancy from its string representation. + * + * @param name a name to look for. + * @return the corresponding BackupStorageRedundancy. + */ + public static BackupStorageRedundancy fromString(String name) { + return fromString(name, BackupStorageRedundancy.class); + } + + /** + * Gets known BackupStorageRedundancy values. + * + * @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..345c6a6c4e91c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Capability.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Cosmos DB capability object. + */ +@Fluent +public final class Capability implements JsonSerializable { + /* + * Name of the Cosmos DB capability. For example, "name": "EnableCassandra". Current values also include + * "EnableTable" and "EnableGremlin". + */ + private String name; + + /** + * Creates an instance of Capability class. + */ + public Capability() { + } + + /** + * 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Capability from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Capability if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the Capability. + */ + public static Capability fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Capability deserializedCapability = new Capability(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedCapability.name = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCapability; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Capacity.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Capacity.java new file mode 100644 index 0000000000000..4ab47fdffae32 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Capacity.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.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The object that represents all properties related to capacity enforcement on an account. + */ +@Fluent +public final class Capacity implements JsonSerializable { + /* + * The total throughput limit imposed on the account. A totalThroughputLimit of 2000 imposes a strict limit of max + * throughput that can be provisioned on that account to be 2000. A totalThroughputLimit of -1 indicates no limits + * on provisioning of throughput. + */ + private Integer totalThroughputLimit; + + /** + * Creates an instance of Capacity class. + */ + public Capacity() { + } + + /** + * Get the totalThroughputLimit property: The total throughput limit imposed on the account. A totalThroughputLimit + * of 2000 imposes a strict limit of max throughput that can be provisioned on that account to be 2000. A + * totalThroughputLimit of -1 indicates no limits on provisioning of throughput. + * + * @return the totalThroughputLimit value. + */ + public Integer totalThroughputLimit() { + return this.totalThroughputLimit; + } + + /** + * Set the totalThroughputLimit property: The total throughput limit imposed on the account. A totalThroughputLimit + * of 2000 imposes a strict limit of max throughput that can be provisioned on that account to be 2000. A + * totalThroughputLimit of -1 indicates no limits on provisioning of throughput. + * + * @param totalThroughputLimit the totalThroughputLimit value to set. + * @return the Capacity object itself. + */ + public Capacity withTotalThroughputLimit(Integer totalThroughputLimit) { + this.totalThroughputLimit = totalThroughputLimit; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("totalThroughputLimit", this.totalThroughputLimit); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Capacity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Capacity if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the Capacity. + */ + public static Capacity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Capacity deserializedCapacity = new Capacity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("totalThroughputLimit".equals(fieldName)) { + deserializedCapacity.totalThroughputLimit = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedCapacity; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraClusterPublicStatus.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraClusterPublicStatus.java new file mode 100644 index 0000000000000..e6c06256399e3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraClusterPublicStatus.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.resourcemanager.cosmos.generated.fluent.models.CassandraClusterPublicStatusInner; +import java.util.List; + +/** + * An immutable client-side representation of CassandraClusterPublicStatus. + */ +public interface CassandraClusterPublicStatus { + /** + * Gets the etag property: The eTag property. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the reaperStatus property: The reaperStatus property. + * + * @return the reaperStatus value. + */ + ManagedCassandraReaperStatus reaperStatus(); + + /** + * Gets the connectionErrors property: List relevant information about any connection errors to the Datacenters. + * + * @return the connectionErrors value. + */ + List connectionErrors(); + + /** + * Gets the errors property: List relevant information about any errors about cluster, data center and connection + * error. + * + * @return the errors value. + */ + List errors(); + + /** + * Gets the dataCenters property: List of the status of each datacenter in this cluster. + * + * @return the dataCenters value. + */ + List dataCenters(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.CassandraClusterPublicStatusInner object. + * + * @return the inner object. + */ + CassandraClusterPublicStatusInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraClusterPublicStatusDataCentersItem.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraClusterPublicStatusDataCentersItem.java new file mode 100644 index 0000000000000..55283c674ebb4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraClusterPublicStatusDataCentersItem.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The CassandraClusterPublicStatusDataCentersItem model. + */ +@Fluent +public final class CassandraClusterPublicStatusDataCentersItem + implements JsonSerializable { + /* + * The name of this Datacenter. + */ + private String name; + + /* + * A list of all seed nodes in the cluster, managed and unmanaged. + */ + private List seedNodes; + + /* + * The nodes property. + */ + private List nodes; + + /** + * Creates an instance of CassandraClusterPublicStatusDataCentersItem class. + */ + public CassandraClusterPublicStatusDataCentersItem() { + } + + /** + * Get the name property: The name of this Datacenter. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of this Datacenter. + * + * @param name the name value to set. + * @return the CassandraClusterPublicStatusDataCentersItem object itself. + */ + public CassandraClusterPublicStatusDataCentersItem withName(String name) { + this.name = name; + return this; + } + + /** + * Get the seedNodes property: A list of all seed nodes in the cluster, managed and unmanaged. + * + * @return the seedNodes value. + */ + public List seedNodes() { + return this.seedNodes; + } + + /** + * Set the seedNodes property: A list of all seed nodes in the cluster, managed and unmanaged. + * + * @param seedNodes the seedNodes value to set. + * @return the CassandraClusterPublicStatusDataCentersItem object itself. + */ + public CassandraClusterPublicStatusDataCentersItem withSeedNodes(List seedNodes) { + this.seedNodes = seedNodes; + return this; + } + + /** + * Get the nodes property: The nodes property. + * + * @return the nodes value. + */ + public List nodes() { + return this.nodes; + } + + /** + * Set the nodes property: The nodes property. + * + * @param nodes the nodes value to set. + * @return the CassandraClusterPublicStatusDataCentersItem object itself. + */ + public CassandraClusterPublicStatusDataCentersItem + 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeArrayField("seedNodes", this.seedNodes, (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("nodes", this.nodes, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CassandraClusterPublicStatusDataCentersItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CassandraClusterPublicStatusDataCentersItem if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CassandraClusterPublicStatusDataCentersItem. + */ + public static CassandraClusterPublicStatusDataCentersItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CassandraClusterPublicStatusDataCentersItem deserializedCassandraClusterPublicStatusDataCentersItem + = new CassandraClusterPublicStatusDataCentersItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedCassandraClusterPublicStatusDataCentersItem.name = reader.getString(); + } else if ("seedNodes".equals(fieldName)) { + List seedNodes = reader.readArray(reader1 -> reader1.getString()); + deserializedCassandraClusterPublicStatusDataCentersItem.seedNodes = seedNodes; + } else if ("nodes".equals(fieldName)) { + List nodes = reader + .readArray(reader1 -> CassandraClusterPublicStatusDataCentersItemNode.fromJson(reader1)); + deserializedCassandraClusterPublicStatusDataCentersItem.nodes = nodes; + } else { + reader.skipChildren(); + } + } + + return deserializedCassandraClusterPublicStatusDataCentersItem; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraClusterPublicStatusDataCentersItemNode.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraClusterPublicStatusDataCentersItemNode.java new file mode 100644 index 0000000000000..186dfaefc1a5f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraClusterPublicStatusDataCentersItemNode.java @@ -0,0 +1,564 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The CassandraClusterPublicStatusDataCentersItemNode model. + */ +@Fluent +public final class CassandraClusterPublicStatusDataCentersItemNode + implements JsonSerializable { + /* + * The node's IP address. + */ + private String address; + + /* + * The state of the node in Cassandra ring. + */ + private NodeState state; + + /* + * The status property. + */ + private String status; + + /* + * Cassandra service status on this node + */ + private String cassandraProcessStatus; + + /* + * 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 + * cells or tombstones) is counted. + */ + private String load; + + /* + * List of tokens this node covers. + */ + private List tokens; + + /* + * The size property. + */ + private Integer size; + + /* + * The network ID of the node. + */ + private String hostId; + + /* + * The rack this node is part of. + */ + private String rack; + + /* + * The timestamp when these statistics were captured. + */ + private String timestamp; + + /* + * The amount of disk used, in kB, of the directory /var/lib/cassandra. + */ + private Long diskUsedKB; + + /* + * The amount of disk free, in kB, of the directory /var/lib/cassandra. + */ + private Long diskFreeKB; + + /* + * Used memory (calculated as total - free - buffers - cache), in kB. + */ + private Long memoryUsedKB; + + /* + * Memory used by kernel buffers (Buffers in /proc/meminfo) and page cache and slabs (Cached and SReclaimable in + * /proc/meminfo), in kB. + */ + private Long memoryBuffersAndCachedKB; + + /* + * Unused memory (MemFree and SwapFree in /proc/meminfo), in kB. + */ + private Long memoryFreeKB; + + /* + * Total installed memory (MemTotal and SwapTotal in /proc/meminfo), in kB. + */ + private Long memoryTotalKB; + + /* + * A float representing the current system-wide CPU utilization as a percentage. + */ + private Double cpuUsage; + + /** + * Creates an instance of CassandraClusterPublicStatusDataCentersItemNode class. + */ + public CassandraClusterPublicStatusDataCentersItemNode() { + } + + /** + * Get the address property: The node's IP address. + * + * @return the address value. + */ + public String address() { + return this.address; + } + + /** + * Set the address property: The node's IP address. + * + * @param address the address value to set. + * @return the CassandraClusterPublicStatusDataCentersItemNode object itself. + */ + public CassandraClusterPublicStatusDataCentersItemNode withAddress(String address) { + this.address = address; + return this; + } + + /** + * Get the state property: The state of the node in Cassandra ring. + * + * @return the state value. + */ + public NodeState state() { + return this.state; + } + + /** + * Set the state property: The state of the node in Cassandra ring. + * + * @param state the state value to set. + * @return the CassandraClusterPublicStatusDataCentersItemNode object itself. + */ + public CassandraClusterPublicStatusDataCentersItemNode withState(NodeState state) { + this.state = state; + return this; + } + + /** + * Get the status property: The status property. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Set the status property: The status property. + * + * @param status the status value to set. + * @return the CassandraClusterPublicStatusDataCentersItemNode object itself. + */ + public CassandraClusterPublicStatusDataCentersItemNode withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the cassandraProcessStatus property: Cassandra service status on this node. + * + * @return the cassandraProcessStatus value. + */ + public String cassandraProcessStatus() { + return this.cassandraProcessStatus; + } + + /** + * Set the cassandraProcessStatus property: Cassandra service status on this node. + * + * @param cassandraProcessStatus the cassandraProcessStatus value to set. + * @return the CassandraClusterPublicStatusDataCentersItemNode object itself. + */ + public CassandraClusterPublicStatusDataCentersItemNode withCassandraProcessStatus(String cassandraProcessStatus) { + this.cassandraProcessStatus = cassandraProcessStatus; + 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 cells or tombstones) 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 cells or tombstones) is counted. + * + * @param load the load value to set. + * @return the CassandraClusterPublicStatusDataCentersItemNode object itself. + */ + public CassandraClusterPublicStatusDataCentersItemNode withLoad(String load) { + this.load = load; + return this; + } + + /** + * Get the tokens property: List of tokens this node covers. + * + * @return the tokens value. + */ + public List tokens() { + return this.tokens; + } + + /** + * Set the tokens property: List of tokens this node covers. + * + * @param tokens the tokens value to set. + * @return the CassandraClusterPublicStatusDataCentersItemNode object itself. + */ + public CassandraClusterPublicStatusDataCentersItemNode withTokens(List tokens) { + this.tokens = tokens; + return this; + } + + /** + * Get the size property: The size property. + * + * @return the size value. + */ + public Integer size() { + return this.size; + } + + /** + * Set the size property: The size property. + * + * @param size the size value to set. + * @return the CassandraClusterPublicStatusDataCentersItemNode object itself. + */ + public CassandraClusterPublicStatusDataCentersItemNode withSize(Integer size) { + this.size = size; + 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 CassandraClusterPublicStatusDataCentersItemNode object itself. + */ + public CassandraClusterPublicStatusDataCentersItemNode 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 CassandraClusterPublicStatusDataCentersItemNode object itself. + */ + public CassandraClusterPublicStatusDataCentersItemNode withRack(String rack) { + this.rack = rack; + return this; + } + + /** + * Get the timestamp property: The timestamp when these statistics were captured. + * + * @return the timestamp value. + */ + public String timestamp() { + return this.timestamp; + } + + /** + * Set the timestamp property: The timestamp when these statistics were captured. + * + * @param timestamp the timestamp value to set. + * @return the CassandraClusterPublicStatusDataCentersItemNode object itself. + */ + public CassandraClusterPublicStatusDataCentersItemNode withTimestamp(String timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Get the diskUsedKB property: The amount of disk used, in kB, of the directory /var/lib/cassandra. + * + * @return the diskUsedKB value. + */ + public Long diskUsedKB() { + return this.diskUsedKB; + } + + /** + * Set the diskUsedKB property: The amount of disk used, in kB, of the directory /var/lib/cassandra. + * + * @param diskUsedKB the diskUsedKB value to set. + * @return the CassandraClusterPublicStatusDataCentersItemNode object itself. + */ + public CassandraClusterPublicStatusDataCentersItemNode withDiskUsedKB(Long diskUsedKB) { + this.diskUsedKB = diskUsedKB; + return this; + } + + /** + * Get the diskFreeKB property: The amount of disk free, in kB, of the directory /var/lib/cassandra. + * + * @return the diskFreeKB value. + */ + public Long diskFreeKB() { + return this.diskFreeKB; + } + + /** + * Set the diskFreeKB property: The amount of disk free, in kB, of the directory /var/lib/cassandra. + * + * @param diskFreeKB the diskFreeKB value to set. + * @return the CassandraClusterPublicStatusDataCentersItemNode object itself. + */ + public CassandraClusterPublicStatusDataCentersItemNode withDiskFreeKB(Long diskFreeKB) { + this.diskFreeKB = diskFreeKB; + return this; + } + + /** + * Get the memoryUsedKB property: Used memory (calculated as total - free - buffers - cache), in kB. + * + * @return the memoryUsedKB value. + */ + public Long memoryUsedKB() { + return this.memoryUsedKB; + } + + /** + * Set the memoryUsedKB property: Used memory (calculated as total - free - buffers - cache), in kB. + * + * @param memoryUsedKB the memoryUsedKB value to set. + * @return the CassandraClusterPublicStatusDataCentersItemNode object itself. + */ + public CassandraClusterPublicStatusDataCentersItemNode withMemoryUsedKB(Long memoryUsedKB) { + this.memoryUsedKB = memoryUsedKB; + return this; + } + + /** + * Get the memoryBuffersAndCachedKB property: Memory used by kernel buffers (Buffers in /proc/meminfo) and page + * cache and slabs (Cached and SReclaimable in /proc/meminfo), in kB. + * + * @return the memoryBuffersAndCachedKB value. + */ + public Long memoryBuffersAndCachedKB() { + return this.memoryBuffersAndCachedKB; + } + + /** + * Set the memoryBuffersAndCachedKB property: Memory used by kernel buffers (Buffers in /proc/meminfo) and page + * cache and slabs (Cached and SReclaimable in /proc/meminfo), in kB. + * + * @param memoryBuffersAndCachedKB the memoryBuffersAndCachedKB value to set. + * @return the CassandraClusterPublicStatusDataCentersItemNode object itself. + */ + public CassandraClusterPublicStatusDataCentersItemNode withMemoryBuffersAndCachedKB(Long memoryBuffersAndCachedKB) { + this.memoryBuffersAndCachedKB = memoryBuffersAndCachedKB; + return this; + } + + /** + * Get the memoryFreeKB property: Unused memory (MemFree and SwapFree in /proc/meminfo), in kB. + * + * @return the memoryFreeKB value. + */ + public Long memoryFreeKB() { + return this.memoryFreeKB; + } + + /** + * Set the memoryFreeKB property: Unused memory (MemFree and SwapFree in /proc/meminfo), in kB. + * + * @param memoryFreeKB the memoryFreeKB value to set. + * @return the CassandraClusterPublicStatusDataCentersItemNode object itself. + */ + public CassandraClusterPublicStatusDataCentersItemNode withMemoryFreeKB(Long memoryFreeKB) { + this.memoryFreeKB = memoryFreeKB; + return this; + } + + /** + * Get the memoryTotalKB property: Total installed memory (MemTotal and SwapTotal in /proc/meminfo), in kB. + * + * @return the memoryTotalKB value. + */ + public Long memoryTotalKB() { + return this.memoryTotalKB; + } + + /** + * Set the memoryTotalKB property: Total installed memory (MemTotal and SwapTotal in /proc/meminfo), in kB. + * + * @param memoryTotalKB the memoryTotalKB value to set. + * @return the CassandraClusterPublicStatusDataCentersItemNode object itself. + */ + public CassandraClusterPublicStatusDataCentersItemNode withMemoryTotalKB(Long memoryTotalKB) { + this.memoryTotalKB = memoryTotalKB; + return this; + } + + /** + * Get the cpuUsage property: A float representing the current system-wide CPU utilization as a percentage. + * + * @return the cpuUsage value. + */ + public Double cpuUsage() { + return this.cpuUsage; + } + + /** + * Set the cpuUsage property: A float representing the current system-wide CPU utilization as a percentage. + * + * @param cpuUsage the cpuUsage value to set. + * @return the CassandraClusterPublicStatusDataCentersItemNode object itself. + */ + public CassandraClusterPublicStatusDataCentersItemNode withCpuUsage(Double cpuUsage) { + this.cpuUsage = cpuUsage; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("address", this.address); + jsonWriter.writeStringField("state", this.state == null ? null : this.state.toString()); + jsonWriter.writeStringField("status", this.status); + jsonWriter.writeStringField("cassandraProcessStatus", this.cassandraProcessStatus); + jsonWriter.writeStringField("load", this.load); + jsonWriter.writeArrayField("tokens", this.tokens, (writer, element) -> writer.writeString(element)); + jsonWriter.writeNumberField("size", this.size); + jsonWriter.writeStringField("hostID", this.hostId); + jsonWriter.writeStringField("rack", this.rack); + jsonWriter.writeStringField("timestamp", this.timestamp); + jsonWriter.writeNumberField("diskUsedKB", this.diskUsedKB); + jsonWriter.writeNumberField("diskFreeKB", this.diskFreeKB); + jsonWriter.writeNumberField("memoryUsedKB", this.memoryUsedKB); + jsonWriter.writeNumberField("memoryBuffersAndCachedKB", this.memoryBuffersAndCachedKB); + jsonWriter.writeNumberField("memoryFreeKB", this.memoryFreeKB); + jsonWriter.writeNumberField("memoryTotalKB", this.memoryTotalKB); + jsonWriter.writeNumberField("cpuUsage", this.cpuUsage); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CassandraClusterPublicStatusDataCentersItemNode from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CassandraClusterPublicStatusDataCentersItemNode if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CassandraClusterPublicStatusDataCentersItemNode. + */ + public static CassandraClusterPublicStatusDataCentersItemNode fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CassandraClusterPublicStatusDataCentersItemNode deserializedCassandraClusterPublicStatusDataCentersItemNode + = new CassandraClusterPublicStatusDataCentersItemNode(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("address".equals(fieldName)) { + deserializedCassandraClusterPublicStatusDataCentersItemNode.address = reader.getString(); + } else if ("state".equals(fieldName)) { + deserializedCassandraClusterPublicStatusDataCentersItemNode.state + = NodeState.fromString(reader.getString()); + } else if ("status".equals(fieldName)) { + deserializedCassandraClusterPublicStatusDataCentersItemNode.status = reader.getString(); + } else if ("cassandraProcessStatus".equals(fieldName)) { + deserializedCassandraClusterPublicStatusDataCentersItemNode.cassandraProcessStatus + = reader.getString(); + } else if ("load".equals(fieldName)) { + deserializedCassandraClusterPublicStatusDataCentersItemNode.load = reader.getString(); + } else if ("tokens".equals(fieldName)) { + List tokens = reader.readArray(reader1 -> reader1.getString()); + deserializedCassandraClusterPublicStatusDataCentersItemNode.tokens = tokens; + } else if ("size".equals(fieldName)) { + deserializedCassandraClusterPublicStatusDataCentersItemNode.size + = reader.getNullable(JsonReader::getInt); + } else if ("hostID".equals(fieldName)) { + deserializedCassandraClusterPublicStatusDataCentersItemNode.hostId = reader.getString(); + } else if ("rack".equals(fieldName)) { + deserializedCassandraClusterPublicStatusDataCentersItemNode.rack = reader.getString(); + } else if ("timestamp".equals(fieldName)) { + deserializedCassandraClusterPublicStatusDataCentersItemNode.timestamp = reader.getString(); + } else if ("diskUsedKB".equals(fieldName)) { + deserializedCassandraClusterPublicStatusDataCentersItemNode.diskUsedKB + = reader.getNullable(JsonReader::getLong); + } else if ("diskFreeKB".equals(fieldName)) { + deserializedCassandraClusterPublicStatusDataCentersItemNode.diskFreeKB + = reader.getNullable(JsonReader::getLong); + } else if ("memoryUsedKB".equals(fieldName)) { + deserializedCassandraClusterPublicStatusDataCentersItemNode.memoryUsedKB + = reader.getNullable(JsonReader::getLong); + } else if ("memoryBuffersAndCachedKB".equals(fieldName)) { + deserializedCassandraClusterPublicStatusDataCentersItemNode.memoryBuffersAndCachedKB + = reader.getNullable(JsonReader::getLong); + } else if ("memoryFreeKB".equals(fieldName)) { + deserializedCassandraClusterPublicStatusDataCentersItemNode.memoryFreeKB + = reader.getNullable(JsonReader::getLong); + } else if ("memoryTotalKB".equals(fieldName)) { + deserializedCassandraClusterPublicStatusDataCentersItemNode.memoryTotalKB + = reader.getNullable(JsonReader::getLong); + } else if ("cpuUsage".equals(fieldName)) { + deserializedCassandraClusterPublicStatusDataCentersItemNode.cpuUsage + = reader.getNullable(JsonReader::getDouble); + } else { + reader.skipChildren(); + } + } + + return deserializedCassandraClusterPublicStatusDataCentersItemNode; + }); + } +} 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..05fa10d7b569b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraClusters.java @@ -0,0 +1,266 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String clusterName, + 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); + + /** + * 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); + + /** + * Invoke a command like nodetool for cassandra maintenance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body Specification which command to run where. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of /command api. + */ + CommandOutput invokeCommand(String resourceGroupName, String clusterName, CommandPostBody body); + + /** + * Invoke a command like nodetool for cassandra maintenance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body Specification which command to run where. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of /command api. + */ + CommandOutput invokeCommand(String resourceGroupName, String clusterName, CommandPostBody body, Context context); + + /** + * Deallocate the Managed Cassandra Cluster and Associated Data Centers. Deallocation will deallocate the host + * virtual machine of this cluster, and reserved the data disk. This won't do anything on an already deallocated + * cluster. Use Start to restart the 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 deallocate(String resourceGroupName, String clusterName); + + /** + * Deallocate the Managed Cassandra Cluster and Associated Data Centers. Deallocation will deallocate the host + * virtual machine of this cluster, and reserved the data disk. This won't do anything on an already deallocated + * cluster. Use Start to restart the 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 deallocate(String resourceGroupName, String clusterName, Context context); + + /** + * Start the Managed Cassandra Cluster and Associated Data Centers. Start will start the host virtual machine of + * this cluster with reserved data disk. This won't do anything on an already running cluster. Use Deallocate to + * deallocate the 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 start(String resourceGroupName, String clusterName); + + /** + * Start the Managed Cassandra Cluster and Associated Data Centers. Start will start the host virtual machine of + * this cluster with reserved data disk. This won't do anything on an already running cluster. Use Deallocate to + * deallocate the 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 start(String resourceGroupName, String clusterName, Context context); + + /** + * Gets the CPU, memory, and disk usage statistics for each Cassandra node in a 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 CPU, memory, and disk usage statistics for each Cassandra node in a cluster along with + * {@link Response}. + */ + Response statusWithResponse(String resourceGroupName, String clusterName, + Context context); + + /** + * Gets the CPU, memory, and disk usage statistics for each Cassandra node in a 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 CPU, memory, and disk usage statistics for each Cassandra node in a cluster. + */ + CassandraClusterPublicStatus status(String resourceGroupName, String clusterName); + + /** + * 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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..ee9a38b209961 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraDataCenters.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.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 as paginated response with + * {@link PagedIterable}. + */ + 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 as paginated response with + * {@link PagedIterable}. + */ + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String clusterName, String dataCenterName, + 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); + + /** + * 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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/CassandraError.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraError.java new file mode 100644 index 0000000000000..7d02d28ec7058 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraError.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The CassandraError model. + */ +@Fluent +public final class CassandraError implements JsonSerializable { + /* + * The code of error that occurred. + */ + private String code; + + /* + * The message of the error. + */ + private String message; + + /* + * The target resource of the error. + */ + private String target; + + /* + * Additional information about the error. + */ + private String additionalErrorInfo; + + /** + * Creates an instance of CassandraError class. + */ + public CassandraError() { + } + + /** + * Get the code property: The code of error that occurred. + * + * @return the code value. + */ + public String code() { + return this.code; + } + + /** + * Set the code property: The code of error that occurred. + * + * @param code the code value to set. + * @return the CassandraError object itself. + */ + public CassandraError withCode(String code) { + this.code = code; + return this; + } + + /** + * Get the message property: The message of the error. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: The message of the error. + * + * @param message the message value to set. + * @return the CassandraError object itself. + */ + public CassandraError withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the target property: The target resource of the error. + * + * @return the target value. + */ + public String target() { + return this.target; + } + + /** + * Set the target property: The target resource of the error. + * + * @param target the target value to set. + * @return the CassandraError object itself. + */ + public CassandraError withTarget(String target) { + this.target = target; + return this; + } + + /** + * Get the additionalErrorInfo property: Additional information about the error. + * + * @return the additionalErrorInfo value. + */ + public String additionalErrorInfo() { + return this.additionalErrorInfo; + } + + /** + * Set the additionalErrorInfo property: Additional information about the error. + * + * @param additionalErrorInfo the additionalErrorInfo value to set. + * @return the CassandraError object itself. + */ + public CassandraError withAdditionalErrorInfo(String additionalErrorInfo) { + this.additionalErrorInfo = additionalErrorInfo; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("code", this.code); + jsonWriter.writeStringField("message", this.message); + jsonWriter.writeStringField("target", this.target); + jsonWriter.writeStringField("additionalErrorInfo", this.additionalErrorInfo); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CassandraError from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CassandraError if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the CassandraError. + */ + public static CassandraError fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CassandraError deserializedCassandraError = new CassandraError(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("code".equals(fieldName)) { + deserializedCassandraError.code = reader.getString(); + } else if ("message".equals(fieldName)) { + deserializedCassandraError.message = reader.getString(); + } else if ("target".equals(fieldName)) { + deserializedCassandraError.target = reader.getString(); + } else if ("additionalErrorInfo".equals(fieldName)) { + deserializedCassandraError.additionalErrorInfo = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCassandraError; + }); + } +} 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..2dc826d79ae92 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceCreateUpdateParameters.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.CassandraKeyspaceCreateUpdateProperties; +import java.io.IOException; +import java.util.Map; + +/** + * Parameters to create and update Cosmos DB Cassandra keyspace. + */ +@Fluent +public final class CassandraKeyspaceCreateUpdateParameters extends ArmResourceProperties { + /* + * Properties to create and update Azure Cosmos DB Cassandra keyspace. + */ + private CassandraKeyspaceCreateUpdateProperties innerProperties = new CassandraKeyspaceCreateUpdateProperties(); + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of CassandraKeyspaceCreateUpdateParameters class. + */ + public CassandraKeyspaceCreateUpdateParameters() { + } + + /** + * Get the innerProperties property: Properties to create and update Azure Cosmos DB Cassandra keyspace. + * + * @return the innerProperties value. + */ + private CassandraKeyspaceCreateUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@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() { + if (innerProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property innerProperties in model CassandraKeyspaceCreateUpdateParameters")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CassandraKeyspaceCreateUpdateParameters.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CassandraKeyspaceCreateUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CassandraKeyspaceCreateUpdateParameters if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CassandraKeyspaceCreateUpdateParameters. + */ + public static CassandraKeyspaceCreateUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CassandraKeyspaceCreateUpdateParameters deserializedCassandraKeyspaceCreateUpdateParameters + = new CassandraKeyspaceCreateUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedCassandraKeyspaceCreateUpdateParameters.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedCassandraKeyspaceCreateUpdateParameters.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedCassandraKeyspaceCreateUpdateParameters.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedCassandraKeyspaceCreateUpdateParameters.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedCassandraKeyspaceCreateUpdateParameters.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedCassandraKeyspaceCreateUpdateParameters.innerProperties + = CassandraKeyspaceCreateUpdateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCassandraKeyspaceCreateUpdateParameters; + }); + } +} 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..ea9af7e05392b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceGetPropertiesOptions.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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The CassandraKeyspaceGetPropertiesOptions model. + */ +@Fluent +public final class CassandraKeyspaceGetPropertiesOptions extends OptionsResource { + /** + * Creates an instance of CassandraKeyspaceGetPropertiesOptions class. + */ + public CassandraKeyspaceGetPropertiesOptions() { + } + + /** + * {@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() { + if (autoscaleSettings() != null) { + autoscaleSettings().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("throughput", throughput()); + jsonWriter.writeJsonField("autoscaleSettings", autoscaleSettings()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CassandraKeyspaceGetPropertiesOptions from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CassandraKeyspaceGetPropertiesOptions if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CassandraKeyspaceGetPropertiesOptions. + */ + public static CassandraKeyspaceGetPropertiesOptions fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CassandraKeyspaceGetPropertiesOptions deserializedCassandraKeyspaceGetPropertiesOptions + = new CassandraKeyspaceGetPropertiesOptions(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("throughput".equals(fieldName)) { + deserializedCassandraKeyspaceGetPropertiesOptions + .withThroughput(reader.getNullable(JsonReader::getInt)); + } else if ("autoscaleSettings".equals(fieldName)) { + deserializedCassandraKeyspaceGetPropertiesOptions + .withAutoscaleSettings(AutoscaleSettings.fromJson(reader)); + } else { + reader.skipChildren(); + } + } + + return deserializedCassandraKeyspaceGetPropertiesOptions; + }); + } +} 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..e3f356bc0c89a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceGetPropertiesResource.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.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The CassandraKeyspaceGetPropertiesResource model. + */ +@Fluent +public final class CassandraKeyspaceGetPropertiesResource extends CassandraKeyspaceResource { + /* + * A system generated property. A unique identifier. + */ + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of the resource. + */ + private Float ts; + + /* + * A system generated property representing the resource etag required for optimistic concurrency control. + */ + private String etag; + + /** + * Creates an instance of CassandraKeyspaceGetPropertiesResource class. + */ + public CassandraKeyspaceGetPropertiesResource() { + } + + /** + * 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() { + if (id() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property id in model CassandraKeyspaceGetPropertiesResource")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CassandraKeyspaceGetPropertiesResource.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", id()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CassandraKeyspaceGetPropertiesResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CassandraKeyspaceGetPropertiesResource if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CassandraKeyspaceGetPropertiesResource. + */ + public static CassandraKeyspaceGetPropertiesResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CassandraKeyspaceGetPropertiesResource deserializedCassandraKeyspaceGetPropertiesResource + = new CassandraKeyspaceGetPropertiesResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedCassandraKeyspaceGetPropertiesResource.withId(reader.getString()); + } else if ("_rid".equals(fieldName)) { + deserializedCassandraKeyspaceGetPropertiesResource.rid = reader.getString(); + } else if ("_ts".equals(fieldName)) { + deserializedCassandraKeyspaceGetPropertiesResource.ts = reader.getNullable(JsonReader::getFloat); + } else if ("_etag".equals(fieldName)) { + deserializedCassandraKeyspaceGetPropertiesResource.etag = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCassandraKeyspaceGetPropertiesResource; + }); + } +} 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..13a6913d04fc1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceGetResults.java @@ -0,0 +1,295 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 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 name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * 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.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 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.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 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..03194b60a7798 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceListResult.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.CassandraKeyspaceGetResultsInner; +import java.io.IOException; +import java.util.List; + +/** + * The List operation response, that contains the Cassandra keyspaces and their properties. + */ +@Immutable +public final class CassandraKeyspaceListResult implements JsonSerializable { + /* + * List of Cassandra keyspaces and their properties. + */ + private List value; + + /** + * Creates an instance of CassandraKeyspaceListResult class. + */ + public CassandraKeyspaceListResult() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CassandraKeyspaceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CassandraKeyspaceListResult if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CassandraKeyspaceListResult. + */ + public static CassandraKeyspaceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CassandraKeyspaceListResult deserializedCassandraKeyspaceListResult = new CassandraKeyspaceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> CassandraKeyspaceGetResultsInner.fromJson(reader1)); + deserializedCassandraKeyspaceListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedCassandraKeyspaceListResult; + }); + } +} 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..e6addc11785cc --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceResource.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Cosmos DB Cassandra keyspace resource object. + */ +@Fluent +public class CassandraKeyspaceResource implements JsonSerializable { + /* + * Name of the Cosmos DB Cassandra keyspace + */ + private String id; + + /** + * Creates an instance of CassandraKeyspaceResource class. + */ + public CassandraKeyspaceResource() { + } + + /** + * 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.atError() + .log(new IllegalArgumentException("Missing required property id in model CassandraKeyspaceResource")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CassandraKeyspaceResource.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CassandraKeyspaceResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CassandraKeyspaceResource if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CassandraKeyspaceResource. + */ + public static CassandraKeyspaceResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CassandraKeyspaceResource deserializedCassandraKeyspaceResource = new CassandraKeyspaceResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedCassandraKeyspaceResource.id = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCassandraKeyspaceResource; + }); + } +} 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..21745d1c4ce20 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraPartitionKey.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Cosmos DB Cassandra table partition key. + */ +@Fluent +public final class CassandraPartitionKey implements JsonSerializable { + /* + * Name of the Cosmos DB Cassandra table partition key + */ + private String name; + + /** + * Creates an instance of CassandraPartitionKey class. + */ + public CassandraPartitionKey() { + } + + /** + * 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CassandraPartitionKey from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CassandraPartitionKey if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the CassandraPartitionKey. + */ + public static CassandraPartitionKey fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CassandraPartitionKey deserializedCassandraPartitionKey = new CassandraPartitionKey(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedCassandraPartitionKey.name = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCassandraPartitionKey; + }); + } +} 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..201cc547b5834 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraResources.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 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 as paginated + * response with {@link PagedIterable}. + */ + 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 as paginated + * response with {@link PagedIterable}. + */ + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along + * with {@link Response}. + */ + Response getCassandraKeyspaceWithResponse(String resourceGroupName, String accountName, + String keyspaceName, 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); + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + Response getCassandraKeyspaceThroughputWithResponse(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); + + /** + * 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 as paginated + * response with {@link PagedIterable}. + */ + 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 as paginated + * response with {@link PagedIterable}. + */ + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + Response getCassandraTableWithResponse(String resourceGroupName, String accountName, + String keyspaceName, String tableName, 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); + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + Response getCassandraTableThroughputWithResponse(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); + + /** + * 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); + + /** + * 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 along + * with {@link Response}. + */ + 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 along + * with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + Response getCassandraTableByIdWithResponse(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); + + /** + * 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); +} 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..3f9e5d09d0c1a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraSchema.java @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Cosmos DB Cassandra table schema. + */ +@Fluent +public final class CassandraSchema implements JsonSerializable { + /* + * List of Cassandra table columns. + */ + private List columns; + + /* + * List of partition key. + */ + private List partitionKeys; + + /* + * List of cluster key. + */ + private List clusterKeys; + + /** + * Creates an instance of CassandraSchema class. + */ + public CassandraSchema() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("columns", this.columns, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("partitionKeys", this.partitionKeys, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("clusterKeys", this.clusterKeys, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CassandraSchema from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CassandraSchema if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the CassandraSchema. + */ + public static CassandraSchema fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CassandraSchema deserializedCassandraSchema = new CassandraSchema(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("columns".equals(fieldName)) { + List columns = reader.readArray(reader1 -> Column.fromJson(reader1)); + deserializedCassandraSchema.columns = columns; + } else if ("partitionKeys".equals(fieldName)) { + List partitionKeys + = reader.readArray(reader1 -> CassandraPartitionKey.fromJson(reader1)); + deserializedCassandraSchema.partitionKeys = partitionKeys; + } else if ("clusterKeys".equals(fieldName)) { + List clusterKeys = reader.readArray(reader1 -> ClusterKey.fromJson(reader1)); + deserializedCassandraSchema.clusterKeys = clusterKeys; + } else { + reader.skipChildren(); + } + } + + return deserializedCassandraSchema; + }); + } +} 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..ed01c6f648bbc --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableCreateUpdateParameters.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.CassandraTableCreateUpdateProperties; +import java.io.IOException; +import java.util.Map; + +/** + * Parameters to create and update Cosmos DB Cassandra table. + */ +@Fluent +public final class CassandraTableCreateUpdateParameters extends ArmResourceProperties { + /* + * Properties to create and update Azure Cosmos DB Cassandra table. + */ + private CassandraTableCreateUpdateProperties innerProperties = new CassandraTableCreateUpdateProperties(); + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of CassandraTableCreateUpdateParameters class. + */ + public CassandraTableCreateUpdateParameters() { + } + + /** + * Get the innerProperties property: Properties to create and update Azure Cosmos DB Cassandra table. + * + * @return the innerProperties value. + */ + private CassandraTableCreateUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@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() { + if (innerProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property innerProperties in model CassandraTableCreateUpdateParameters")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CassandraTableCreateUpdateParameters.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CassandraTableCreateUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CassandraTableCreateUpdateParameters if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CassandraTableCreateUpdateParameters. + */ + public static CassandraTableCreateUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CassandraTableCreateUpdateParameters deserializedCassandraTableCreateUpdateParameters + = new CassandraTableCreateUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedCassandraTableCreateUpdateParameters.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedCassandraTableCreateUpdateParameters.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedCassandraTableCreateUpdateParameters.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedCassandraTableCreateUpdateParameters.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedCassandraTableCreateUpdateParameters.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedCassandraTableCreateUpdateParameters.innerProperties + = CassandraTableCreateUpdateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCassandraTableCreateUpdateParameters; + }); + } +} 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..dde0931da76f8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableGetPropertiesOptions.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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The CassandraTableGetPropertiesOptions model. + */ +@Fluent +public final class CassandraTableGetPropertiesOptions extends OptionsResource { + /** + * Creates an instance of CassandraTableGetPropertiesOptions class. + */ + public CassandraTableGetPropertiesOptions() { + } + + /** + * {@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() { + if (autoscaleSettings() != null) { + autoscaleSettings().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("throughput", throughput()); + jsonWriter.writeJsonField("autoscaleSettings", autoscaleSettings()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CassandraTableGetPropertiesOptions from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CassandraTableGetPropertiesOptions if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CassandraTableGetPropertiesOptions. + */ + public static CassandraTableGetPropertiesOptions fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CassandraTableGetPropertiesOptions deserializedCassandraTableGetPropertiesOptions + = new CassandraTableGetPropertiesOptions(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("throughput".equals(fieldName)) { + deserializedCassandraTableGetPropertiesOptions + .withThroughput(reader.getNullable(JsonReader::getInt)); + } else if ("autoscaleSettings".equals(fieldName)) { + deserializedCassandraTableGetPropertiesOptions + .withAutoscaleSettings(AutoscaleSettings.fromJson(reader)); + } else { + reader.skipChildren(); + } + } + + return deserializedCassandraTableGetPropertiesOptions; + }); + } +} 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..ffc05227cc414 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableGetPropertiesResource.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The CassandraTableGetPropertiesResource model. + */ +@Fluent +public final class CassandraTableGetPropertiesResource extends CassandraTableResource { + /* + * A system generated property. A unique identifier. + */ + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of the resource. + */ + private Float ts; + + /* + * A system generated property representing the resource etag required for optimistic concurrency control. + */ + private String etag; + + /** + * Creates an instance of CassandraTableGetPropertiesResource class. + */ + public CassandraTableGetPropertiesResource() { + } + + /** + * 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() { + if (id() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property id in model CassandraTableGetPropertiesResource")); + } + if (schema() != null) { + schema().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CassandraTableGetPropertiesResource.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", id()); + jsonWriter.writeNumberField("defaultTtl", defaultTtl()); + jsonWriter.writeJsonField("schema", schema()); + jsonWriter.writeNumberField("analyticalStorageTtl", analyticalStorageTtl()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CassandraTableGetPropertiesResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CassandraTableGetPropertiesResource if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CassandraTableGetPropertiesResource. + */ + public static CassandraTableGetPropertiesResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CassandraTableGetPropertiesResource deserializedCassandraTableGetPropertiesResource + = new CassandraTableGetPropertiesResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedCassandraTableGetPropertiesResource.withId(reader.getString()); + } else if ("defaultTtl".equals(fieldName)) { + deserializedCassandraTableGetPropertiesResource + .withDefaultTtl(reader.getNullable(JsonReader::getInt)); + } else if ("schema".equals(fieldName)) { + deserializedCassandraTableGetPropertiesResource.withSchema(CassandraSchema.fromJson(reader)); + } else if ("analyticalStorageTtl".equals(fieldName)) { + deserializedCassandraTableGetPropertiesResource + .withAnalyticalStorageTtl(reader.getNullable(JsonReader::getInt)); + } else if ("_rid".equals(fieldName)) { + deserializedCassandraTableGetPropertiesResource.rid = reader.getString(); + } else if ("_ts".equals(fieldName)) { + deserializedCassandraTableGetPropertiesResource.ts = reader.getNullable(JsonReader::getFloat); + } else if ("_etag".equals(fieldName)) { + deserializedCassandraTableGetPropertiesResource.etag = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCassandraTableGetPropertiesResource; + }); + } +} 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..87f6f4db9dec0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableGetResults.java @@ -0,0 +1,297 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 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 name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * 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.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 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.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 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..2e16caf1ae526 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableListResult.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.CassandraTableGetResultsInner; +import java.io.IOException; +import java.util.List; + +/** + * The List operation response, that contains the Cassandra tables and their properties. + */ +@Immutable +public final class CassandraTableListResult implements JsonSerializable { + /* + * List of Cassandra tables and their properties. + */ + private List value; + + /** + * Creates an instance of CassandraTableListResult class. + */ + public CassandraTableListResult() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CassandraTableListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CassandraTableListResult if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CassandraTableListResult. + */ + public static CassandraTableListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CassandraTableListResult deserializedCassandraTableListResult = new CassandraTableListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> CassandraTableGetResultsInner.fromJson(reader1)); + deserializedCassandraTableListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedCassandraTableListResult; + }); + } +} 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..85b452cfc4a1d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableResource.java @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Cosmos DB Cassandra table resource object. + */ +@Fluent +public class CassandraTableResource implements JsonSerializable { + /* + * Name of the Cosmos DB Cassandra table + */ + private String id; + + /* + * Time to live of the Cosmos DB Cassandra table + */ + private Integer defaultTtl; + + /* + * Schema of the Cosmos DB Cassandra table + */ + private CassandraSchema schema; + + /* + * Analytical TTL. + */ + private Integer analyticalStorageTtl; + + /** + * Creates an instance of CassandraTableResource class. + */ + public CassandraTableResource() { + } + + /** + * 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.atError() + .log(new IllegalArgumentException("Missing required property id in model CassandraTableResource")); + } + if (schema() != null) { + schema().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CassandraTableResource.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeNumberField("defaultTtl", this.defaultTtl); + jsonWriter.writeJsonField("schema", this.schema); + jsonWriter.writeNumberField("analyticalStorageTtl", this.analyticalStorageTtl); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CassandraTableResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CassandraTableResource if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CassandraTableResource. + */ + public static CassandraTableResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CassandraTableResource deserializedCassandraTableResource = new CassandraTableResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedCassandraTableResource.id = reader.getString(); + } else if ("defaultTtl".equals(fieldName)) { + deserializedCassandraTableResource.defaultTtl = reader.getNullable(JsonReader::getInt); + } else if ("schema".equals(fieldName)) { + deserializedCassandraTableResource.schema = CassandraSchema.fromJson(reader); + } else if ("analyticalStorageTtl".equals(fieldName)) { + deserializedCassandraTableResource.analyticalStorageTtl = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedCassandraTableResource; + }); + } +} 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..8ddc22bc615b7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Certificate.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Certificate model. + */ +@Fluent +public final class Certificate implements JsonSerializable { + /* + * PEM formatted public key. + */ + private String pem; + + /** + * Creates an instance of Certificate class. + */ + public Certificate() { + } + + /** + * 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("pem", this.pem); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Certificate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Certificate if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the Certificate. + */ + public static Certificate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Certificate deserializedCertificate = new Certificate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("pem".equals(fieldName)) { + deserializedCertificate.pem = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCertificate; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClientEncryptionIncludedPath.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClientEncryptionIncludedPath.java new file mode 100644 index 0000000000000..d9c896d5e4289 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClientEncryptionIncludedPath.java @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * . + */ +@Fluent +public final class ClientEncryptionIncludedPath implements JsonSerializable { + /* + * Path that needs to be encrypted. + */ + private String path; + + /* + * The identifier of the Client Encryption Key to be used to encrypt the path. + */ + private String clientEncryptionKeyId; + + /* + * The type of encryption to be performed. Eg - Deterministic, Randomized. + */ + private String encryptionType; + + /* + * The encryption algorithm which will be used. Eg - AEAD_AES_256_CBC_HMAC_SHA256. + */ + private String encryptionAlgorithm; + + /** + * Creates an instance of ClientEncryptionIncludedPath class. + */ + public ClientEncryptionIncludedPath() { + } + + /** + * Get the path property: Path that needs to be encrypted. + * + * @return the path value. + */ + public String path() { + return this.path; + } + + /** + * Set the path property: Path that needs to be encrypted. + * + * @param path the path value to set. + * @return the ClientEncryptionIncludedPath object itself. + */ + public ClientEncryptionIncludedPath withPath(String path) { + this.path = path; + return this; + } + + /** + * Get the clientEncryptionKeyId property: The identifier of the Client Encryption Key to be used to encrypt the + * path. + * + * @return the clientEncryptionKeyId value. + */ + public String clientEncryptionKeyId() { + return this.clientEncryptionKeyId; + } + + /** + * Set the clientEncryptionKeyId property: The identifier of the Client Encryption Key to be used to encrypt the + * path. + * + * @param clientEncryptionKeyId the clientEncryptionKeyId value to set. + * @return the ClientEncryptionIncludedPath object itself. + */ + public ClientEncryptionIncludedPath withClientEncryptionKeyId(String clientEncryptionKeyId) { + this.clientEncryptionKeyId = clientEncryptionKeyId; + return this; + } + + /** + * Get the encryptionType property: The type of encryption to be performed. Eg - Deterministic, Randomized. + * + * @return the encryptionType value. + */ + public String encryptionType() { + return this.encryptionType; + } + + /** + * Set the encryptionType property: The type of encryption to be performed. Eg - Deterministic, Randomized. + * + * @param encryptionType the encryptionType value to set. + * @return the ClientEncryptionIncludedPath object itself. + */ + public ClientEncryptionIncludedPath withEncryptionType(String encryptionType) { + this.encryptionType = encryptionType; + return this; + } + + /** + * Get the encryptionAlgorithm property: The encryption algorithm which will be used. Eg - + * AEAD_AES_256_CBC_HMAC_SHA256. + * + * @return the encryptionAlgorithm value. + */ + public String encryptionAlgorithm() { + return this.encryptionAlgorithm; + } + + /** + * Set the encryptionAlgorithm property: The encryption algorithm which will be used. Eg - + * AEAD_AES_256_CBC_HMAC_SHA256. + * + * @param encryptionAlgorithm the encryptionAlgorithm value to set. + * @return the ClientEncryptionIncludedPath object itself. + */ + public ClientEncryptionIncludedPath withEncryptionAlgorithm(String encryptionAlgorithm) { + this.encryptionAlgorithm = encryptionAlgorithm; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (path() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property path in model ClientEncryptionIncludedPath")); + } + if (clientEncryptionKeyId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property clientEncryptionKeyId in model ClientEncryptionIncludedPath")); + } + if (encryptionType() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property encryptionType in model ClientEncryptionIncludedPath")); + } + if (encryptionAlgorithm() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property encryptionAlgorithm in model ClientEncryptionIncludedPath")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ClientEncryptionIncludedPath.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("path", this.path); + jsonWriter.writeStringField("clientEncryptionKeyId", this.clientEncryptionKeyId); + jsonWriter.writeStringField("encryptionType", this.encryptionType); + jsonWriter.writeStringField("encryptionAlgorithm", this.encryptionAlgorithm); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ClientEncryptionIncludedPath from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ClientEncryptionIncludedPath if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ClientEncryptionIncludedPath. + */ + public static ClientEncryptionIncludedPath fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ClientEncryptionIncludedPath deserializedClientEncryptionIncludedPath = new ClientEncryptionIncludedPath(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("path".equals(fieldName)) { + deserializedClientEncryptionIncludedPath.path = reader.getString(); + } else if ("clientEncryptionKeyId".equals(fieldName)) { + deserializedClientEncryptionIncludedPath.clientEncryptionKeyId = reader.getString(); + } else if ("encryptionType".equals(fieldName)) { + deserializedClientEncryptionIncludedPath.encryptionType = reader.getString(); + } else if ("encryptionAlgorithm".equals(fieldName)) { + deserializedClientEncryptionIncludedPath.encryptionAlgorithm = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedClientEncryptionIncludedPath; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClientEncryptionKeyCreateUpdateParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClientEncryptionKeyCreateUpdateParameters.java new file mode 100644 index 0000000000000..5ec8b5cc4da8a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClientEncryptionKeyCreateUpdateParameters.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ClientEncryptionKeyCreateUpdateProperties; +import java.io.IOException; + +/** + * Parameters to create and update ClientEncryptionKey. + */ +@Fluent +public final class ClientEncryptionKeyCreateUpdateParameters + implements JsonSerializable { + /* + * Properties to create and update ClientEncryptionKey. + */ + private ClientEncryptionKeyCreateUpdateProperties innerProperties = new ClientEncryptionKeyCreateUpdateProperties(); + + /** + * Creates an instance of ClientEncryptionKeyCreateUpdateParameters class. + */ + public ClientEncryptionKeyCreateUpdateParameters() { + } + + /** + * Get the innerProperties property: Properties to create and update ClientEncryptionKey. + * + * @return the innerProperties value. + */ + private ClientEncryptionKeyCreateUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the resource property: The standard JSON format of a ClientEncryptionKey. + * + * @return the resource value. + */ + public ClientEncryptionKeyResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The standard JSON format of a ClientEncryptionKey. + * + * @param resource the resource value to set. + * @return the ClientEncryptionKeyCreateUpdateParameters object itself. + */ + public ClientEncryptionKeyCreateUpdateParameters withResource(ClientEncryptionKeyResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new ClientEncryptionKeyCreateUpdateProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property innerProperties in model ClientEncryptionKeyCreateUpdateParameters")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ClientEncryptionKeyCreateUpdateParameters.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ClientEncryptionKeyCreateUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ClientEncryptionKeyCreateUpdateParameters if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ClientEncryptionKeyCreateUpdateParameters. + */ + public static ClientEncryptionKeyCreateUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ClientEncryptionKeyCreateUpdateParameters deserializedClientEncryptionKeyCreateUpdateParameters + = new ClientEncryptionKeyCreateUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedClientEncryptionKeyCreateUpdateParameters.innerProperties + = ClientEncryptionKeyCreateUpdateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedClientEncryptionKeyCreateUpdateParameters; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClientEncryptionKeyGetPropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClientEncryptionKeyGetPropertiesResource.java new file mode 100644 index 0000000000000..b745dd509143d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClientEncryptionKeyGetPropertiesResource.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ClientEncryptionKeyGetPropertiesResource model. + */ +@Fluent +public final class ClientEncryptionKeyGetPropertiesResource extends ClientEncryptionKeyResource { + /* + * A system generated property. A unique identifier. + */ + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of the resource. + */ + private Float ts; + + /* + * A system generated property representing the resource etag required for optimistic concurrency control. + */ + private String etag; + + /** + * Creates an instance of ClientEncryptionKeyGetPropertiesResource class. + */ + public ClientEncryptionKeyGetPropertiesResource() { + } + + /** + * 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 ClientEncryptionKeyGetPropertiesResource withId(String id) { + super.withId(id); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ClientEncryptionKeyGetPropertiesResource withEncryptionAlgorithm(String encryptionAlgorithm) { + super.withEncryptionAlgorithm(encryptionAlgorithm); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ClientEncryptionKeyGetPropertiesResource withWrappedDataEncryptionKey(byte[] wrappedDataEncryptionKey) { + super.withWrappedDataEncryptionKey(wrappedDataEncryptionKey); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ClientEncryptionKeyGetPropertiesResource withKeyWrapMetadata(KeyWrapMetadata keyWrapMetadata) { + super.withKeyWrapMetadata(keyWrapMetadata); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (keyWrapMetadata() != null) { + keyWrapMetadata().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", id()); + jsonWriter.writeStringField("encryptionAlgorithm", encryptionAlgorithm()); + jsonWriter.writeBinaryField("wrappedDataEncryptionKey", wrappedDataEncryptionKey()); + jsonWriter.writeJsonField("keyWrapMetadata", keyWrapMetadata()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ClientEncryptionKeyGetPropertiesResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ClientEncryptionKeyGetPropertiesResource if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ClientEncryptionKeyGetPropertiesResource. + */ + public static ClientEncryptionKeyGetPropertiesResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ClientEncryptionKeyGetPropertiesResource deserializedClientEncryptionKeyGetPropertiesResource + = new ClientEncryptionKeyGetPropertiesResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedClientEncryptionKeyGetPropertiesResource.withId(reader.getString()); + } else if ("encryptionAlgorithm".equals(fieldName)) { + deserializedClientEncryptionKeyGetPropertiesResource.withEncryptionAlgorithm(reader.getString()); + } else if ("wrappedDataEncryptionKey".equals(fieldName)) { + deserializedClientEncryptionKeyGetPropertiesResource + .withWrappedDataEncryptionKey(reader.getBinary()); + } else if ("keyWrapMetadata".equals(fieldName)) { + deserializedClientEncryptionKeyGetPropertiesResource + .withKeyWrapMetadata(KeyWrapMetadata.fromJson(reader)); + } else if ("_rid".equals(fieldName)) { + deserializedClientEncryptionKeyGetPropertiesResource.rid = reader.getString(); + } else if ("_ts".equals(fieldName)) { + deserializedClientEncryptionKeyGetPropertiesResource.ts = reader.getNullable(JsonReader::getFloat); + } else if ("_etag".equals(fieldName)) { + deserializedClientEncryptionKeyGetPropertiesResource.etag = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedClientEncryptionKeyGetPropertiesResource; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClientEncryptionKeyGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClientEncryptionKeyGetResults.java new file mode 100644 index 0000000000000..67227b8f8457f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClientEncryptionKeyGetResults.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.ClientEncryptionKeyGetResultsInner; + +/** + * An immutable client-side representation of ClientEncryptionKeyGetResults. + */ +public interface ClientEncryptionKeyGetResults { + /** + * 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 resource property: The resource property. + * + * @return the resource value. + */ + ClientEncryptionKeyGetPropertiesResource resource(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.ClientEncryptionKeyGetResultsInner + * object. + * + * @return the inner object. + */ + ClientEncryptionKeyGetResultsInner innerModel(); + + /** + * The entirety of the ClientEncryptionKeyGetResults definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithParentResource, + DefinitionStages.WithResource, DefinitionStages.WithCreate { + } + + /** + * The ClientEncryptionKeyGetResults definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the ClientEncryptionKeyGetResults definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the ClientEncryptionKeyGetResults 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 ClientEncryptionKeyGetResults definition allowing to specify resource. + */ + interface WithResource { + /** + * Specifies the resource property: The standard JSON format of a ClientEncryptionKey. + * + * @param resource The standard JSON format of a ClientEncryptionKey. + * @return the next definition stage. + */ + WithCreate withResource(ClientEncryptionKeyResource resource); + } + + /** + * The stage of the ClientEncryptionKeyGetResults 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. + */ + ClientEncryptionKeyGetResults create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ClientEncryptionKeyGetResults create(Context context); + } + } + + /** + * Begins update for the ClientEncryptionKeyGetResults resource. + * + * @return the stage of resource update. + */ + ClientEncryptionKeyGetResults.Update update(); + + /** + * The template for ClientEncryptionKeyGetResults update. + */ + interface Update extends UpdateStages.WithResource { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ClientEncryptionKeyGetResults apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ClientEncryptionKeyGetResults apply(Context context); + } + + /** + * The ClientEncryptionKeyGetResults update stages. + */ + interface UpdateStages { + /** + * The stage of the ClientEncryptionKeyGetResults update allowing to specify resource. + */ + interface WithResource { + /** + * Specifies the resource property: The standard JSON format of a ClientEncryptionKey. + * + * @param resource The standard JSON format of a ClientEncryptionKey. + * @return the next definition stage. + */ + Update withResource(ClientEncryptionKeyResource resource); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ClientEncryptionKeyGetResults refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ClientEncryptionKeyGetResults refresh(Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClientEncryptionKeyResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClientEncryptionKeyResource.java new file mode 100644 index 0000000000000..0b8cb0ec9e194 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClientEncryptionKeyResource.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Cosmos DB client encryption key resource object. + */ +@Fluent +public class ClientEncryptionKeyResource implements JsonSerializable { + /* + * Name of the ClientEncryptionKey + */ + private String id; + + /* + * Encryption algorithm that will be used along with this client encryption key to encrypt/decrypt data. + */ + private String encryptionAlgorithm; + + /* + * Wrapped (encrypted) form of the key represented as a byte array. + */ + private byte[] wrappedDataEncryptionKey; + + /* + * Metadata for the wrapping provider that can be used to unwrap the wrapped client encryption key. + */ + private KeyWrapMetadata keyWrapMetadata; + + /** + * Creates an instance of ClientEncryptionKeyResource class. + */ + public ClientEncryptionKeyResource() { + } + + /** + * Get the id property: Name of the ClientEncryptionKey. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Name of the ClientEncryptionKey. + * + * @param id the id value to set. + * @return the ClientEncryptionKeyResource object itself. + */ + public ClientEncryptionKeyResource withId(String id) { + this.id = id; + return this; + } + + /** + * Get the encryptionAlgorithm property: Encryption algorithm that will be used along with this client encryption + * key to encrypt/decrypt data. + * + * @return the encryptionAlgorithm value. + */ + public String encryptionAlgorithm() { + return this.encryptionAlgorithm; + } + + /** + * Set the encryptionAlgorithm property: Encryption algorithm that will be used along with this client encryption + * key to encrypt/decrypt data. + * + * @param encryptionAlgorithm the encryptionAlgorithm value to set. + * @return the ClientEncryptionKeyResource object itself. + */ + public ClientEncryptionKeyResource withEncryptionAlgorithm(String encryptionAlgorithm) { + this.encryptionAlgorithm = encryptionAlgorithm; + return this; + } + + /** + * Get the wrappedDataEncryptionKey property: Wrapped (encrypted) form of the key represented as a byte array. + * + * @return the wrappedDataEncryptionKey value. + */ + public byte[] wrappedDataEncryptionKey() { + return CoreUtils.clone(this.wrappedDataEncryptionKey); + } + + /** + * Set the wrappedDataEncryptionKey property: Wrapped (encrypted) form of the key represented as a byte array. + * + * @param wrappedDataEncryptionKey the wrappedDataEncryptionKey value to set. + * @return the ClientEncryptionKeyResource object itself. + */ + public ClientEncryptionKeyResource withWrappedDataEncryptionKey(byte[] wrappedDataEncryptionKey) { + this.wrappedDataEncryptionKey = CoreUtils.clone(wrappedDataEncryptionKey); + return this; + } + + /** + * Get the keyWrapMetadata property: Metadata for the wrapping provider that can be used to unwrap the wrapped + * client encryption key. + * + * @return the keyWrapMetadata value. + */ + public KeyWrapMetadata keyWrapMetadata() { + return this.keyWrapMetadata; + } + + /** + * Set the keyWrapMetadata property: Metadata for the wrapping provider that can be used to unwrap the wrapped + * client encryption key. + * + * @param keyWrapMetadata the keyWrapMetadata value to set. + * @return the ClientEncryptionKeyResource object itself. + */ + public ClientEncryptionKeyResource withKeyWrapMetadata(KeyWrapMetadata keyWrapMetadata) { + this.keyWrapMetadata = keyWrapMetadata; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (keyWrapMetadata() != null) { + keyWrapMetadata().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("encryptionAlgorithm", this.encryptionAlgorithm); + jsonWriter.writeBinaryField("wrappedDataEncryptionKey", this.wrappedDataEncryptionKey); + jsonWriter.writeJsonField("keyWrapMetadata", this.keyWrapMetadata); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ClientEncryptionKeyResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ClientEncryptionKeyResource if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ClientEncryptionKeyResource. + */ + public static ClientEncryptionKeyResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ClientEncryptionKeyResource deserializedClientEncryptionKeyResource = new ClientEncryptionKeyResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedClientEncryptionKeyResource.id = reader.getString(); + } else if ("encryptionAlgorithm".equals(fieldName)) { + deserializedClientEncryptionKeyResource.encryptionAlgorithm = reader.getString(); + } else if ("wrappedDataEncryptionKey".equals(fieldName)) { + deserializedClientEncryptionKeyResource.wrappedDataEncryptionKey = reader.getBinary(); + } else if ("keyWrapMetadata".equals(fieldName)) { + deserializedClientEncryptionKeyResource.keyWrapMetadata = KeyWrapMetadata.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedClientEncryptionKeyResource; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClientEncryptionKeysListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClientEncryptionKeysListResult.java new file mode 100644 index 0000000000000..1412437f88d9d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClientEncryptionKeysListResult.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.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ClientEncryptionKeyGetResultsInner; +import java.io.IOException; +import java.util.List; + +/** + * The List operation response, that contains the client encryption keys and their properties. + */ +@Immutable +public final class ClientEncryptionKeysListResult implements JsonSerializable { + /* + * List of client encryption keys and their properties. + */ + private List value; + + /** + * Creates an instance of ClientEncryptionKeysListResult class. + */ + public ClientEncryptionKeysListResult() { + } + + /** + * Get the value property: List of client encryption keys 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ClientEncryptionKeysListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ClientEncryptionKeysListResult if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ClientEncryptionKeysListResult. + */ + public static ClientEncryptionKeysListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ClientEncryptionKeysListResult deserializedClientEncryptionKeysListResult + = new ClientEncryptionKeysListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> ClientEncryptionKeyGetResultsInner.fromJson(reader1)); + deserializedClientEncryptionKeysListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedClientEncryptionKeysListResult; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClientEncryptionPolicy.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClientEncryptionPolicy.java new file mode 100644 index 0000000000000..34990847b1f45 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClientEncryptionPolicy.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Cosmos DB client encryption policy. + */ +@Fluent +public final class ClientEncryptionPolicy implements JsonSerializable { + /* + * Paths of the item that need encryption along with path-specific settings. + */ + private List includedPaths; + + /* + * Version of the client encryption policy definition. Supported versions are 1 and 2. Version 2 supports id and + * partition key path encryption. + */ + private int policyFormatVersion; + + /** + * Creates an instance of ClientEncryptionPolicy class. + */ + public ClientEncryptionPolicy() { + } + + /** + * Get the includedPaths property: Paths of the item that need encryption along with path-specific settings. + * + * @return the includedPaths value. + */ + public List includedPaths() { + return this.includedPaths; + } + + /** + * Set the includedPaths property: Paths of the item that need encryption along with path-specific settings. + * + * @param includedPaths the includedPaths value to set. + * @return the ClientEncryptionPolicy object itself. + */ + public ClientEncryptionPolicy withIncludedPaths(List includedPaths) { + this.includedPaths = includedPaths; + return this; + } + + /** + * Get the policyFormatVersion property: Version of the client encryption policy definition. Supported versions are + * 1 and 2. Version 2 supports id and partition key path encryption. + * + * @return the policyFormatVersion value. + */ + public int policyFormatVersion() { + return this.policyFormatVersion; + } + + /** + * Set the policyFormatVersion property: Version of the client encryption policy definition. Supported versions are + * 1 and 2. Version 2 supports id and partition key path encryption. + * + * @param policyFormatVersion the policyFormatVersion value to set. + * @return the ClientEncryptionPolicy object itself. + */ + public ClientEncryptionPolicy withPolicyFormatVersion(int policyFormatVersion) { + this.policyFormatVersion = policyFormatVersion; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (includedPaths() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property includedPaths in model ClientEncryptionPolicy")); + } else { + includedPaths().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ClientEncryptionPolicy.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("includedPaths", this.includedPaths, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeIntField("policyFormatVersion", this.policyFormatVersion); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ClientEncryptionPolicy from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ClientEncryptionPolicy if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ClientEncryptionPolicy. + */ + public static ClientEncryptionPolicy fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ClientEncryptionPolicy deserializedClientEncryptionPolicy = new ClientEncryptionPolicy(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("includedPaths".equals(fieldName)) { + List includedPaths + = reader.readArray(reader1 -> ClientEncryptionIncludedPath.fromJson(reader1)); + deserializedClientEncryptionPolicy.includedPaths = includedPaths; + } else if ("policyFormatVersion".equals(fieldName)) { + deserializedClientEncryptionPolicy.policyFormatVersion = reader.getInt(); + } else { + reader.skipChildren(); + } + } + + return deserializedClientEncryptionPolicy; + }); + } +} 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..777af3076a85d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClusterKey.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Cosmos DB Cassandra table cluster key. + */ +@Fluent +public final class ClusterKey implements JsonSerializable { + /* + * Name of the Cosmos DB Cassandra table cluster key + */ + private String name; + + /* + * Order of the Cosmos DB Cassandra table cluster key, only support "Asc" and "Desc" + */ + private String orderBy; + + /** + * Creates an instance of ClusterKey class. + */ + public ClusterKey() { + } + + /** + * 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("orderBy", this.orderBy); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ClusterKey from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ClusterKey if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the ClusterKey. + */ + public static ClusterKey fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ClusterKey deserializedClusterKey = new ClusterKey(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedClusterKey.name = reader.getString(); + } else if ("orderBy".equals(fieldName)) { + deserializedClusterKey.orderBy = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedClusterKey; + }); + } +} 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..f40597f2a4743 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClusterResource.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.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. + */ + ManagedCassandraManagedServiceIdentity 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 name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * 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(ManagedCassandraManagedServiceIdentity 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(ManagedCassandraManagedServiceIdentity 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); + + /** + * Invoke a command like nodetool for cassandra maintenance. + * + * @param body Specification which command to run where. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of /command api. + */ + CommandOutput invokeCommand(CommandPostBody body); + + /** + * Invoke a command like nodetool for cassandra maintenance. + * + * @param body Specification which command to run where. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of /command api. + */ + CommandOutput invokeCommand(CommandPostBody body, Context context); + + /** + * Deallocate the Managed Cassandra Cluster and Associated Data Centers. Deallocation will deallocate the host + * virtual machine of this cluster, and reserved the data disk. This won't do anything on an already deallocated + * cluster. Use Start to restart the cluster. + * + * @throws com.azure.core.management.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 deallocate(); + + /** + * Deallocate the Managed Cassandra Cluster and Associated Data Centers. Deallocation will deallocate the host + * virtual machine of this cluster, and reserved the data disk. This won't do anything on an already deallocated + * cluster. Use Start to restart the 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 deallocate(Context context); + + /** + * Start the Managed Cassandra Cluster and Associated Data Centers. Start will start the host virtual machine of + * this cluster with reserved data disk. This won't do anything on an already running cluster. Use Deallocate to + * deallocate the cluster. + * + * @throws com.azure.core.management.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(); + + /** + * Start the Managed Cassandra Cluster and Associated Data Centers. Start will start the host virtual machine of + * this cluster with reserved data disk. This won't do anything on an already running cluster. Use Deallocate to + * deallocate the 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 start(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..700681e37ec8e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClusterResourceProperties.java @@ -0,0 +1,690 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Properties of a managed Cassandra cluster. + */ +@Fluent +public final class ClusterResourceProperties implements JsonSerializable { + /* + * The status of the resource at the time the operation was called. + */ + 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. + */ + 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/' + */ + 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. + */ + 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. + */ + 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'. + */ + 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'. + */ + private String initialCassandraAdminPassword; + + /* + * Hostname or IP address where the Prometheus endpoint containing data about the managed Cassandra nodes can be + * reached. + */ + 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. + */ + 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. + */ + 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. + */ + 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. + */ + 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. + */ + 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. + */ + private List seedNodes; + + /* + * (Deprecated) Number of hours to wait between taking a backup of the cluster. + */ + private Integer hoursBetweenBackups; + + /* + * Whether the cluster and associated data centers has been deallocated. + */ + private Boolean deallocated; + + /* + * Whether Cassandra audit logging is enabled + */ + private Boolean cassandraAuditLoggingEnabled; + + /* + * Error related to resource provisioning. + */ + private CassandraError provisionError; + + /* + * How to connect to the azure services needed for running the cluster + */ + private AzureConnectionType azureConnectionMethod; + + /* + * If the Connection Method is VPN, this is the Id of the private link resource that the datacenters need to connect + * to. + */ + private String privateLinkResourceId; + + /** + * Creates an instance of ClusterResourceProperties class. + */ + public ClusterResourceProperties() { + } + + /** + * 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 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; + } + + /** + * Get the hoursBetweenBackups property: (Deprecated) Number of hours to wait between taking a backup of the + * cluster. + * + * @return the hoursBetweenBackups value. + */ + public Integer hoursBetweenBackups() { + return this.hoursBetweenBackups; + } + + /** + * Set the hoursBetweenBackups property: (Deprecated) Number of hours to wait between taking a backup of the + * cluster. + * + * @param hoursBetweenBackups the hoursBetweenBackups value to set. + * @return the ClusterResourceProperties object itself. + */ + public ClusterResourceProperties withHoursBetweenBackups(Integer hoursBetweenBackups) { + this.hoursBetweenBackups = hoursBetweenBackups; + return this; + } + + /** + * Get the deallocated property: Whether the cluster and associated data centers has been deallocated. + * + * @return the deallocated value. + */ + public Boolean deallocated() { + return this.deallocated; + } + + /** + * Set the deallocated property: Whether the cluster and associated data centers has been deallocated. + * + * @param deallocated the deallocated value to set. + * @return the ClusterResourceProperties object itself. + */ + public ClusterResourceProperties withDeallocated(Boolean deallocated) { + this.deallocated = deallocated; + return this; + } + + /** + * Get the cassandraAuditLoggingEnabled property: Whether Cassandra audit logging is enabled. + * + * @return the cassandraAuditLoggingEnabled value. + */ + public Boolean cassandraAuditLoggingEnabled() { + return this.cassandraAuditLoggingEnabled; + } + + /** + * Set the cassandraAuditLoggingEnabled property: Whether Cassandra audit logging is enabled. + * + * @param cassandraAuditLoggingEnabled the cassandraAuditLoggingEnabled value to set. + * @return the ClusterResourceProperties object itself. + */ + public ClusterResourceProperties withCassandraAuditLoggingEnabled(Boolean cassandraAuditLoggingEnabled) { + this.cassandraAuditLoggingEnabled = cassandraAuditLoggingEnabled; + return this; + } + + /** + * Get the provisionError property: Error related to resource provisioning. + * + * @return the provisionError value. + */ + public CassandraError provisionError() { + return this.provisionError; + } + + /** + * Set the provisionError property: Error related to resource provisioning. + * + * @param provisionError the provisionError value to set. + * @return the ClusterResourceProperties object itself. + */ + public ClusterResourceProperties withProvisionError(CassandraError provisionError) { + this.provisionError = provisionError; + return this; + } + + /** + * Get the azureConnectionMethod property: How to connect to the azure services needed for running the cluster. + * + * @return the azureConnectionMethod value. + */ + public AzureConnectionType azureConnectionMethod() { + return this.azureConnectionMethod; + } + + /** + * Set the azureConnectionMethod property: How to connect to the azure services needed for running the cluster. + * + * @param azureConnectionMethod the azureConnectionMethod value to set. + * @return the ClusterResourceProperties object itself. + */ + public ClusterResourceProperties withAzureConnectionMethod(AzureConnectionType azureConnectionMethod) { + this.azureConnectionMethod = azureConnectionMethod; + return this; + } + + /** + * Get the privateLinkResourceId property: If the Connection Method is VPN, this is the Id of the private link + * resource that the datacenters need to connect to. + * + * @return the privateLinkResourceId value. + */ + public String privateLinkResourceId() { + return this.privateLinkResourceId; + } + + /** + * 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()); + } + if (provisionError() != null) { + provisionError().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("provisioningState", + this.provisioningState == null ? null : this.provisioningState.toString()); + jsonWriter.writeStringField("restoreFromBackupId", this.restoreFromBackupId); + jsonWriter.writeStringField("delegatedManagementSubnetId", this.delegatedManagementSubnetId); + jsonWriter.writeStringField("cassandraVersion", this.cassandraVersion); + jsonWriter.writeStringField("clusterNameOverride", this.clusterNameOverride); + jsonWriter.writeStringField("authenticationMethod", + this.authenticationMethod == null ? null : this.authenticationMethod.toString()); + jsonWriter.writeStringField("initialCassandraAdminPassword", this.initialCassandraAdminPassword); + jsonWriter.writeJsonField("prometheusEndpoint", this.prometheusEndpoint); + jsonWriter.writeBooleanField("repairEnabled", this.repairEnabled); + jsonWriter.writeArrayField("clientCertificates", this.clientCertificates, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("externalGossipCertificates", this.externalGossipCertificates, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("externalSeedNodes", this.externalSeedNodes, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeNumberField("hoursBetweenBackups", this.hoursBetweenBackups); + jsonWriter.writeBooleanField("deallocated", this.deallocated); + jsonWriter.writeBooleanField("cassandraAuditLoggingEnabled", this.cassandraAuditLoggingEnabled); + jsonWriter.writeJsonField("provisionError", this.provisionError); + jsonWriter.writeStringField("azureConnectionMethod", + this.azureConnectionMethod == null ? null : this.azureConnectionMethod.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ClusterResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ClusterResourceProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ClusterResourceProperties. + */ + public static ClusterResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ClusterResourceProperties deserializedClusterResourceProperties = new ClusterResourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedClusterResourceProperties.provisioningState + = ManagedCassandraProvisioningState.fromString(reader.getString()); + } else if ("restoreFromBackupId".equals(fieldName)) { + deserializedClusterResourceProperties.restoreFromBackupId = reader.getString(); + } else if ("delegatedManagementSubnetId".equals(fieldName)) { + deserializedClusterResourceProperties.delegatedManagementSubnetId = reader.getString(); + } else if ("cassandraVersion".equals(fieldName)) { + deserializedClusterResourceProperties.cassandraVersion = reader.getString(); + } else if ("clusterNameOverride".equals(fieldName)) { + deserializedClusterResourceProperties.clusterNameOverride = reader.getString(); + } else if ("authenticationMethod".equals(fieldName)) { + deserializedClusterResourceProperties.authenticationMethod + = AuthenticationMethod.fromString(reader.getString()); + } else if ("initialCassandraAdminPassword".equals(fieldName)) { + deserializedClusterResourceProperties.initialCassandraAdminPassword = reader.getString(); + } else if ("prometheusEndpoint".equals(fieldName)) { + deserializedClusterResourceProperties.prometheusEndpoint = SeedNode.fromJson(reader); + } else if ("repairEnabled".equals(fieldName)) { + deserializedClusterResourceProperties.repairEnabled = reader.getNullable(JsonReader::getBoolean); + } else if ("clientCertificates".equals(fieldName)) { + List clientCertificates = reader.readArray(reader1 -> Certificate.fromJson(reader1)); + deserializedClusterResourceProperties.clientCertificates = clientCertificates; + } else if ("externalGossipCertificates".equals(fieldName)) { + List externalGossipCertificates + = reader.readArray(reader1 -> Certificate.fromJson(reader1)); + deserializedClusterResourceProperties.externalGossipCertificates = externalGossipCertificates; + } else if ("gossipCertificates".equals(fieldName)) { + List gossipCertificates = reader.readArray(reader1 -> Certificate.fromJson(reader1)); + deserializedClusterResourceProperties.gossipCertificates = gossipCertificates; + } else if ("externalSeedNodes".equals(fieldName)) { + List externalSeedNodes = reader.readArray(reader1 -> SeedNode.fromJson(reader1)); + deserializedClusterResourceProperties.externalSeedNodes = externalSeedNodes; + } else if ("seedNodes".equals(fieldName)) { + List seedNodes = reader.readArray(reader1 -> SeedNode.fromJson(reader1)); + deserializedClusterResourceProperties.seedNodes = seedNodes; + } else if ("hoursBetweenBackups".equals(fieldName)) { + deserializedClusterResourceProperties.hoursBetweenBackups = reader.getNullable(JsonReader::getInt); + } else if ("deallocated".equals(fieldName)) { + deserializedClusterResourceProperties.deallocated = reader.getNullable(JsonReader::getBoolean); + } else if ("cassandraAuditLoggingEnabled".equals(fieldName)) { + deserializedClusterResourceProperties.cassandraAuditLoggingEnabled + = reader.getNullable(JsonReader::getBoolean); + } else if ("provisionError".equals(fieldName)) { + deserializedClusterResourceProperties.provisionError = CassandraError.fromJson(reader); + } else if ("azureConnectionMethod".equals(fieldName)) { + deserializedClusterResourceProperties.azureConnectionMethod + = AzureConnectionType.fromString(reader.getString()); + } else if ("privateLinkResourceId".equals(fieldName)) { + deserializedClusterResourceProperties.privateLinkResourceId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedClusterResourceProperties; + }); + } +} 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..747b42bf5ac12 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CollectionPartitionRegions.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.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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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..289f6c618160a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CollectionPartitions.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.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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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..965f552a4c54d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CollectionRegions.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.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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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..d9c753fd3016c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Collections.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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..d56cd96d5122e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Column.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Cosmos DB Cassandra table column. + */ +@Fluent +public final class Column implements JsonSerializable { + /* + * Name of the Cosmos DB Cassandra table column + */ + private String name; + + /* + * Type of the Cosmos DB Cassandra table column + */ + private String type; + + /** + * Creates an instance of Column class. + */ + public Column() { + } + + /** + * 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Column from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Column if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IOException If an error occurs while reading the Column. + */ + public static Column fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Column deserializedColumn = new Column(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedColumn.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedColumn.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedColumn; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CommandOutput.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CommandOutput.java new file mode 100644 index 0000000000000..1025d7f280ea6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CommandOutput.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.CommandOutputInner; + +/** + * An immutable client-side representation of CommandOutput. + */ +public interface CommandOutput { + /** + * Gets the commandOutput property: Output of the command. + * + * @return the commandOutput value. + */ + String commandOutput(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.CommandOutputInner object. + * + * @return the inner object. + */ + CommandOutputInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CommandPostBody.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CommandPostBody.java new file mode 100644 index 0000000000000..9b4bebb5bbb8f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CommandPostBody.java @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Specification of which command to run where. + */ +@Fluent +public final class CommandPostBody implements JsonSerializable { + /* + * The command which should be run + */ + private String command; + + /* + * The arguments for the command to be run + */ + private Map arguments; + + /* + * IP address of the cassandra host to run the command on + */ + private String host; + + /* + * If true, stops cassandra before executing the command and then start it again + */ + private Boolean cassandraStopStart; + + /* + * If true, allows the command to *write* to the cassandra directory, otherwise read-only. + */ + private Boolean readwrite; + + /** + * Creates an instance of CommandPostBody class. + */ + public CommandPostBody() { + } + + /** + * Get the command property: The command which should be run. + * + * @return the command value. + */ + public String command() { + return this.command; + } + + /** + * Set the command property: The command which should be run. + * + * @param command the command value to set. + * @return the CommandPostBody object itself. + */ + public CommandPostBody withCommand(String command) { + this.command = command; + return this; + } + + /** + * Get the arguments property: The arguments for the command to be run. + * + * @return the arguments value. + */ + public Map arguments() { + return this.arguments; + } + + /** + * Set the arguments property: The arguments for the command to be run. + * + * @param arguments the arguments value to set. + * @return the CommandPostBody object itself. + */ + public CommandPostBody withArguments(Map arguments) { + this.arguments = arguments; + return this; + } + + /** + * Get the host property: IP address of the cassandra host to run the command on. + * + * @return the host value. + */ + public String host() { + return this.host; + } + + /** + * Set the host property: IP address of the cassandra host to run the command on. + * + * @param host the host value to set. + * @return the CommandPostBody object itself. + */ + public CommandPostBody withHost(String host) { + this.host = host; + return this; + } + + /** + * Get the cassandraStopStart property: If true, stops cassandra before executing the command and then start it + * again. + * + * @return the cassandraStopStart value. + */ + public Boolean cassandraStopStart() { + return this.cassandraStopStart; + } + + /** + * Set the cassandraStopStart property: If true, stops cassandra before executing the command and then start it + * again. + * + * @param cassandraStopStart the cassandraStopStart value to set. + * @return the CommandPostBody object itself. + */ + public CommandPostBody withCassandraStopStart(Boolean cassandraStopStart) { + this.cassandraStopStart = cassandraStopStart; + return this; + } + + /** + * Get the readwrite property: If true, allows the command to *write* to the cassandra directory, otherwise + * read-only. + * + * @return the readwrite value. + */ + public Boolean readwrite() { + return this.readwrite; + } + + /** + * Set the readwrite property: If true, allows the command to *write* to the cassandra directory, otherwise + * read-only. + * + * @param readwrite the readwrite value to set. + * @return the CommandPostBody object itself. + */ + public CommandPostBody withReadwrite(Boolean readwrite) { + this.readwrite = readwrite; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (command() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property command in model CommandPostBody")); + } + if (host() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property host in model CommandPostBody")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CommandPostBody.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("command", this.command); + jsonWriter.writeStringField("host", this.host); + jsonWriter.writeMapField("arguments", this.arguments, (writer, element) -> writer.writeString(element)); + jsonWriter.writeBooleanField("cassandra-stop-start", this.cassandraStopStart); + jsonWriter.writeBooleanField("readwrite", this.readwrite); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CommandPostBody from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CommandPostBody if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CommandPostBody. + */ + public static CommandPostBody fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CommandPostBody deserializedCommandPostBody = new CommandPostBody(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("command".equals(fieldName)) { + deserializedCommandPostBody.command = reader.getString(); + } else if ("host".equals(fieldName)) { + deserializedCommandPostBody.host = reader.getString(); + } else if ("arguments".equals(fieldName)) { + Map arguments = reader.readMap(reader1 -> reader1.getString()); + deserializedCommandPostBody.arguments = arguments; + } else if ("cassandra-stop-start".equals(fieldName)) { + deserializedCommandPostBody.cassandraStopStart = reader.getNullable(JsonReader::getBoolean); + } else if ("readwrite".equals(fieldName)) { + deserializedCommandPostBody.readwrite = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedCommandPostBody; + }); + } +} 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..edc50395189bb --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CompositePath.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The CompositePath model. + */ +@Fluent +public final class CompositePath implements JsonSerializable { + /* + * The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard + * (/path/*) + */ + private String path; + + /* + * Sort order for composite paths. + */ + private CompositePathSortOrder order; + + /** + * Creates an instance of CompositePath class. + */ + public CompositePath() { + } + + /** + * 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("path", this.path); + jsonWriter.writeStringField("order", this.order == null ? null : this.order.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CompositePath from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CompositePath if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the CompositePath. + */ + public static CompositePath fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CompositePath deserializedCompositePath = new CompositePath(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("path".equals(fieldName)) { + deserializedCompositePath.path = reader.getString(); + } else if ("order".equals(fieldName)) { + deserializedCompositePath.order = CompositePathSortOrder.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedCompositePath; + }); + } +} 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..07e469d993264 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CompositePathSortOrder.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.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Sort order for composite paths. + */ +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 a new instance of CompositePathSortOrder value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public CompositePathSortOrder() { + } + + /** + * Creates or finds a CompositePathSortOrder from its string representation. + * + * @param name a name to look for. + * @return the corresponding CompositePathSortOrder. + */ + public static CompositePathSortOrder fromString(String name) { + return fromString(name, CompositePathSortOrder.class); + } + + /** + * Gets known CompositePathSortOrder values. + * + * @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/ComputedProperty.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ComputedProperty.java new file mode 100644 index 0000000000000..efa782d2fc1fa --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ComputedProperty.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The definition of a computed property. + */ +@Fluent +public final class ComputedProperty implements JsonSerializable { + /* + * The name of a computed property, for example - "cp_lowerName" + */ + private String name; + + /* + * The query that evaluates the value for computed property, for example - "SELECT VALUE LOWER(c.name) FROM c" + */ + private String query; + + /** + * Creates an instance of ComputedProperty class. + */ + public ComputedProperty() { + } + + /** + * Get the name property: The name of a computed property, for example - "cp_lowerName". + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of a computed property, for example - "cp_lowerName". + * + * @param name the name value to set. + * @return the ComputedProperty object itself. + */ + public ComputedProperty withName(String name) { + this.name = name; + return this; + } + + /** + * Get the query property: The query that evaluates the value for computed property, for example - "SELECT VALUE + * LOWER(c.name) FROM c". + * + * @return the query value. + */ + public String query() { + return this.query; + } + + /** + * Set the query property: The query that evaluates the value for computed property, for example - "SELECT VALUE + * LOWER(c.name) FROM c". + * + * @param query the query value to set. + * @return the ComputedProperty object itself. + */ + public ComputedProperty withQuery(String query) { + this.query = query; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("query", this.query); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ComputedProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ComputedProperty if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ComputedProperty. + */ + public static ComputedProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ComputedProperty deserializedComputedProperty = new ComputedProperty(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedComputedProperty.name = reader.getString(); + } else if ("query".equals(fieldName)) { + deserializedComputedProperty.query = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedComputedProperty; + }); + } +} 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..7a6f3da940955 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ConflictResolutionMode.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.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Indicates the conflict resolution mode. + */ +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 a new instance of ConflictResolutionMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ConflictResolutionMode() { + } + + /** + * Creates or finds a ConflictResolutionMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding ConflictResolutionMode. + */ + public static ConflictResolutionMode fromString(String name) { + return fromString(name, ConflictResolutionMode.class); + } + + /** + * Gets known ConflictResolutionMode values. + * + * @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..1f083f36f24de --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ConflictResolutionPolicy.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.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The conflict resolution policy for the container. + */ +@Fluent +public final class ConflictResolutionPolicy implements JsonSerializable { + /* + * Indicates the conflict resolution mode. + */ + private ConflictResolutionMode mode; + + /* + * The conflict resolution path in the case of LastWriterWins mode. + */ + private String conflictResolutionPath; + + /* + * The procedure to resolve conflicts in the case of custom mode. + */ + private String conflictResolutionProcedure; + + /** + * Creates an instance of ConflictResolutionPolicy class. + */ + public ConflictResolutionPolicy() { + } + + /** + * 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("mode", this.mode == null ? null : this.mode.toString()); + jsonWriter.writeStringField("conflictResolutionPath", this.conflictResolutionPath); + jsonWriter.writeStringField("conflictResolutionProcedure", this.conflictResolutionProcedure); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ConflictResolutionPolicy from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ConflictResolutionPolicy if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ConflictResolutionPolicy. + */ + public static ConflictResolutionPolicy fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ConflictResolutionPolicy deserializedConflictResolutionPolicy = new ConflictResolutionPolicy(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("mode".equals(fieldName)) { + deserializedConflictResolutionPolicy.mode = ConflictResolutionMode.fromString(reader.getString()); + } else if ("conflictResolutionPath".equals(fieldName)) { + deserializedConflictResolutionPolicy.conflictResolutionPath = reader.getString(); + } else if ("conflictResolutionProcedure".equals(fieldName)) { + deserializedConflictResolutionPolicy.conflictResolutionProcedure = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedConflictResolutionPolicy; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ConnectionError.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ConnectionError.java new file mode 100644 index 0000000000000..2c58e62135684 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ConnectionError.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ConnectionError model. + */ +@Fluent +public final class ConnectionError implements JsonSerializable { + /* + * The kind of connection error that occurred. + */ + private ConnectionState connectionState; + + /* + * The IP of host that originated the failed connection. + */ + private String iPFrom; + + /* + * The IP that the connection attempted to reach. + */ + private String iPTo; + + /* + * The TCP port the connection was attempted on. + */ + private Integer port; + + /* + * Detailed error message about the failed connection. + */ + private String exception; + + /** + * Creates an instance of ConnectionError class. + */ + public ConnectionError() { + } + + /** + * Get the connectionState property: The kind of connection error that occurred. + * + * @return the connectionState value. + */ + public ConnectionState connectionState() { + return this.connectionState; + } + + /** + * Set the connectionState property: The kind of connection error that occurred. + * + * @param connectionState the connectionState value to set. + * @return the ConnectionError object itself. + */ + public ConnectionError withConnectionState(ConnectionState connectionState) { + this.connectionState = connectionState; + return this; + } + + /** + * Get the iPFrom property: The IP of host that originated the failed connection. + * + * @return the iPFrom value. + */ + public String iPFrom() { + return this.iPFrom; + } + + /** + * Set the iPFrom property: The IP of host that originated the failed connection. + * + * @param iPFrom the iPFrom value to set. + * @return the ConnectionError object itself. + */ + public ConnectionError withIPFrom(String iPFrom) { + this.iPFrom = iPFrom; + return this; + } + + /** + * Get the iPTo property: The IP that the connection attempted to reach. + * + * @return the iPTo value. + */ + public String iPTo() { + return this.iPTo; + } + + /** + * Set the iPTo property: The IP that the connection attempted to reach. + * + * @param iPTo the iPTo value to set. + * @return the ConnectionError object itself. + */ + public ConnectionError withIPTo(String iPTo) { + this.iPTo = iPTo; + return this; + } + + /** + * Get the port property: The TCP port the connection was attempted on. + * + * @return the port value. + */ + public Integer port() { + return this.port; + } + + /** + * Set the port property: The TCP port the connection was attempted on. + * + * @param port the port value to set. + * @return the ConnectionError object itself. + */ + public ConnectionError withPort(Integer port) { + this.port = port; + return this; + } + + /** + * Get the exception property: Detailed error message about the failed connection. + * + * @return the exception value. + */ + public String exception() { + return this.exception; + } + + /** + * Set the exception property: Detailed error message about the failed connection. + * + * @param exception the exception value to set. + * @return the ConnectionError object itself. + */ + public ConnectionError withException(String exception) { + this.exception = exception; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("connectionState", + this.connectionState == null ? null : this.connectionState.toString()); + jsonWriter.writeStringField("iPFrom", this.iPFrom); + jsonWriter.writeStringField("iPTo", this.iPTo); + jsonWriter.writeNumberField("port", this.port); + jsonWriter.writeStringField("exception", this.exception); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ConnectionError from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ConnectionError if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ConnectionError. + */ + public static ConnectionError fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ConnectionError deserializedConnectionError = new ConnectionError(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("connectionState".equals(fieldName)) { + deserializedConnectionError.connectionState = ConnectionState.fromString(reader.getString()); + } else if ("iPFrom".equals(fieldName)) { + deserializedConnectionError.iPFrom = reader.getString(); + } else if ("iPTo".equals(fieldName)) { + deserializedConnectionError.iPTo = reader.getString(); + } else if ("port".equals(fieldName)) { + deserializedConnectionError.port = reader.getNullable(JsonReader::getInt); + } else if ("exception".equals(fieldName)) { + deserializedConnectionError.exception = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedConnectionError; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ConnectionState.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ConnectionState.java new file mode 100644 index 0000000000000..b1f9239ffeeb7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ConnectionState.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 java.util.Collection; + +/** + * The kind of connection error that occurred. + */ +public final class ConnectionState extends ExpandableStringEnum { + /** + * Static value Unknown for ConnectionState. + */ + public static final ConnectionState UNKNOWN = fromString("Unknown"); + + /** + * Static value OK for ConnectionState. + */ + public static final ConnectionState OK = fromString("OK"); + + /** + * Static value OperatorToDataCenterNetworkError for ConnectionState. + */ + public static final ConnectionState OPERATOR_TO_DATA_CENTER_NETWORK_ERROR + = fromString("OperatorToDataCenterNetworkError"); + + /** + * Static value DatacenterToDatacenterNetworkError for ConnectionState. + */ + public static final ConnectionState DATACENTER_TO_DATACENTER_NETWORK_ERROR + = fromString("DatacenterToDatacenterNetworkError"); + + /** + * Static value InternalOperatorToDataCenterCertificateError for ConnectionState. + */ + public static final ConnectionState INTERNAL_OPERATOR_TO_DATA_CENTER_CERTIFICATE_ERROR + = fromString("InternalOperatorToDataCenterCertificateError"); + + /** + * Static value InternalError for ConnectionState. + */ + public static final ConnectionState INTERNAL_ERROR = fromString("InternalError"); + + /** + * Creates a new instance of ConnectionState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ConnectionState() { + } + + /** + * Creates or finds a ConnectionState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ConnectionState. + */ + public static ConnectionState fromString(String name) { + return fromString(name, ConnectionState.class); + } + + /** + * Gets known ConnectionState values. + * + * @return known ConnectionState values. + */ + public static Collection values() { + return values(ConnectionState.class); + } +} 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..d92b1ff80b341 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ConnectorOffer.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 java.util.Collection; + +/** + * The cassandra connector offer type for the Cosmos DB C* database account. + */ +public final class ConnectorOffer extends ExpandableStringEnum { + /** + * Static value Small for ConnectorOffer. + */ + public static final ConnectorOffer SMALL = fromString("Small"); + + /** + * Creates a new instance of ConnectorOffer value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ConnectorOffer() { + } + + /** + * Creates or finds a ConnectorOffer from its string representation. + * + * @param name a name to look for. + * @return the corresponding ConnectorOffer. + */ + public static ConnectorOffer fromString(String name) { + return fromString(name, ConnectorOffer.class); + } + + /** + * Gets known ConnectorOffer values. + * + * @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..c742eda633b02 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ConsistencyPolicy.java @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The consistency policy for the Cosmos DB database account. + */ +@Fluent +public final class ConsistencyPolicy implements JsonSerializable { + /* + * The default consistency level and configuration settings of the Cosmos DB account. + */ + 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'. + */ + 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'. + */ + private Integer maxIntervalInSeconds; + + /** + * Creates an instance of ConsistencyPolicy class. + */ + public ConsistencyPolicy() { + } + + /** + * 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.atError() + .log(new IllegalArgumentException( + "Missing required property defaultConsistencyLevel in model ConsistencyPolicy")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ConsistencyPolicy.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("defaultConsistencyLevel", + this.defaultConsistencyLevel == null ? null : this.defaultConsistencyLevel.toString()); + jsonWriter.writeNumberField("maxStalenessPrefix", this.maxStalenessPrefix); + jsonWriter.writeNumberField("maxIntervalInSeconds", this.maxIntervalInSeconds); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ConsistencyPolicy from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ConsistencyPolicy if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ConsistencyPolicy. + */ + public static ConsistencyPolicy fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ConsistencyPolicy deserializedConsistencyPolicy = new ConsistencyPolicy(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("defaultConsistencyLevel".equals(fieldName)) { + deserializedConsistencyPolicy.defaultConsistencyLevel + = DefaultConsistencyLevel.fromString(reader.getString()); + } else if ("maxStalenessPrefix".equals(fieldName)) { + deserializedConsistencyPolicy.maxStalenessPrefix = reader.getNullable(JsonReader::getLong); + } else if ("maxIntervalInSeconds".equals(fieldName)) { + deserializedConsistencyPolicy.maxIntervalInSeconds = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedConsistencyPolicy; + }); + } +} 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..156446bbe1759 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ContainerPartitionKey.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The configuration of the partition key to be used for partitioning data into multiple partitions. + */ +@Fluent +public final class ContainerPartitionKey implements JsonSerializable { + /* + * List of paths using which data within the container can be partitioned + */ + private List paths; + + /* + * Indicates the kind of algorithm used for partitioning. For MultiHash, multiple partition keys (upto three + * maximum) are supported for container create + */ + private PartitionKind kind; + + /* + * Indicates the version of the partition key definition + */ + private Integer version; + + /* + * Indicates if the container is using a system generated partition key + */ + private Boolean systemKey; + + /** + * Creates an instance of ContainerPartitionKey class. + */ + public ContainerPartitionKey() { + } + + /** + * 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("paths", this.paths, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeNumberField("version", this.version); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ContainerPartitionKey from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ContainerPartitionKey if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the ContainerPartitionKey. + */ + public static ContainerPartitionKey fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ContainerPartitionKey deserializedContainerPartitionKey = new ContainerPartitionKey(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("paths".equals(fieldName)) { + List paths = reader.readArray(reader1 -> reader1.getString()); + deserializedContainerPartitionKey.paths = paths; + } else if ("kind".equals(fieldName)) { + deserializedContainerPartitionKey.kind = PartitionKind.fromString(reader.getString()); + } else if ("version".equals(fieldName)) { + deserializedContainerPartitionKey.version = reader.getNullable(JsonReader::getInt); + } else if ("systemKey".equals(fieldName)) { + deserializedContainerPartitionKey.systemKey = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedContainerPartitionKey; + }); + } +} 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..9af2c1a3a70ae --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ContinuousBackupInformation.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Information about the status of continuous backups. + */ +@Fluent +public final class ContinuousBackupInformation implements JsonSerializable { + /* + * The latest restorable timestamp for a resource. + */ + private String latestRestorableTimestamp; + + /** + * Creates an instance of ContinuousBackupInformation class. + */ + public ContinuousBackupInformation() { + } + + /** + * 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("latestRestorableTimestamp", this.latestRestorableTimestamp); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ContinuousBackupInformation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ContinuousBackupInformation if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ContinuousBackupInformation. + */ + public static ContinuousBackupInformation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ContinuousBackupInformation deserializedContinuousBackupInformation = new ContinuousBackupInformation(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("latestRestorableTimestamp".equals(fieldName)) { + deserializedContinuousBackupInformation.latestRestorableTimestamp = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedContinuousBackupInformation; + }); + } +} 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..d519e7dbbe717 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ContinuousBackupRestoreLocation.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Properties of the regional restorable account. + */ +@Fluent +public final class ContinuousBackupRestoreLocation implements JsonSerializable { + /* + * The name of the continuous backup restore location. + */ + private String location; + + /** + * Creates an instance of ContinuousBackupRestoreLocation class. + */ + public ContinuousBackupRestoreLocation() { + } + + /** + * 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", this.location); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ContinuousBackupRestoreLocation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ContinuousBackupRestoreLocation if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ContinuousBackupRestoreLocation. + */ + public static ContinuousBackupRestoreLocation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ContinuousBackupRestoreLocation deserializedContinuousBackupRestoreLocation + = new ContinuousBackupRestoreLocation(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("location".equals(fieldName)) { + deserializedContinuousBackupRestoreLocation.location = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedContinuousBackupRestoreLocation; + }); + } +} 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..1ef1ff0715404 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ContinuousModeBackupPolicy.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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The object representing continuous mode backup policy. + */ +@Fluent +public final class ContinuousModeBackupPolicy extends BackupPolicy { + /* + * Describes the mode of backups. + */ + private BackupPolicyType type = BackupPolicyType.CONTINUOUS; + + /* + * Configuration values for continuous mode backup + */ + private ContinuousModeProperties continuousModeProperties; + + /** + * Creates an instance of ContinuousModeBackupPolicy class. + */ + public ContinuousModeBackupPolicy() { + } + + /** + * Get the type property: Describes the mode of backups. + * + * @return the type value. + */ + @Override + public BackupPolicyType type() { + return this.type; + } + + /** + * Get the continuousModeProperties property: Configuration values for continuous mode backup. + * + * @return the continuousModeProperties value. + */ + public ContinuousModeProperties continuousModeProperties() { + return this.continuousModeProperties; + } + + /** + * Set the continuousModeProperties property: Configuration values for continuous mode backup. + * + * @param continuousModeProperties the continuousModeProperties value to set. + * @return the ContinuousModeBackupPolicy object itself. + */ + public ContinuousModeBackupPolicy withContinuousModeProperties(ContinuousModeProperties continuousModeProperties) { + this.continuousModeProperties = continuousModeProperties; + return this; + } + + /** + * {@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() { + if (continuousModeProperties() != null) { + continuousModeProperties().validate(); + } + if (migrationState() != null) { + migrationState().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("migrationState", migrationState()); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeJsonField("continuousModeProperties", this.continuousModeProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ContinuousModeBackupPolicy from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ContinuousModeBackupPolicy if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ContinuousModeBackupPolicy. + */ + public static ContinuousModeBackupPolicy fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ContinuousModeBackupPolicy deserializedContinuousModeBackupPolicy = new ContinuousModeBackupPolicy(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("migrationState".equals(fieldName)) { + deserializedContinuousModeBackupPolicy + .withMigrationState(BackupPolicyMigrationState.fromJson(reader)); + } else if ("type".equals(fieldName)) { + deserializedContinuousModeBackupPolicy.type = BackupPolicyType.fromString(reader.getString()); + } else if ("continuousModeProperties".equals(fieldName)) { + deserializedContinuousModeBackupPolicy.continuousModeProperties + = ContinuousModeProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedContinuousModeBackupPolicy; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ContinuousModeProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ContinuousModeProperties.java new file mode 100644 index 0000000000000..2e535483c8ae0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ContinuousModeProperties.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Configuration values for periodic mode backup. + */ +@Fluent +public final class ContinuousModeProperties implements JsonSerializable { + /* + * Enum to indicate type of Continuous backup mode + */ + private ContinuousTier tier; + + /** + * Creates an instance of ContinuousModeProperties class. + */ + public ContinuousModeProperties() { + } + + /** + * Get the tier property: Enum to indicate type of Continuous backup mode. + * + * @return the tier value. + */ + public ContinuousTier tier() { + return this.tier; + } + + /** + * Set the tier property: Enum to indicate type of Continuous backup mode. + * + * @param tier the tier value to set. + * @return the ContinuousModeProperties object itself. + */ + public ContinuousModeProperties withTier(ContinuousTier tier) { + this.tier = tier; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("tier", this.tier == null ? null : this.tier.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ContinuousModeProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ContinuousModeProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ContinuousModeProperties. + */ + public static ContinuousModeProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ContinuousModeProperties deserializedContinuousModeProperties = new ContinuousModeProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tier".equals(fieldName)) { + deserializedContinuousModeProperties.tier = ContinuousTier.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedContinuousModeProperties; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ContinuousTier.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ContinuousTier.java new file mode 100644 index 0000000000000..9e852c4189656 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ContinuousTier.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.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Enum to indicate type of Continuous backup tier. + */ +public final class ContinuousTier extends ExpandableStringEnum { + /** + * Static value Continuous7Days for ContinuousTier. + */ + public static final ContinuousTier CONTINUOUS7DAYS = fromString("Continuous7Days"); + + /** + * Static value Continuous30Days for ContinuousTier. + */ + public static final ContinuousTier CONTINUOUS30DAYS = fromString("Continuous30Days"); + + /** + * Creates a new instance of ContinuousTier value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ContinuousTier() { + } + + /** + * Creates or finds a ContinuousTier from its string representation. + * + * @param name a name to look for. + * @return the corresponding ContinuousTier. + */ + public static ContinuousTier fromString(String name) { + return fromString(name, ContinuousTier.class); + } + + /** + * Gets known ContinuousTier values. + * + * @return known ContinuousTier values. + */ + public static Collection values() { + return values(ContinuousTier.class); + } +} 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..b865174b0ef9c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CorsPolicy.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The CORS policy for the Cosmos DB database account. + */ +@Fluent +public final class CorsPolicy implements JsonSerializable { + /* + * The origin domains that are permitted to make a request against the service via CORS. + */ + private String allowedOrigins; + + /* + * The methods (HTTP request verbs) that the origin domain may use for a CORS request. + */ + private String allowedMethods; + + /* + * The request headers that the origin domain may specify on the CORS request. + */ + 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. + */ + private String exposedHeaders; + + /* + * The maximum amount time that a browser should cache the preflight OPTIONS request. + */ + private Long maxAgeInSeconds; + + /** + * Creates an instance of CorsPolicy class. + */ + public CorsPolicy() { + } + + /** + * 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.atError() + .log(new IllegalArgumentException("Missing required property allowedOrigins in model CorsPolicy")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CorsPolicy.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("allowedOrigins", this.allowedOrigins); + jsonWriter.writeStringField("allowedMethods", this.allowedMethods); + jsonWriter.writeStringField("allowedHeaders", this.allowedHeaders); + jsonWriter.writeStringField("exposedHeaders", this.exposedHeaders); + jsonWriter.writeNumberField("maxAgeInSeconds", this.maxAgeInSeconds); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CorsPolicy from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CorsPolicy if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CorsPolicy. + */ + public static CorsPolicy fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CorsPolicy deserializedCorsPolicy = new CorsPolicy(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("allowedOrigins".equals(fieldName)) { + deserializedCorsPolicy.allowedOrigins = reader.getString(); + } else if ("allowedMethods".equals(fieldName)) { + deserializedCorsPolicy.allowedMethods = reader.getString(); + } else if ("allowedHeaders".equals(fieldName)) { + deserializedCorsPolicy.allowedHeaders = reader.getString(); + } else if ("exposedHeaders".equals(fieldName)) { + deserializedCorsPolicy.exposedHeaders = reader.getString(); + } else if ("maxAgeInSeconds".equals(fieldName)) { + deserializedCorsPolicy.maxAgeInSeconds = reader.getNullable(JsonReader::getLong); + } else { + reader.skipChildren(); + } + } + + return deserializedCorsPolicy; + }); + } +} 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..6590f2507eea7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CreateMode.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.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Enum to indicate the mode of account creation. + */ +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 a new instance of CreateMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public CreateMode() { + } + + /** + * Creates or finds a CreateMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding CreateMode. + */ + public static CreateMode fromString(String name) { + return fromString(name, CreateMode.class); + } + + /** + * Gets known CreateMode values. + * + * @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..c5002c3021364 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CreateUpdateOptions.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * 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 implements JsonSerializable { + /* + * Request Units per second. For example, "throughput": 10000. + */ + private Integer throughput; + + /* + * Specifies the Autoscale settings. Note: Either throughput or autoscaleSettings is required, but not both. + */ + private AutoscaleSettings autoscaleSettings; + + /** + * Creates an instance of CreateUpdateOptions class. + */ + public CreateUpdateOptions() { + } + + /** + * 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. Note: Either throughput or + * autoscaleSettings is required, but not both. + * + * @return the autoscaleSettings value. + */ + public AutoscaleSettings autoscaleSettings() { + return this.autoscaleSettings; + } + + /** + * Set the autoscaleSettings property: Specifies the Autoscale settings. Note: Either throughput or + * autoscaleSettings is required, but not both. + * + * @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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("throughput", this.throughput); + jsonWriter.writeJsonField("autoscaleSettings", this.autoscaleSettings); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CreateUpdateOptions from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CreateUpdateOptions if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the CreateUpdateOptions. + */ + public static CreateUpdateOptions fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CreateUpdateOptions deserializedCreateUpdateOptions = new CreateUpdateOptions(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("throughput".equals(fieldName)) { + deserializedCreateUpdateOptions.throughput = reader.getNullable(JsonReader::getInt); + } else if ("autoscaleSettings".equals(fieldName)) { + deserializedCreateUpdateOptions.autoscaleSettings = AutoscaleSettings.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCreateUpdateOptions; + }); + } +} 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..33028af728eaf --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DataCenterResource.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * 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..97551ac0a2129 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DataCenterResourceProperties.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.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Properties of a managed Cassandra data center. + */ +@Fluent +public final class DataCenterResourceProperties implements JsonSerializable { + /* + * The status of the resource at the time the operation was called. + */ + private ManagedCassandraProvisioningState provisioningState; + + /* + * The region this data center should be created in. + */ + 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/'. + */ + 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. + */ + 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. + */ + 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. + */ + private String base64EncodedCassandraYamlFragment; + + /* + * Key uri to use for encryption of managed disks. Ensure the system assigned identity of the cluster has been + * assigned appropriate permissions(key get/wrap/unwrap permissions) on the key. + */ + private String managedDiskCustomerKeyUri; + + /* + * Indicates the Key Uri of the customer key to use for encryption of the backup storage account. + */ + private String backupStorageCustomerKeyUri; + + /* + * Virtual Machine SKU used for data centers. Default value is Standard_DS14_v2 + */ + private String sku; + + /* + * Disk SKU used for data centers. Default value is P30. + */ + private String diskSku; + + /* + * Number of disks attached to each node. Default is 4. + */ + private Integer diskCapacity; + + /* + * If the data center has Availability Zone support, apply it to the Virtual Machine ScaleSet that host the + * cassandra data center virtual machines. + */ + private Boolean availabilityZone; + + /* + * Ldap authentication method properties. This feature is in preview. + */ + private AuthenticationMethodLdapProperties authenticationMethodLdapProperties; + + /* + * Whether the data center has been deallocated. + */ + private Boolean deallocated; + + /* + * Error related to resource provisioning. + */ + private CassandraError provisionError; + + /* + * Ip of the VPN Endpoint for this data center. + */ + private String privateEndpointIpAddress; + + /** + * Creates an instance of DataCenterResourceProperties class. + */ + public DataCenterResourceProperties() { + } + + /** + * 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; + } + + /** + * Get the managedDiskCustomerKeyUri property: Key uri to use for encryption of managed disks. Ensure the system + * assigned identity of the cluster has been assigned appropriate permissions(key get/wrap/unwrap permissions) on + * the key. + * + * @return the managedDiskCustomerKeyUri value. + */ + public String managedDiskCustomerKeyUri() { + return this.managedDiskCustomerKeyUri; + } + + /** + * Set the managedDiskCustomerKeyUri property: Key uri to use for encryption of managed disks. Ensure the system + * assigned identity of the cluster has been assigned appropriate permissions(key get/wrap/unwrap permissions) on + * the key. + * + * @param managedDiskCustomerKeyUri the managedDiskCustomerKeyUri value to set. + * @return the DataCenterResourceProperties object itself. + */ + public DataCenterResourceProperties withManagedDiskCustomerKeyUri(String managedDiskCustomerKeyUri) { + this.managedDiskCustomerKeyUri = managedDiskCustomerKeyUri; + return this; + } + + /** + * Get the backupStorageCustomerKeyUri property: Indicates the Key Uri of the customer key to use for encryption of + * the backup storage account. + * + * @return the backupStorageCustomerKeyUri value. + */ + public String backupStorageCustomerKeyUri() { + return this.backupStorageCustomerKeyUri; + } + + /** + * Set the backupStorageCustomerKeyUri property: Indicates the Key Uri of the customer key to use for encryption of + * the backup storage account. + * + * @param backupStorageCustomerKeyUri the backupStorageCustomerKeyUri value to set. + * @return the DataCenterResourceProperties object itself. + */ + public DataCenterResourceProperties withBackupStorageCustomerKeyUri(String backupStorageCustomerKeyUri) { + this.backupStorageCustomerKeyUri = backupStorageCustomerKeyUri; + return this; + } + + /** + * Get the sku property: Virtual Machine SKU used for data centers. Default value is Standard_DS14_v2. + * + * @return the sku value. + */ + public String sku() { + return this.sku; + } + + /** + * Set the sku property: Virtual Machine SKU used for data centers. Default value is Standard_DS14_v2. + * + * @param sku the sku value to set. + * @return the DataCenterResourceProperties object itself. + */ + public DataCenterResourceProperties withSku(String sku) { + this.sku = sku; + return this; + } + + /** + * Get the diskSku property: Disk SKU used for data centers. Default value is P30. + * + * @return the diskSku value. + */ + public String diskSku() { + return this.diskSku; + } + + /** + * Set the diskSku property: Disk SKU used for data centers. Default value is P30. + * + * @param diskSku the diskSku value to set. + * @return the DataCenterResourceProperties object itself. + */ + public DataCenterResourceProperties withDiskSku(String diskSku) { + this.diskSku = diskSku; + return this; + } + + /** + * Get the diskCapacity property: Number of disks attached to each node. Default is 4. + * + * @return the diskCapacity value. + */ + public Integer diskCapacity() { + return this.diskCapacity; + } + + /** + * Set the diskCapacity property: Number of disks attached to each node. Default is 4. + * + * @param diskCapacity the diskCapacity value to set. + * @return the DataCenterResourceProperties object itself. + */ + public DataCenterResourceProperties withDiskCapacity(Integer diskCapacity) { + this.diskCapacity = diskCapacity; + return this; + } + + /** + * Get the availabilityZone property: If the data center has Availability Zone support, apply it to the Virtual + * Machine ScaleSet that host the cassandra data center virtual machines. + * + * @return the availabilityZone value. + */ + public Boolean availabilityZone() { + return this.availabilityZone; + } + + /** + * Set the availabilityZone property: If the data center has Availability Zone support, apply it to the Virtual + * Machine ScaleSet that host the cassandra data center virtual machines. + * + * @param availabilityZone the availabilityZone value to set. + * @return the DataCenterResourceProperties object itself. + */ + public DataCenterResourceProperties withAvailabilityZone(Boolean availabilityZone) { + this.availabilityZone = availabilityZone; + return this; + } + + /** + * Get the authenticationMethodLdapProperties property: Ldap authentication method properties. This feature is in + * preview. + * + * @return the authenticationMethodLdapProperties value. + */ + public AuthenticationMethodLdapProperties authenticationMethodLdapProperties() { + return this.authenticationMethodLdapProperties; + } + + /** + * Set the authenticationMethodLdapProperties property: Ldap authentication method properties. This feature is in + * preview. + * + * @param authenticationMethodLdapProperties the authenticationMethodLdapProperties value to set. + * @return the DataCenterResourceProperties object itself. + */ + public DataCenterResourceProperties + withAuthenticationMethodLdapProperties(AuthenticationMethodLdapProperties authenticationMethodLdapProperties) { + this.authenticationMethodLdapProperties = authenticationMethodLdapProperties; + return this; + } + + /** + * Get the deallocated property: Whether the data center has been deallocated. + * + * @return the deallocated value. + */ + public Boolean deallocated() { + return this.deallocated; + } + + /** + * Set the deallocated property: Whether the data center has been deallocated. + * + * @param deallocated the deallocated value to set. + * @return the DataCenterResourceProperties object itself. + */ + public DataCenterResourceProperties withDeallocated(Boolean deallocated) { + this.deallocated = deallocated; + return this; + } + + /** + * Get the provisionError property: Error related to resource provisioning. + * + * @return the provisionError value. + */ + public CassandraError provisionError() { + return this.provisionError; + } + + /** + * Set the provisionError property: Error related to resource provisioning. + * + * @param provisionError the provisionError value to set. + * @return the DataCenterResourceProperties object itself. + */ + public DataCenterResourceProperties withProvisionError(CassandraError provisionError) { + this.provisionError = provisionError; + return this; + } + + /** + * Get the privateEndpointIpAddress property: Ip of the VPN Endpoint for this data center. + * + * @return the privateEndpointIpAddress value. + */ + public String privateEndpointIpAddress() { + return this.privateEndpointIpAddress; + } + + /** + * Set the privateEndpointIpAddress property: Ip of the VPN Endpoint for this data center. + * + * @param privateEndpointIpAddress the privateEndpointIpAddress value to set. + * @return the DataCenterResourceProperties object itself. + */ + public DataCenterResourceProperties withPrivateEndpointIpAddress(String privateEndpointIpAddress) { + this.privateEndpointIpAddress = privateEndpointIpAddress; + 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()); + } + if (authenticationMethodLdapProperties() != null) { + authenticationMethodLdapProperties().validate(); + } + if (provisionError() != null) { + provisionError().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("provisioningState", + this.provisioningState == null ? null : this.provisioningState.toString()); + jsonWriter.writeStringField("dataCenterLocation", this.dataCenterLocation); + jsonWriter.writeStringField("delegatedSubnetId", this.delegatedSubnetId); + jsonWriter.writeNumberField("nodeCount", this.nodeCount); + jsonWriter.writeStringField("base64EncodedCassandraYamlFragment", this.base64EncodedCassandraYamlFragment); + jsonWriter.writeStringField("managedDiskCustomerKeyUri", this.managedDiskCustomerKeyUri); + jsonWriter.writeStringField("backupStorageCustomerKeyUri", this.backupStorageCustomerKeyUri); + jsonWriter.writeStringField("sku", this.sku); + jsonWriter.writeStringField("diskSku", this.diskSku); + jsonWriter.writeNumberField("diskCapacity", this.diskCapacity); + jsonWriter.writeBooleanField("availabilityZone", this.availabilityZone); + jsonWriter.writeJsonField("authenticationMethodLdapProperties", this.authenticationMethodLdapProperties); + jsonWriter.writeBooleanField("deallocated", this.deallocated); + jsonWriter.writeJsonField("provisionError", this.provisionError); + jsonWriter.writeStringField("privateEndpointIpAddress", this.privateEndpointIpAddress); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DataCenterResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DataCenterResourceProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DataCenterResourceProperties. + */ + public static DataCenterResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DataCenterResourceProperties deserializedDataCenterResourceProperties = new DataCenterResourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedDataCenterResourceProperties.provisioningState + = ManagedCassandraProvisioningState.fromString(reader.getString()); + } else if ("dataCenterLocation".equals(fieldName)) { + deserializedDataCenterResourceProperties.dataCenterLocation = reader.getString(); + } else if ("delegatedSubnetId".equals(fieldName)) { + deserializedDataCenterResourceProperties.delegatedSubnetId = reader.getString(); + } else if ("nodeCount".equals(fieldName)) { + deserializedDataCenterResourceProperties.nodeCount = reader.getNullable(JsonReader::getInt); + } else if ("seedNodes".equals(fieldName)) { + List seedNodes = reader.readArray(reader1 -> SeedNode.fromJson(reader1)); + deserializedDataCenterResourceProperties.seedNodes = seedNodes; + } else if ("base64EncodedCassandraYamlFragment".equals(fieldName)) { + deserializedDataCenterResourceProperties.base64EncodedCassandraYamlFragment = reader.getString(); + } else if ("managedDiskCustomerKeyUri".equals(fieldName)) { + deserializedDataCenterResourceProperties.managedDiskCustomerKeyUri = reader.getString(); + } else if ("backupStorageCustomerKeyUri".equals(fieldName)) { + deserializedDataCenterResourceProperties.backupStorageCustomerKeyUri = reader.getString(); + } else if ("sku".equals(fieldName)) { + deserializedDataCenterResourceProperties.sku = reader.getString(); + } else if ("diskSku".equals(fieldName)) { + deserializedDataCenterResourceProperties.diskSku = reader.getString(); + } else if ("diskCapacity".equals(fieldName)) { + deserializedDataCenterResourceProperties.diskCapacity = reader.getNullable(JsonReader::getInt); + } else if ("availabilityZone".equals(fieldName)) { + deserializedDataCenterResourceProperties.availabilityZone + = reader.getNullable(JsonReader::getBoolean); + } else if ("authenticationMethodLdapProperties".equals(fieldName)) { + deserializedDataCenterResourceProperties.authenticationMethodLdapProperties + = AuthenticationMethodLdapProperties.fromJson(reader); + } else if ("deallocated".equals(fieldName)) { + deserializedDataCenterResourceProperties.deallocated = reader.getNullable(JsonReader::getBoolean); + } else if ("provisionError".equals(fieldName)) { + deserializedDataCenterResourceProperties.provisionError = CassandraError.fromJson(reader); + } else if ("privateEndpointIpAddress".equals(fieldName)) { + deserializedDataCenterResourceProperties.privateEndpointIpAddress = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDataCenterResourceProperties; + }); + } +} 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..3ddece7a35b7a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DataTransferRegionalServiceResource.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.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Resource for a regional service location. + */ +@Immutable +public final class DataTransferRegionalServiceResource extends RegionalServiceResource { + /* + * Describes the status of a service. + */ + private ServiceStatus status; + + /* + * The location name. + */ + private String location; + + /* + * The regional service name. + */ + private String name; + + /** + * Creates an instance of DataTransferRegionalServiceResource class. + */ + public DataTransferRegionalServiceResource() { + } + + /** + * Get the status property: Describes the status of a service. + * + * @return the status value. + */ + @Override + public ServiceStatus status() { + return this.status; + } + + /** + * Get the location property: The location name. + * + * @return the location value. + */ + @Override + public String location() { + return this.location; + } + + /** + * Get the name property: The regional service name. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DataTransferRegionalServiceResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DataTransferRegionalServiceResource if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DataTransferRegionalServiceResource. + */ + public static DataTransferRegionalServiceResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DataTransferRegionalServiceResource deserializedDataTransferRegionalServiceResource + = new DataTransferRegionalServiceResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedDataTransferRegionalServiceResource.name = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedDataTransferRegionalServiceResource.location = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedDataTransferRegionalServiceResource.status + = ServiceStatus.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedDataTransferRegionalServiceResource; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DataTransferServiceResourceCreateUpdateProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DataTransferServiceResourceCreateUpdateProperties.java new file mode 100644 index 0000000000000..65495a4659682 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DataTransferServiceResourceCreateUpdateProperties.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Properties for Create or Update request for DataTransferServiceResource. + */ +@Fluent +public final class DataTransferServiceResourceCreateUpdateProperties extends ServiceResourceCreateUpdateProperties { + /* + * ServiceType for the service. + */ + private ServiceType serviceType = ServiceType.DATA_TRANSFER; + + /** + * Creates an instance of DataTransferServiceResourceCreateUpdateProperties class. + */ + public DataTransferServiceResourceCreateUpdateProperties() { + } + + /** + * Get the serviceType property: ServiceType for the service. + * + * @return the serviceType value. + */ + @Override + public ServiceType serviceType() { + return this.serviceType; + } + + /** + * {@inheritDoc} + */ + @Override + public DataTransferServiceResourceCreateUpdateProperties withInstanceSize(ServiceSize instanceSize) { + super.withInstanceSize(instanceSize); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public DataTransferServiceResourceCreateUpdateProperties withInstanceCount(Integer instanceCount) { + super.withInstanceCount(instanceCount); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("instanceSize", instanceSize() == null ? null : instanceSize().toString()); + jsonWriter.writeNumberField("instanceCount", instanceCount()); + jsonWriter.writeStringField("serviceType", this.serviceType == null ? null : this.serviceType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DataTransferServiceResourceCreateUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DataTransferServiceResourceCreateUpdateProperties if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DataTransferServiceResourceCreateUpdateProperties. + */ + public static DataTransferServiceResourceCreateUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DataTransferServiceResourceCreateUpdateProperties deserializedDataTransferServiceResourceCreateUpdateProperties + = new DataTransferServiceResourceCreateUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("instanceSize".equals(fieldName)) { + deserializedDataTransferServiceResourceCreateUpdateProperties + .withInstanceSize(ServiceSize.fromString(reader.getString())); + } else if ("instanceCount".equals(fieldName)) { + deserializedDataTransferServiceResourceCreateUpdateProperties + .withInstanceCount(reader.getNullable(JsonReader::getInt)); + } else if ("serviceType".equals(fieldName)) { + deserializedDataTransferServiceResourceCreateUpdateProperties.serviceType + = ServiceType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedDataTransferServiceResourceCreateUpdateProperties; + }); + } +} 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..752a66ece76a7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DataTransferServiceResourceProperties.java @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** + * Properties for DataTransferServiceResource. + */ +@Fluent +public final class DataTransferServiceResourceProperties extends ServiceResourceProperties { + /* + * ServiceType for the service. + */ + private ServiceType serviceType = ServiceType.DATA_TRANSFER; + + /* + * An array that contains all of the locations for the service. + */ + private List locations; + + /* + * Describes the status of a service. + */ + private ServiceStatus status; + + /* + * Time of the last state change (ISO-8601 format). + */ + private OffsetDateTime creationTime; + + /** + * Creates an instance of DataTransferServiceResourceProperties class. + */ + public DataTransferServiceResourceProperties() { + } + + /** + * Get the serviceType property: ServiceType for the service. + * + * @return the serviceType value. + */ + @Override + public ServiceType serviceType() { + return this.serviceType; + } + + /** + * 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; + } + + /** + * Get the status property: Describes the status of a service. + * + * @return the status value. + */ + @Override + public ServiceStatus status() { + return this.status; + } + + /** + * Get the creationTime property: Time of the last state change (ISO-8601 format). + * + * @return the creationTime value. + */ + @Override + public OffsetDateTime creationTime() { + return this.creationTime; + } + + /** + * {@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() { + if (locations() != null) { + locations().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("instanceSize", instanceSize() == null ? null : instanceSize().toString()); + jsonWriter.writeNumberField("instanceCount", instanceCount()); + jsonWriter.writeStringField("serviceType", this.serviceType == null ? null : this.serviceType.toString()); + if (additionalProperties() != null) { + for (Map.Entry additionalProperty : additionalProperties().entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DataTransferServiceResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DataTransferServiceResourceProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DataTransferServiceResourceProperties. + */ + public static DataTransferServiceResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DataTransferServiceResourceProperties deserializedDataTransferServiceResourceProperties + = new DataTransferServiceResourceProperties(); + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("creationTime".equals(fieldName)) { + deserializedDataTransferServiceResourceProperties.creationTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("instanceSize".equals(fieldName)) { + deserializedDataTransferServiceResourceProperties + .withInstanceSize(ServiceSize.fromString(reader.getString())); + } else if ("instanceCount".equals(fieldName)) { + deserializedDataTransferServiceResourceProperties + .withInstanceCount(reader.getNullable(JsonReader::getInt)); + } else if ("status".equals(fieldName)) { + deserializedDataTransferServiceResourceProperties.status + = ServiceStatus.fromString(reader.getString()); + } else if ("serviceType".equals(fieldName)) { + deserializedDataTransferServiceResourceProperties.serviceType + = ServiceType.fromString(reader.getString()); + } else if ("locations".equals(fieldName)) { + List locations + = reader.readArray(reader1 -> DataTransferRegionalServiceResource.fromJson(reader1)); + deserializedDataTransferServiceResourceProperties.locations = locations; + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.readUntyped()); + } + } + deserializedDataTransferServiceResourceProperties.withAdditionalProperties(additionalProperties); + + return deserializedDataTransferServiceResourceProperties; + }); + } +} 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..a3df5fbba3f55 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DataType.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.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The datatype for which the indexing behavior is applied to. + */ +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 a new instance of DataType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DataType() { + } + + /** + * Creates or finds a DataType from its string representation. + * + * @param name a name to look for. + * @return the corresponding DataType. + */ + public static DataType fromString(String name) { + return fromString(name, DataType.class); + } + + /** + * Gets known DataType values. + * + * @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..285b94efd1272 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountConnectionString.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Connection string for the Cosmos DB account. + */ +@Immutable +public final class DatabaseAccountConnectionString implements JsonSerializable { + /* + * Value of the connection string + */ + private String connectionString; + + /* + * Description of the connection string + */ + private String description; + + /* + * Kind of the connection string key + */ + private Kind keyKind; + + /* + * Type of the connection string + */ + private Type type; + + /** + * Creates an instance of DatabaseAccountConnectionString class. + */ + public DatabaseAccountConnectionString() { + } + + /** + * 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; + } + + /** + * Get the keyKind property: Kind of the connection string key. + * + * @return the keyKind value. + */ + public Kind keyKind() { + return this.keyKind; + } + + /** + * Get the type property: Type of the connection string. + * + * @return the type value. + */ + public Type type() { + return this.type; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DatabaseAccountConnectionString from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DatabaseAccountConnectionString if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DatabaseAccountConnectionString. + */ + public static DatabaseAccountConnectionString fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DatabaseAccountConnectionString deserializedDatabaseAccountConnectionString + = new DatabaseAccountConnectionString(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("connectionString".equals(fieldName)) { + deserializedDatabaseAccountConnectionString.connectionString = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedDatabaseAccountConnectionString.description = reader.getString(); + } else if ("keyKind".equals(fieldName)) { + deserializedDatabaseAccountConnectionString.keyKind = Kind.fromString(reader.getString()); + } else if ("type".equals(fieldName)) { + deserializedDatabaseAccountConnectionString.type = Type.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedDatabaseAccountConnectionString; + }); + } +} 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..f7dc6aa451953 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountCreateUpdateParameters.java @@ -0,0 +1,1017 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountCreateUpdateProperties; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * Parameters to create and update Cosmos DB database accounts. + */ +@Fluent +public final class DatabaseAccountCreateUpdateParameters extends ArmResourceProperties { + /* + * Indicates the type of database account. This can only be set at database account creation. + */ + private DatabaseAccountKind kind; + + /* + * Identity for the resource. + */ + private ManagedServiceIdentity identity; + + /* + * Properties to create and update Azure Cosmos DB database accounts. + */ + private DatabaseAccountCreateUpdateProperties innerProperties = new DatabaseAccountCreateUpdateProperties(); + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of DatabaseAccountCreateUpdateParameters class. + */ + public DatabaseAccountCreateUpdateParameters() { + } + + /** + * 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 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 DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + 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; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@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 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; + } + + /** + * Get the capacity property: The object that represents all properties related to capacity enforcement on an + * account. + * + * @return the capacity value. + */ + public Capacity capacity() { + return this.innerProperties() == null ? null : this.innerProperties().capacity(); + } + + /** + * Set the capacity property: The object that represents all properties related to capacity enforcement on an + * account. + * + * @param capacity the capacity value to set. + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withCapacity(Capacity capacity) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountCreateUpdateProperties(); + } + this.innerProperties().withCapacity(capacity); + return this; + } + + /** + * Get the keysMetadata property: This property is ignored during the update/create operation, as the metadata is + * read-only. The object represents the metadata for the Account Keys of the Cosmos DB account. + * + * @return the keysMetadata value. + */ + public DatabaseAccountKeysMetadata keysMetadata() { + return this.innerProperties() == null ? null : this.innerProperties().keysMetadata(); + } + + /** + * Get the enablePartitionMerge property: Flag to indicate enabling/disabling of Partition Merge feature on the + * account. + * + * @return the enablePartitionMerge value. + */ + public Boolean enablePartitionMerge() { + return this.innerProperties() == null ? null : this.innerProperties().enablePartitionMerge(); + } + + /** + * Set the enablePartitionMerge property: Flag to indicate enabling/disabling of Partition Merge feature on the + * account. + * + * @param enablePartitionMerge the enablePartitionMerge value to set. + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withEnablePartitionMerge(Boolean enablePartitionMerge) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountCreateUpdateProperties(); + } + this.innerProperties().withEnablePartitionMerge(enablePartitionMerge); + return this; + } + + /** + * Get the minimalTlsVersion property: Indicates the minimum allowed Tls version. The default value is Tls 1.2. + * Cassandra and Mongo APIs only work with Tls 1.2. + * + * @return the minimalTlsVersion value. + */ + public MinimalTlsVersion minimalTlsVersion() { + return this.innerProperties() == null ? null : this.innerProperties().minimalTlsVersion(); + } + + /** + * Set the minimalTlsVersion property: Indicates the minimum allowed Tls version. The default value is Tls 1.2. + * Cassandra and Mongo APIs only work with Tls 1.2. + * + * @param minimalTlsVersion the minimalTlsVersion value to set. + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withMinimalTlsVersion(MinimalTlsVersion minimalTlsVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountCreateUpdateProperties(); + } + this.innerProperties().withMinimalTlsVersion(minimalTlsVersion); + return this; + } + + /** + * Get the enableBurstCapacity property: Flag to indicate enabling/disabling of Burst Capacity feature on the + * account. + * + * @return the enableBurstCapacity value. + */ + public Boolean enableBurstCapacity() { + return this.innerProperties() == null ? null : this.innerProperties().enableBurstCapacity(); + } + + /** + * Set the enableBurstCapacity property: Flag to indicate enabling/disabling of Burst Capacity feature on the + * account. + * + * @param enableBurstCapacity the enableBurstCapacity value to set. + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withEnableBurstCapacity(Boolean enableBurstCapacity) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountCreateUpdateProperties(); + } + this.innerProperties().withEnableBurstCapacity(enableBurstCapacity); + return this; + } + + /** + * Get the customerManagedKeyStatus property: Indicates the status of the Customer Managed Key feature on the + * account. In case there are errors, the property provides troubleshooting guidance. + * + * @return the customerManagedKeyStatus value. + */ + public String customerManagedKeyStatus() { + return this.innerProperties() == null ? null : this.innerProperties().customerManagedKeyStatus(); + } + + /** + * Set the customerManagedKeyStatus property: Indicates the status of the Customer Managed Key feature on the + * account. In case there are errors, the property provides troubleshooting guidance. + * + * @param customerManagedKeyStatus the customerManagedKeyStatus value to set. + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withCustomerManagedKeyStatus(String customerManagedKeyStatus) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountCreateUpdateProperties(); + } + this.innerProperties().withCustomerManagedKeyStatus(customerManagedKeyStatus); + return this; + } + + /** + * Get the enablePerRegionPerPartitionAutoscale property: Flag to indicate enabling/disabling of + * PerRegionPerPartitionAutoscale feature on the account. + * + * @return the enablePerRegionPerPartitionAutoscale value. + */ + public Boolean enablePerRegionPerPartitionAutoscale() { + return this.innerProperties() == null ? null : this.innerProperties().enablePerRegionPerPartitionAutoscale(); + } + + /** + * Set the enablePerRegionPerPartitionAutoscale property: Flag to indicate enabling/disabling of + * PerRegionPerPartitionAutoscale feature on the account. + * + * @param enablePerRegionPerPartitionAutoscale the enablePerRegionPerPartitionAutoscale value to set. + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters + withEnablePerRegionPerPartitionAutoscale(Boolean enablePerRegionPerPartitionAutoscale) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountCreateUpdateProperties(); + } + this.innerProperties().withEnablePerRegionPerPartitionAutoscale(enablePerRegionPerPartitionAutoscale); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (identity() != null) { + identity().validate(); + } + if (innerProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property innerProperties in model DatabaseAccountCreateUpdateParameters")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DatabaseAccountCreateUpdateParameters.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("identity", this.identity); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DatabaseAccountCreateUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DatabaseAccountCreateUpdateParameters if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DatabaseAccountCreateUpdateParameters. + */ + public static DatabaseAccountCreateUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DatabaseAccountCreateUpdateParameters deserializedDatabaseAccountCreateUpdateParameters + = new DatabaseAccountCreateUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedDatabaseAccountCreateUpdateParameters.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedDatabaseAccountCreateUpdateParameters.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedDatabaseAccountCreateUpdateParameters.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedDatabaseAccountCreateUpdateParameters.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedDatabaseAccountCreateUpdateParameters.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedDatabaseAccountCreateUpdateParameters.innerProperties + = DatabaseAccountCreateUpdateProperties.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedDatabaseAccountCreateUpdateParameters.kind + = DatabaseAccountKind.fromString(reader.getString()); + } else if ("identity".equals(fieldName)) { + deserializedDatabaseAccountCreateUpdateParameters.identity + = ManagedServiceIdentity.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDatabaseAccountCreateUpdateParameters; + }); + } +} 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..fa0367087bf19 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountGetResults.java @@ -0,0 +1,1621 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 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 identity property: Identity for the resource. + * + * @return the identity value. + */ + ManagedServiceIdentity identity(); + + /** + * 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 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 capacity property: The object that represents all properties related to capacity enforcement on an + * account. + * + * @return the capacity value. + */ + Capacity capacity(); + + /** + * Gets the keysMetadata property: The object that represents the metadata for the Account Keys of the Cosmos DB + * account. + * + * @return the keysMetadata value. + */ + DatabaseAccountKeysMetadata keysMetadata(); + + /** + * Gets the enablePartitionMerge property: Flag to indicate enabling/disabling of Partition Merge feature on the + * account. + * + * @return the enablePartitionMerge value. + */ + Boolean enablePartitionMerge(); + + /** + * Gets the minimalTlsVersion property: Indicates the minimum allowed Tls version. The default value is Tls 1.2. + * Cassandra and Mongo APIs only work with Tls 1.2. + * + * @return the minimalTlsVersion value. + */ + MinimalTlsVersion minimalTlsVersion(); + + /** + * Gets the enableBurstCapacity property: Flag to indicate enabling/disabling of Burst Capacity feature on the + * account. + * + * @return the enableBurstCapacity value. + */ + Boolean enableBurstCapacity(); + + /** + * Gets the customerManagedKeyStatus property: Indicates the status of the Customer Managed Key feature on the + * account. In case there are errors, the property provides troubleshooting guidance. + * + * @return the customerManagedKeyStatus value. + */ + String customerManagedKeyStatus(); + + /** + * Gets the enablePerRegionPerPartitionAutoscale property: Flag to indicate enabling/disabling of + * PerRegionPerPartitionAutoscale feature on the account. + * + * @return the enablePerRegionPerPartitionAutoscale value. + */ + Boolean enablePerRegionPerPartitionAutoscale(); + + /** + * 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 name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * 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.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. + */ + WithCreate withLocations(List locations); + } + + /** + * 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.WithKind, + DefinitionStages.WithIdentity, 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.WithCreateMode, + DefinitionStages.WithBackupPolicy, DefinitionStages.WithCors, DefinitionStages.WithNetworkAclBypass, + DefinitionStages.WithNetworkAclBypassResourceIds, DefinitionStages.WithDisableLocalAuth, + DefinitionStages.WithRestoreParameters, DefinitionStages.WithCapacity, + DefinitionStages.WithEnablePartitionMerge, DefinitionStages.WithMinimalTlsVersion, + DefinitionStages.WithEnableBurstCapacity, DefinitionStages.WithCustomerManagedKeyStatus, + DefinitionStages.WithEnablePerRegionPerPartitionAutoscale { + /** + * 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 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 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 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 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 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 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); + } + + /** + * The stage of the DatabaseAccountGetResults definition allowing to specify capacity. + */ + interface WithCapacity { + /** + * Specifies the capacity property: The object that represents all properties related to capacity + * enforcement on an account.. + * + * @param capacity The object that represents all properties related to capacity enforcement on an account. + * @return the next definition stage. + */ + WithCreate withCapacity(Capacity capacity); + } + + /** + * The stage of the DatabaseAccountGetResults definition allowing to specify enablePartitionMerge. + */ + interface WithEnablePartitionMerge { + /** + * Specifies the enablePartitionMerge property: Flag to indicate enabling/disabling of Partition Merge + * feature on the account. + * + * @param enablePartitionMerge Flag to indicate enabling/disabling of Partition Merge feature on the + * account. + * @return the next definition stage. + */ + WithCreate withEnablePartitionMerge(Boolean enablePartitionMerge); + } + + /** + * The stage of the DatabaseAccountGetResults definition allowing to specify minimalTlsVersion. + */ + interface WithMinimalTlsVersion { + /** + * Specifies the minimalTlsVersion property: Indicates the minimum allowed Tls version. The default value is + * Tls 1.2. Cassandra and Mongo APIs only work with Tls 1.2.. + * + * @param minimalTlsVersion Indicates the minimum allowed Tls version. The default value is Tls 1.2. + * Cassandra and Mongo APIs only work with Tls 1.2. + * @return the next definition stage. + */ + WithCreate withMinimalTlsVersion(MinimalTlsVersion minimalTlsVersion); + } + + /** + * The stage of the DatabaseAccountGetResults definition allowing to specify enableBurstCapacity. + */ + interface WithEnableBurstCapacity { + /** + * Specifies the enableBurstCapacity property: Flag to indicate enabling/disabling of Burst Capacity feature + * on the account. + * + * @param enableBurstCapacity Flag to indicate enabling/disabling of Burst Capacity feature on the account. + * @return the next definition stage. + */ + WithCreate withEnableBurstCapacity(Boolean enableBurstCapacity); + } + + /** + * The stage of the DatabaseAccountGetResults definition allowing to specify customerManagedKeyStatus. + */ + interface WithCustomerManagedKeyStatus { + /** + * Specifies the customerManagedKeyStatus property: Indicates the status of the Customer Managed Key feature + * on the account. In case there are errors, the property provides troubleshooting guidance.. + * + * @param customerManagedKeyStatus Indicates the status of the Customer Managed Key feature on the account. + * In case there are errors, the property provides troubleshooting guidance. + * @return the next definition stage. + */ + WithCreate withCustomerManagedKeyStatus(String customerManagedKeyStatus); + } + + /** + * The stage of the DatabaseAccountGetResults definition allowing to specify + * enablePerRegionPerPartitionAutoscale. + */ + interface WithEnablePerRegionPerPartitionAutoscale { + /** + * Specifies the enablePerRegionPerPartitionAutoscale property: Flag to indicate enabling/disabling of + * PerRegionPerPartitionAutoscale feature on the account. + * + * @param enablePerRegionPerPartitionAutoscale Flag to indicate enabling/disabling of + * PerRegionPerPartitionAutoscale feature on the account. + * @return the next definition stage. + */ + WithCreate withEnablePerRegionPerPartitionAutoscale(Boolean enablePerRegionPerPartitionAutoscale); + } + } + + /** + * 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.WithDisableLocalAuth, UpdateStages.WithCapacity, UpdateStages.WithEnablePartitionMerge, + UpdateStages.WithMinimalTlsVersion, UpdateStages.WithEnableBurstCapacity, + UpdateStages.WithCustomerManagedKeyStatus, UpdateStages.WithEnablePerRegionPerPartitionAutoscale { + /** + * 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 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); + } + + /** + * The stage of the DatabaseAccountGetResults update allowing to specify capacity. + */ + interface WithCapacity { + /** + * Specifies the capacity property: The object that represents all properties related to capacity + * enforcement on an account.. + * + * @param capacity The object that represents all properties related to capacity enforcement on an account. + * @return the next definition stage. + */ + Update withCapacity(Capacity capacity); + } + + /** + * The stage of the DatabaseAccountGetResults update allowing to specify enablePartitionMerge. + */ + interface WithEnablePartitionMerge { + /** + * Specifies the enablePartitionMerge property: Flag to indicate enabling/disabling of Partition Merge + * feature on the account. + * + * @param enablePartitionMerge Flag to indicate enabling/disabling of Partition Merge feature on the + * account. + * @return the next definition stage. + */ + Update withEnablePartitionMerge(Boolean enablePartitionMerge); + } + + /** + * The stage of the DatabaseAccountGetResults update allowing to specify minimalTlsVersion. + */ + interface WithMinimalTlsVersion { + /** + * Specifies the minimalTlsVersion property: Indicates the minimum allowed Tls version. The default value is + * Tls 1.2. Cassandra and Mongo APIs only work with Tls 1.2.. + * + * @param minimalTlsVersion Indicates the minimum allowed Tls version. The default value is Tls 1.2. + * Cassandra and Mongo APIs only work with Tls 1.2. + * @return the next definition stage. + */ + Update withMinimalTlsVersion(MinimalTlsVersion minimalTlsVersion); + } + + /** + * The stage of the DatabaseAccountGetResults update allowing to specify enableBurstCapacity. + */ + interface WithEnableBurstCapacity { + /** + * Specifies the enableBurstCapacity property: Flag to indicate enabling/disabling of Burst Capacity feature + * on the account. + * + * @param enableBurstCapacity Flag to indicate enabling/disabling of Burst Capacity feature on the account. + * @return the next definition stage. + */ + Update withEnableBurstCapacity(Boolean enableBurstCapacity); + } + + /** + * The stage of the DatabaseAccountGetResults update allowing to specify customerManagedKeyStatus. + */ + interface WithCustomerManagedKeyStatus { + /** + * Specifies the customerManagedKeyStatus property: Indicates the status of the Customer Managed Key feature + * on the account. In case there are errors, the property provides troubleshooting guidance.. + * + * @param customerManagedKeyStatus Indicates the status of the Customer Managed Key feature on the account. + * In case there are errors, the property provides troubleshooting guidance. + * @return the next definition stage. + */ + Update withCustomerManagedKeyStatus(String customerManagedKeyStatus); + } + + /** + * The stage of the DatabaseAccountGetResults update allowing to specify enablePerRegionPerPartitionAutoscale. + */ + interface WithEnablePerRegionPerPartitionAutoscale { + /** + * Specifies the enablePerRegionPerPartitionAutoscale property: Flag to indicate enabling/disabling of + * PerRegionPerPartitionAutoscale feature on the account. + * + * @param enablePerRegionPerPartitionAutoscale Flag to indicate enabling/disabling of + * PerRegionPerPartitionAutoscale feature on the account. + * @return the next definition stage. + */ + Update withEnablePerRegionPerPartitionAutoscale(Boolean enablePerRegionPerPartitionAutoscale); + } + } + + /** + * 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. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + Response listKeysWithResponse(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 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 along with {@link Response}. + */ + Response listConnectionStringsWithResponse(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(); + + /** + * 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. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + Response listReadOnlyKeysWithResponse(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(); + + /** + * 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/DatabaseAccountKeysMetadata.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountKeysMetadata.java new file mode 100644 index 0000000000000..71321ef6332f8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountKeysMetadata.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The metadata related to each access key for the given Cosmos DB database account. + */ +@Immutable +public final class DatabaseAccountKeysMetadata implements JsonSerializable { + /* + * The metadata related to the Primary Read-Write Key for the given Cosmos DB database account. + */ + private AccountKeyMetadata primaryMasterKey; + + /* + * The metadata related to the Secondary Read-Write Key for the given Cosmos DB database account. + */ + private AccountKeyMetadata secondaryMasterKey; + + /* + * The metadata related to the Primary Read-Only Key for the given Cosmos DB database account. + */ + private AccountKeyMetadata primaryReadonlyMasterKey; + + /* + * The metadata related to the Secondary Read-Only Key for the given Cosmos DB database account. + */ + private AccountKeyMetadata secondaryReadonlyMasterKey; + + /** + * Creates an instance of DatabaseAccountKeysMetadata class. + */ + public DatabaseAccountKeysMetadata() { + } + + /** + * Get the primaryMasterKey property: The metadata related to the Primary Read-Write Key for the given Cosmos DB + * database account. + * + * @return the primaryMasterKey value. + */ + public AccountKeyMetadata primaryMasterKey() { + return this.primaryMasterKey; + } + + /** + * Get the secondaryMasterKey property: The metadata related to the Secondary Read-Write Key for the given Cosmos DB + * database account. + * + * @return the secondaryMasterKey value. + */ + public AccountKeyMetadata secondaryMasterKey() { + return this.secondaryMasterKey; + } + + /** + * Get the primaryReadonlyMasterKey property: The metadata related to the Primary Read-Only Key for the given Cosmos + * DB database account. + * + * @return the primaryReadonlyMasterKey value. + */ + public AccountKeyMetadata primaryReadonlyMasterKey() { + return this.primaryReadonlyMasterKey; + } + + /** + * Get the secondaryReadonlyMasterKey property: The metadata related to the Secondary Read-Only Key for the given + * Cosmos DB database account. + * + * @return the secondaryReadonlyMasterKey value. + */ + public AccountKeyMetadata secondaryReadonlyMasterKey() { + return this.secondaryReadonlyMasterKey; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (primaryMasterKey() != null) { + primaryMasterKey().validate(); + } + if (secondaryMasterKey() != null) { + secondaryMasterKey().validate(); + } + if (primaryReadonlyMasterKey() != null) { + primaryReadonlyMasterKey().validate(); + } + if (secondaryReadonlyMasterKey() != null) { + secondaryReadonlyMasterKey().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DatabaseAccountKeysMetadata from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DatabaseAccountKeysMetadata if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DatabaseAccountKeysMetadata. + */ + public static DatabaseAccountKeysMetadata fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DatabaseAccountKeysMetadata deserializedDatabaseAccountKeysMetadata = new DatabaseAccountKeysMetadata(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("primaryMasterKey".equals(fieldName)) { + deserializedDatabaseAccountKeysMetadata.primaryMasterKey = AccountKeyMetadata.fromJson(reader); + } else if ("secondaryMasterKey".equals(fieldName)) { + deserializedDatabaseAccountKeysMetadata.secondaryMasterKey = AccountKeyMetadata.fromJson(reader); + } else if ("primaryReadonlyMasterKey".equals(fieldName)) { + deserializedDatabaseAccountKeysMetadata.primaryReadonlyMasterKey + = AccountKeyMetadata.fromJson(reader); + } else if ("secondaryReadonlyMasterKey".equals(fieldName)) { + deserializedDatabaseAccountKeysMetadata.secondaryReadonlyMasterKey + = AccountKeyMetadata.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDatabaseAccountKeysMetadata; + }); + } +} 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..84069c94e69b8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountKind.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.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Indicates the type of database account. This can only be set at database account creation. + */ +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 a new instance of DatabaseAccountKind value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DatabaseAccountKind() { + } + + /** + * Creates or finds a DatabaseAccountKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding DatabaseAccountKind. + */ + public static DatabaseAccountKind fromString(String name) { + return fromString(name, DatabaseAccountKind.class); + } + + /** + * Gets known DatabaseAccountKind values. + * + * @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..8f1458be35526 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountListConnectionStringsResult.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.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..d97ceb12cabd1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountListKeysResult.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.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..ee9b8a2333b5a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountListReadOnlyKeysResult.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.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..c779a92e89d17 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountOfferType.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; + +/** + * The offer type for the Cosmos DB database account. + */ +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. + */ + public static DatabaseAccountOfferType fromString(String value) { + if (value == null) { + return null; + } + DatabaseAccountOfferType[] items = DatabaseAccountOfferType.values(); + for (DatabaseAccountOfferType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @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..c84e4e39d6a96 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountRegenerateKeyParameters.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.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Parameters to regenerate the keys within the database account. + */ +@Fluent +public final class DatabaseAccountRegenerateKeyParameters + implements JsonSerializable { + /* + * The access key to regenerate. + */ + private KeyKind keyKind; + + /** + * Creates an instance of DatabaseAccountRegenerateKeyParameters class. + */ + public DatabaseAccountRegenerateKeyParameters() { + } + + /** + * 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.atError() + .log(new IllegalArgumentException( + "Missing required property keyKind in model DatabaseAccountRegenerateKeyParameters")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DatabaseAccountRegenerateKeyParameters.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("keyKind", this.keyKind == null ? null : this.keyKind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DatabaseAccountRegenerateKeyParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DatabaseAccountRegenerateKeyParameters if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DatabaseAccountRegenerateKeyParameters. + */ + public static DatabaseAccountRegenerateKeyParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DatabaseAccountRegenerateKeyParameters deserializedDatabaseAccountRegenerateKeyParameters + = new DatabaseAccountRegenerateKeyParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("keyKind".equals(fieldName)) { + deserializedDatabaseAccountRegenerateKeyParameters.keyKind = KeyKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedDatabaseAccountRegenerateKeyParameters; + }); + } +} 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..6ec79b5d88f57 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountRegions.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.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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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..ed4d1fc21912e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountUpdateParameters.java @@ -0,0 +1,900 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountUpdateProperties; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * Parameters for patching Azure Cosmos DB database account properties. + */ +@Fluent +public final class DatabaseAccountUpdateParameters implements JsonSerializable { + /* + * 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". + */ + private Map tags; + + /* + * The location of the resource group to which the resource belongs. + */ + private String location; + + /* + * Identity for the resource. + */ + private ManagedServiceIdentity identity; + + /* + * Properties to update Azure Cosmos DB database accounts. + */ + private DatabaseAccountUpdateProperties innerProperties; + + /** + * Creates an instance of DatabaseAccountUpdateParameters class. + */ + public DatabaseAccountUpdateParameters() { + } + + /** + * 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 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; + } + + /** + * Get the capacity property: The object that represents all properties related to capacity enforcement on an + * account. + * + * @return the capacity value. + */ + public Capacity capacity() { + return this.innerProperties() == null ? null : this.innerProperties().capacity(); + } + + /** + * Set the capacity property: The object that represents all properties related to capacity enforcement on an + * account. + * + * @param capacity the capacity value to set. + * @return the DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters withCapacity(Capacity capacity) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountUpdateProperties(); + } + this.innerProperties().withCapacity(capacity); + return this; + } + + /** + * Get the keysMetadata property: This property is ignored during the update operation, as the metadata is + * read-only. The object represents the metadata for the Account Keys of the Cosmos DB account. + * + * @return the keysMetadata value. + */ + public DatabaseAccountKeysMetadata keysMetadata() { + return this.innerProperties() == null ? null : this.innerProperties().keysMetadata(); + } + + /** + * Get the enablePartitionMerge property: Flag to indicate enabling/disabling of Partition Merge feature on the + * account. + * + * @return the enablePartitionMerge value. + */ + public Boolean enablePartitionMerge() { + return this.innerProperties() == null ? null : this.innerProperties().enablePartitionMerge(); + } + + /** + * Set the enablePartitionMerge property: Flag to indicate enabling/disabling of Partition Merge feature on the + * account. + * + * @param enablePartitionMerge the enablePartitionMerge value to set. + * @return the DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters withEnablePartitionMerge(Boolean enablePartitionMerge) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountUpdateProperties(); + } + this.innerProperties().withEnablePartitionMerge(enablePartitionMerge); + return this; + } + + /** + * Get the minimalTlsVersion property: Indicates the minimum allowed Tls version. The default value is Tls 1.2. + * Cassandra and Mongo APIs only work with Tls 1.2. + * + * @return the minimalTlsVersion value. + */ + public MinimalTlsVersion minimalTlsVersion() { + return this.innerProperties() == null ? null : this.innerProperties().minimalTlsVersion(); + } + + /** + * Set the minimalTlsVersion property: Indicates the minimum allowed Tls version. The default value is Tls 1.2. + * Cassandra and Mongo APIs only work with Tls 1.2. + * + * @param minimalTlsVersion the minimalTlsVersion value to set. + * @return the DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters withMinimalTlsVersion(MinimalTlsVersion minimalTlsVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountUpdateProperties(); + } + this.innerProperties().withMinimalTlsVersion(minimalTlsVersion); + return this; + } + + /** + * Get the enableBurstCapacity property: Flag to indicate enabling/disabling of Burst Capacity feature on the + * account. + * + * @return the enableBurstCapacity value. + */ + public Boolean enableBurstCapacity() { + return this.innerProperties() == null ? null : this.innerProperties().enableBurstCapacity(); + } + + /** + * Set the enableBurstCapacity property: Flag to indicate enabling/disabling of Burst Capacity feature on the + * account. + * + * @param enableBurstCapacity the enableBurstCapacity value to set. + * @return the DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters withEnableBurstCapacity(Boolean enableBurstCapacity) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountUpdateProperties(); + } + this.innerProperties().withEnableBurstCapacity(enableBurstCapacity); + return this; + } + + /** + * Get the customerManagedKeyStatus property: Indicates the status of the Customer Managed Key feature on the + * account. In case there are errors, the property provides troubleshooting guidance. + * + * @return the customerManagedKeyStatus value. + */ + public String customerManagedKeyStatus() { + return this.innerProperties() == null ? null : this.innerProperties().customerManagedKeyStatus(); + } + + /** + * Set the customerManagedKeyStatus property: Indicates the status of the Customer Managed Key feature on the + * account. In case there are errors, the property provides troubleshooting guidance. + * + * @param customerManagedKeyStatus the customerManagedKeyStatus value to set. + * @return the DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters withCustomerManagedKeyStatus(String customerManagedKeyStatus) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountUpdateProperties(); + } + this.innerProperties().withCustomerManagedKeyStatus(customerManagedKeyStatus); + return this; + } + + /** + * Get the enablePerRegionPerPartitionAutoscale property: Flag to indicate enabling/disabling of + * PerRegionPerPartitionAutoscale feature on the account. + * + * @return the enablePerRegionPerPartitionAutoscale value. + */ + public Boolean enablePerRegionPerPartitionAutoscale() { + return this.innerProperties() == null ? null : this.innerProperties().enablePerRegionPerPartitionAutoscale(); + } + + /** + * Set the enablePerRegionPerPartitionAutoscale property: Flag to indicate enabling/disabling of + * PerRegionPerPartitionAutoscale feature on the account. + * + * @param enablePerRegionPerPartitionAutoscale the enablePerRegionPerPartitionAutoscale value to set. + * @return the DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters + withEnablePerRegionPerPartitionAutoscale(Boolean enablePerRegionPerPartitionAutoscale) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountUpdateProperties(); + } + this.innerProperties().withEnablePerRegionPerPartitionAutoscale(enablePerRegionPerPartitionAutoscale); + 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("location", this.location); + jsonWriter.writeJsonField("identity", this.identity); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DatabaseAccountUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DatabaseAccountUpdateParameters if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DatabaseAccountUpdateParameters. + */ + public static DatabaseAccountUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DatabaseAccountUpdateParameters deserializedDatabaseAccountUpdateParameters + = new DatabaseAccountUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedDatabaseAccountUpdateParameters.tags = tags; + } else if ("location".equals(fieldName)) { + deserializedDatabaseAccountUpdateParameters.location = reader.getString(); + } else if ("identity".equals(fieldName)) { + deserializedDatabaseAccountUpdateParameters.identity = ManagedServiceIdentity.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedDatabaseAccountUpdateParameters.innerProperties + = DatabaseAccountUpdateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDatabaseAccountUpdateParameters; + }); + } +} 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..8b771bb0289e6 --- /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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the 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 along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String accountName, + 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 com.azure.core.management.exception.ManagementException thrown if the 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); + + /** + * 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 as paginated + * response with {@link PagedIterable}. + */ + 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 as paginated + * response with {@link PagedIterable}. + */ + 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 as paginated + * response with {@link PagedIterable}. + */ + 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 as paginated + * response with {@link PagedIterable}. + */ + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + Response listKeysWithResponse(String resourceGroupName, String accountName, + 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 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 along with {@link Response}. + */ + Response listConnectionStringsWithResponse(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); + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + 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 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 along with {@link Response}. + */ + Response listReadOnlyKeysWithResponse(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); + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 along with {@link Response}. + */ + Response checkNameExistsWithResponse(String accountName, 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); + + /** + * 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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..4cb36ec1a13eb --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountsListResult.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountGetResultsInner; +import java.io.IOException; +import java.util.List; + +/** + * The List operation response, that contains the database accounts and their properties. + */ +@Immutable +public final class DatabaseAccountsListResult implements JsonSerializable { + /* + * List of database account and their properties. + */ + private List value; + + /** + * Creates an instance of DatabaseAccountsListResult class. + */ + public DatabaseAccountsListResult() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DatabaseAccountsListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DatabaseAccountsListResult if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DatabaseAccountsListResult. + */ + public static DatabaseAccountsListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DatabaseAccountsListResult deserializedDatabaseAccountsListResult = new DatabaseAccountsListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> DatabaseAccountGetResultsInner.fromJson(reader1)); + deserializedDatabaseAccountsListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedDatabaseAccountsListResult; + }); + } +} 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..8352fff5f8bc9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseRestoreResource.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Specific Databases to restore. + */ +@Fluent +public final class DatabaseRestoreResource implements JsonSerializable { + /* + * The name of the database available for restore. + */ + private String databaseName; + + /* + * The names of the collections available for restore. + */ + private List collectionNames; + + /** + * Creates an instance of DatabaseRestoreResource class. + */ + public DatabaseRestoreResource() { + } + + /** + * 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 DatabaseRestoreResource object itself. + */ + public DatabaseRestoreResource 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 DatabaseRestoreResource object itself. + */ + public DatabaseRestoreResource withCollectionNames(List collectionNames) { + this.collectionNames = collectionNames; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("databaseName", this.databaseName); + jsonWriter.writeArrayField("collectionNames", this.collectionNames, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DatabaseRestoreResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DatabaseRestoreResource if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the DatabaseRestoreResource. + */ + public static DatabaseRestoreResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DatabaseRestoreResource deserializedDatabaseRestoreResource = new DatabaseRestoreResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("databaseName".equals(fieldName)) { + deserializedDatabaseRestoreResource.databaseName = reader.getString(); + } else if ("collectionNames".equals(fieldName)) { + List collectionNames = reader.readArray(reader1 -> reader1.getString()); + deserializedDatabaseRestoreResource.collectionNames = collectionNames; + } else { + reader.skipChildren(); + } + } + + return deserializedDatabaseRestoreResource; + }); + } +} 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..733d5de80e3c2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Databases.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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/DedicatedGatewayType.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DedicatedGatewayType.java new file mode 100644 index 0000000000000..833e0ca76a931 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DedicatedGatewayType.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.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * DedicatedGatewayType for the service. + */ +public final class DedicatedGatewayType extends ExpandableStringEnum { + /** + * Static value IntegratedCache for DedicatedGatewayType. + */ + public static final DedicatedGatewayType INTEGRATED_CACHE = fromString("IntegratedCache"); + + /** + * Static value DistributedQuery for DedicatedGatewayType. + */ + public static final DedicatedGatewayType DISTRIBUTED_QUERY = fromString("DistributedQuery"); + + /** + * Creates a new instance of DedicatedGatewayType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DedicatedGatewayType() { + } + + /** + * Creates or finds a DedicatedGatewayType from its string representation. + * + * @param name a name to look for. + * @return the corresponding DedicatedGatewayType. + */ + public static DedicatedGatewayType fromString(String name) { + return fromString(name, DedicatedGatewayType.class); + } + + /** + * Gets known DedicatedGatewayType values. + * + * @return known DedicatedGatewayType values. + */ + public static Collection values() { + return values(DedicatedGatewayType.class); + } +} 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..6c3bef4d774f0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DefaultConsistencyLevel.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.models; + +/** + * The default consistency level and configuration settings of the Cosmos DB account. + */ +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. + */ + public static DefaultConsistencyLevel fromString(String value) { + if (value == null) { + return null; + } + DefaultConsistencyLevel[] items = DefaultConsistencyLevel.values(); + for (DefaultConsistencyLevel item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @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..a2796c8653700 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ExcludedPath.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ExcludedPath model. + */ +@Fluent +public final class ExcludedPath implements JsonSerializable { + /* + * The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard + * (/path/*) + */ + private String path; + + /** + * Creates an instance of ExcludedPath class. + */ + public ExcludedPath() { + } + + /** + * 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("path", this.path); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExcludedPath from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExcludedPath if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ExcludedPath. + */ + public static ExcludedPath fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ExcludedPath deserializedExcludedPath = new ExcludedPath(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("path".equals(fieldName)) { + deserializedExcludedPath.path = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedExcludedPath; + }); + } +} 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..9088d4fd39e15 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ExtendedResourceProperties.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.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The system generated resource properties associated with SQL databases, SQL containers, Gremlin databases and Gremlin + * graphs. + */ +@Immutable +public class ExtendedResourceProperties implements JsonSerializable { + /* + * A system generated property. A unique identifier. + */ + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of the resource. + */ + private Float ts; + + /* + * A system generated property representing the resource etag required for optimistic concurrency control. + */ + private String etag; + + /** + * Creates an instance of ExtendedResourceProperties class. + */ + public ExtendedResourceProperties() { + } + + /** + * Get the rid property: A system generated property. A unique identifier. + * + * @return the rid value. + */ + public String rid() { + return this.rid; + } + + /** + * Set the rid property: A system generated property. A unique identifier. + * + * @param rid the rid value to set. + * @return the ExtendedResourceProperties object itself. + */ + ExtendedResourceProperties withRid(String rid) { + this.rid = rid; + return this; + } + + /** + * 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; + } + + /** + * Set the ts property: A system generated property that denotes the last updated timestamp of the resource. + * + * @param ts the ts value to set. + * @return the ExtendedResourceProperties object itself. + */ + ExtendedResourceProperties withTs(Float ts) { + this.ts = ts; + return this; + } + + /** + * 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; + } + + /** + * Set the etag property: A system generated property representing the resource etag required for optimistic + * concurrency control. + * + * @param etag the etag value to set. + * @return the ExtendedResourceProperties object itself. + */ + ExtendedResourceProperties withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExtendedResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExtendedResourceProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ExtendedResourceProperties. + */ + public static ExtendedResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ExtendedResourceProperties deserializedExtendedResourceProperties = new ExtendedResourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("_rid".equals(fieldName)) { + deserializedExtendedResourceProperties.rid = reader.getString(); + } else if ("_ts".equals(fieldName)) { + deserializedExtendedResourceProperties.ts = reader.getNullable(JsonReader::getFloat); + } else if ("_etag".equals(fieldName)) { + deserializedExtendedResourceProperties.etag = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedExtendedResourceProperties; + }); + } +} 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..1c5ed1fb34387 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/FailoverPolicies.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The list of new failover policies for the failover priority change. + */ +@Fluent +public final class FailoverPolicies implements JsonSerializable { + /* + * List of failover policies. + */ + private List failoverPolicies; + + /** + * Creates an instance of FailoverPolicies class. + */ + public 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.atError() + .log(new IllegalArgumentException( + "Missing required property failoverPolicies in model FailoverPolicies")); + } else { + failoverPolicies().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(FailoverPolicies.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("failoverPolicies", this.failoverPolicies, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FailoverPolicies from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FailoverPolicies if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FailoverPolicies. + */ + public static FailoverPolicies fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FailoverPolicies deserializedFailoverPolicies = new FailoverPolicies(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("failoverPolicies".equals(fieldName)) { + List failoverPolicies + = reader.readArray(reader1 -> FailoverPolicy.fromJson(reader1)); + deserializedFailoverPolicies.failoverPolicies = failoverPolicies; + } else { + reader.skipChildren(); + } + } + + return deserializedFailoverPolicies; + }); + } +} 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..37aaba39e208e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/FailoverPolicy.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The failover policy for a given region of a database account. + */ +@Fluent +public final class FailoverPolicy implements JsonSerializable { + /* + * The unique identifier of the region in which the database account replicates to. Example: + * <accountName>-<locationName>. + */ + private String id; + + /* + * The name of the region in which the database account exists. + */ + 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. + */ + private Integer failoverPriority; + + /** + * Creates an instance of FailoverPolicy class. + */ + public FailoverPolicy() { + } + + /** + * 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("locationName", this.locationName); + jsonWriter.writeNumberField("failoverPriority", this.failoverPriority); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FailoverPolicy from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FailoverPolicy if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the FailoverPolicy. + */ + public static FailoverPolicy fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FailoverPolicy deserializedFailoverPolicy = new FailoverPolicy(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedFailoverPolicy.id = reader.getString(); + } else if ("locationName".equals(fieldName)) { + deserializedFailoverPolicy.locationName = reader.getString(); + } else if ("failoverPriority".equals(fieldName)) { + deserializedFailoverPolicy.failoverPriority = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedFailoverPolicy; + }); + } +} 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..cb0b135069c30 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GraphApiComputeRegionalServiceResource.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.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Resource for a regional service location. + */ +@Immutable +public final class GraphApiComputeRegionalServiceResource extends RegionalServiceResource { + /* + * The regional endpoint for GraphAPICompute. + */ + private String graphApiComputeEndpoint; + + /* + * Describes the status of a service. + */ + private ServiceStatus status; + + /* + * The location name. + */ + private String location; + + /* + * The regional service name. + */ + private String name; + + /** + * Creates an instance of GraphApiComputeRegionalServiceResource class. + */ + public GraphApiComputeRegionalServiceResource() { + } + + /** + * Get the graphApiComputeEndpoint property: The regional endpoint for GraphAPICompute. + * + * @return the graphApiComputeEndpoint value. + */ + public String graphApiComputeEndpoint() { + return this.graphApiComputeEndpoint; + } + + /** + * Get the status property: Describes the status of a service. + * + * @return the status value. + */ + @Override + public ServiceStatus status() { + return this.status; + } + + /** + * Get the location property: The location name. + * + * @return the location value. + */ + @Override + public String location() { + return this.location; + } + + /** + * Get the name property: The regional service name. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GraphApiComputeRegionalServiceResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GraphApiComputeRegionalServiceResource if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the GraphApiComputeRegionalServiceResource. + */ + public static GraphApiComputeRegionalServiceResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GraphApiComputeRegionalServiceResource deserializedGraphApiComputeRegionalServiceResource + = new GraphApiComputeRegionalServiceResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedGraphApiComputeRegionalServiceResource.name = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedGraphApiComputeRegionalServiceResource.location = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedGraphApiComputeRegionalServiceResource.status + = ServiceStatus.fromString(reader.getString()); + } else if ("graphApiComputeEndpoint".equals(fieldName)) { + deserializedGraphApiComputeRegionalServiceResource.graphApiComputeEndpoint = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedGraphApiComputeRegionalServiceResource; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GraphApiComputeServiceResourceCreateUpdateProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GraphApiComputeServiceResourceCreateUpdateProperties.java new file mode 100644 index 0000000000000..6d82cf8b52da4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GraphApiComputeServiceResourceCreateUpdateProperties.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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Properties for Create or Update request for GraphAPIComputeServiceResource. + */ +@Fluent +public final class GraphApiComputeServiceResourceCreateUpdateProperties extends ServiceResourceCreateUpdateProperties { + /* + * ServiceType for the service. + */ + private ServiceType serviceType = ServiceType.GRAPH_APICOMPUTE; + + /** + * Creates an instance of GraphApiComputeServiceResourceCreateUpdateProperties class. + */ + public GraphApiComputeServiceResourceCreateUpdateProperties() { + } + + /** + * Get the serviceType property: ServiceType for the service. + * + * @return the serviceType value. + */ + @Override + public ServiceType serviceType() { + return this.serviceType; + } + + /** + * {@inheritDoc} + */ + @Override + public GraphApiComputeServiceResourceCreateUpdateProperties withInstanceSize(ServiceSize instanceSize) { + super.withInstanceSize(instanceSize); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public GraphApiComputeServiceResourceCreateUpdateProperties withInstanceCount(Integer instanceCount) { + super.withInstanceCount(instanceCount); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("instanceSize", instanceSize() == null ? null : instanceSize().toString()); + jsonWriter.writeNumberField("instanceCount", instanceCount()); + jsonWriter.writeStringField("serviceType", this.serviceType == null ? null : this.serviceType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GraphApiComputeServiceResourceCreateUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GraphApiComputeServiceResourceCreateUpdateProperties if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the GraphApiComputeServiceResourceCreateUpdateProperties. + */ + public static GraphApiComputeServiceResourceCreateUpdateProperties fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + GraphApiComputeServiceResourceCreateUpdateProperties deserializedGraphApiComputeServiceResourceCreateUpdateProperties + = new GraphApiComputeServiceResourceCreateUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("instanceSize".equals(fieldName)) { + deserializedGraphApiComputeServiceResourceCreateUpdateProperties + .withInstanceSize(ServiceSize.fromString(reader.getString())); + } else if ("instanceCount".equals(fieldName)) { + deserializedGraphApiComputeServiceResourceCreateUpdateProperties + .withInstanceCount(reader.getNullable(JsonReader::getInt)); + } else if ("serviceType".equals(fieldName)) { + deserializedGraphApiComputeServiceResourceCreateUpdateProperties.serviceType + = ServiceType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedGraphApiComputeServiceResourceCreateUpdateProperties; + }); + } +} 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..6c95a8e3032d7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GraphApiComputeServiceResourceProperties.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** + * Properties for GraphAPIComputeServiceResource. + */ +@Fluent +public final class GraphApiComputeServiceResourceProperties extends ServiceResourceProperties { + /* + * ServiceType for the service. + */ + private ServiceType serviceType = ServiceType.GRAPH_APICOMPUTE; + + /* + * GraphAPICompute endpoint for the service. + */ + private String graphApiComputeEndpoint; + + /* + * An array that contains all of the locations for the service. + */ + private List locations; + + /* + * Describes the status of a service. + */ + private ServiceStatus status; + + /* + * Time of the last state change (ISO-8601 format). + */ + private OffsetDateTime creationTime; + + /** + * Creates an instance of GraphApiComputeServiceResourceProperties class. + */ + public GraphApiComputeServiceResourceProperties() { + } + + /** + * Get the serviceType property: ServiceType for the service. + * + * @return the serviceType value. + */ + @Override + public ServiceType serviceType() { + return this.serviceType; + } + + /** + * 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; + } + + /** + * Get the status property: Describes the status of a service. + * + * @return the status value. + */ + @Override + public ServiceStatus status() { + return this.status; + } + + /** + * Get the creationTime property: Time of the last state change (ISO-8601 format). + * + * @return the creationTime value. + */ + @Override + public OffsetDateTime creationTime() { + return this.creationTime; + } + + /** + * {@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() { + if (locations() != null) { + locations().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("instanceSize", instanceSize() == null ? null : instanceSize().toString()); + jsonWriter.writeNumberField("instanceCount", instanceCount()); + jsonWriter.writeStringField("serviceType", this.serviceType == null ? null : this.serviceType.toString()); + jsonWriter.writeStringField("graphApiComputeEndpoint", this.graphApiComputeEndpoint); + if (additionalProperties() != null) { + for (Map.Entry additionalProperty : additionalProperties().entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GraphApiComputeServiceResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GraphApiComputeServiceResourceProperties if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the GraphApiComputeServiceResourceProperties. + */ + public static GraphApiComputeServiceResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GraphApiComputeServiceResourceProperties deserializedGraphApiComputeServiceResourceProperties + = new GraphApiComputeServiceResourceProperties(); + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("creationTime".equals(fieldName)) { + deserializedGraphApiComputeServiceResourceProperties.creationTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("instanceSize".equals(fieldName)) { + deserializedGraphApiComputeServiceResourceProperties + .withInstanceSize(ServiceSize.fromString(reader.getString())); + } else if ("instanceCount".equals(fieldName)) { + deserializedGraphApiComputeServiceResourceProperties + .withInstanceCount(reader.getNullable(JsonReader::getInt)); + } else if ("status".equals(fieldName)) { + deserializedGraphApiComputeServiceResourceProperties.status + = ServiceStatus.fromString(reader.getString()); + } else if ("serviceType".equals(fieldName)) { + deserializedGraphApiComputeServiceResourceProperties.serviceType + = ServiceType.fromString(reader.getString()); + } else if ("graphApiComputeEndpoint".equals(fieldName)) { + deserializedGraphApiComputeServiceResourceProperties.graphApiComputeEndpoint = reader.getString(); + } else if ("locations".equals(fieldName)) { + List locations + = reader.readArray(reader1 -> GraphApiComputeRegionalServiceResource.fromJson(reader1)); + deserializedGraphApiComputeServiceResourceProperties.locations = locations; + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.readUntyped()); + } + } + deserializedGraphApiComputeServiceResourceProperties.withAdditionalProperties(additionalProperties); + + return deserializedGraphApiComputeServiceResourceProperties; + }); + } +} 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..9a5afc5455946 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseCreateUpdateParameters.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.GremlinDatabaseCreateUpdateProperties; +import java.io.IOException; +import java.util.Map; + +/** + * Parameters to create and update Cosmos DB Gremlin database. + */ +@Fluent +public final class GremlinDatabaseCreateUpdateParameters extends ArmResourceProperties { + /* + * Properties to create and update Azure Cosmos DB Gremlin database. + */ + private GremlinDatabaseCreateUpdateProperties innerProperties = new GremlinDatabaseCreateUpdateProperties(); + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of GremlinDatabaseCreateUpdateParameters class. + */ + public GremlinDatabaseCreateUpdateParameters() { + } + + /** + * Get the innerProperties property: Properties to create and update Azure Cosmos DB Gremlin database. + * + * @return the innerProperties value. + */ + private GremlinDatabaseCreateUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@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() { + if (innerProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property innerProperties in model GremlinDatabaseCreateUpdateParameters")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(GremlinDatabaseCreateUpdateParameters.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GremlinDatabaseCreateUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GremlinDatabaseCreateUpdateParameters if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GremlinDatabaseCreateUpdateParameters. + */ + public static GremlinDatabaseCreateUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GremlinDatabaseCreateUpdateParameters deserializedGremlinDatabaseCreateUpdateParameters + = new GremlinDatabaseCreateUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedGremlinDatabaseCreateUpdateParameters.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedGremlinDatabaseCreateUpdateParameters.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedGremlinDatabaseCreateUpdateParameters.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedGremlinDatabaseCreateUpdateParameters.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedGremlinDatabaseCreateUpdateParameters.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedGremlinDatabaseCreateUpdateParameters.innerProperties + = GremlinDatabaseCreateUpdateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedGremlinDatabaseCreateUpdateParameters; + }); + } +} 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..9292953b2f407 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseGetPropertiesOptions.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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The GremlinDatabaseGetPropertiesOptions model. + */ +@Fluent +public final class GremlinDatabaseGetPropertiesOptions extends OptionsResource { + /** + * Creates an instance of GremlinDatabaseGetPropertiesOptions class. + */ + public GremlinDatabaseGetPropertiesOptions() { + } + + /** + * {@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() { + if (autoscaleSettings() != null) { + autoscaleSettings().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("throughput", throughput()); + jsonWriter.writeJsonField("autoscaleSettings", autoscaleSettings()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GremlinDatabaseGetPropertiesOptions from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GremlinDatabaseGetPropertiesOptions if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the GremlinDatabaseGetPropertiesOptions. + */ + public static GremlinDatabaseGetPropertiesOptions fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GremlinDatabaseGetPropertiesOptions deserializedGremlinDatabaseGetPropertiesOptions + = new GremlinDatabaseGetPropertiesOptions(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("throughput".equals(fieldName)) { + deserializedGremlinDatabaseGetPropertiesOptions + .withThroughput(reader.getNullable(JsonReader::getInt)); + } else if ("autoscaleSettings".equals(fieldName)) { + deserializedGremlinDatabaseGetPropertiesOptions + .withAutoscaleSettings(AutoscaleSettings.fromJson(reader)); + } else { + reader.skipChildren(); + } + } + + return deserializedGremlinDatabaseGetPropertiesOptions; + }); + } +} 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..661e88d1ad3bc --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseGetPropertiesResource.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The GremlinDatabaseGetPropertiesResource model. + */ +@Fluent +public final class GremlinDatabaseGetPropertiesResource extends GremlinDatabaseResource { + /* + * A system generated property. A unique identifier. + */ + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of the resource. + */ + private Float ts; + + /* + * A system generated property representing the resource etag required for optimistic concurrency control. + */ + private String etag; + + /** + * Creates an instance of GremlinDatabaseGetPropertiesResource class. + */ + public GremlinDatabaseGetPropertiesResource() { + } + + /** + * 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; + } + + /** + * {@inheritDoc} + */ + @Override + public GremlinDatabaseGetPropertiesResource withRestoreParameters(ResourceRestoreParameters restoreParameters) { + super.withRestoreParameters(restoreParameters); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public GremlinDatabaseGetPropertiesResource withCreateMode(CreateMode createMode) { + super.withCreateMode(createMode); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (id() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property id in model GremlinDatabaseGetPropertiesResource")); + } + if (restoreParameters() != null) { + restoreParameters().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(GremlinDatabaseGetPropertiesResource.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", id()); + jsonWriter.writeJsonField("restoreParameters", restoreParameters()); + jsonWriter.writeStringField("createMode", createMode() == null ? null : createMode().toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GremlinDatabaseGetPropertiesResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GremlinDatabaseGetPropertiesResource if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GremlinDatabaseGetPropertiesResource. + */ + public static GremlinDatabaseGetPropertiesResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GremlinDatabaseGetPropertiesResource deserializedGremlinDatabaseGetPropertiesResource + = new GremlinDatabaseGetPropertiesResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedGremlinDatabaseGetPropertiesResource.withId(reader.getString()); + } else if ("restoreParameters".equals(fieldName)) { + deserializedGremlinDatabaseGetPropertiesResource + .withRestoreParameters(ResourceRestoreParameters.fromJson(reader)); + } else if ("createMode".equals(fieldName)) { + deserializedGremlinDatabaseGetPropertiesResource + .withCreateMode(CreateMode.fromString(reader.getString())); + } else if ("_rid".equals(fieldName)) { + deserializedGremlinDatabaseGetPropertiesResource.rid = reader.getString(); + } else if ("_ts".equals(fieldName)) { + deserializedGremlinDatabaseGetPropertiesResource.ts = reader.getNullable(JsonReader::getFloat); + } else if ("_etag".equals(fieldName)) { + deserializedGremlinDatabaseGetPropertiesResource.etag = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedGremlinDatabaseGetPropertiesResource; + }); + } +} 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..8a896d66dd014 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseGetResults.java @@ -0,0 +1,295 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 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 name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * 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.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 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.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 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..8fcf5a7c06aa9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseListResult.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.GremlinDatabaseGetResultsInner; +import java.io.IOException; +import java.util.List; + +/** + * The List operation response, that contains the Gremlin databases and their properties. + */ +@Immutable +public final class GremlinDatabaseListResult implements JsonSerializable { + /* + * List of Gremlin databases and their properties. + */ + private List value; + + /** + * Creates an instance of GremlinDatabaseListResult class. + */ + public GremlinDatabaseListResult() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GremlinDatabaseListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GremlinDatabaseListResult if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the GremlinDatabaseListResult. + */ + public static GremlinDatabaseListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GremlinDatabaseListResult deserializedGremlinDatabaseListResult = new GremlinDatabaseListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> GremlinDatabaseGetResultsInner.fromJson(reader1)); + deserializedGremlinDatabaseListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedGremlinDatabaseListResult; + }); + } +} 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..5af75dfc554dd --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseResource.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Cosmos DB Gremlin database resource object. + */ +@Fluent +public class GremlinDatabaseResource implements JsonSerializable { + /* + * Name of the Cosmos DB Gremlin database + */ + private String id; + + /* + * Parameters to indicate the information about the restore + */ + private ResourceRestoreParameters restoreParameters; + + /* + * Enum to indicate the mode of resource creation. + */ + private CreateMode createMode; + + /** + * Creates an instance of GremlinDatabaseResource class. + */ + public GremlinDatabaseResource() { + } + + /** + * 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; + } + + /** + * Get the restoreParameters property: Parameters to indicate the information about the restore. + * + * @return the restoreParameters value. + */ + public ResourceRestoreParameters 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 GremlinDatabaseResource object itself. + */ + public GremlinDatabaseResource withRestoreParameters(ResourceRestoreParameters restoreParameters) { + this.restoreParameters = restoreParameters; + return this; + } + + /** + * Get the createMode property: Enum to indicate the mode of resource creation. + * + * @return the createMode value. + */ + public CreateMode createMode() { + return this.createMode; + } + + /** + * Set the createMode property: Enum to indicate the mode of resource creation. + * + * @param createMode the createMode value to set. + * @return the GremlinDatabaseResource object itself. + */ + public GremlinDatabaseResource withCreateMode(CreateMode createMode) { + this.createMode = createMode; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property id in model GremlinDatabaseResource")); + } + if (restoreParameters() != null) { + restoreParameters().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(GremlinDatabaseResource.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeJsonField("restoreParameters", this.restoreParameters); + jsonWriter.writeStringField("createMode", this.createMode == null ? null : this.createMode.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GremlinDatabaseResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GremlinDatabaseResource if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GremlinDatabaseResource. + */ + public static GremlinDatabaseResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GremlinDatabaseResource deserializedGremlinDatabaseResource = new GremlinDatabaseResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedGremlinDatabaseResource.id = reader.getString(); + } else if ("restoreParameters".equals(fieldName)) { + deserializedGremlinDatabaseResource.restoreParameters = ResourceRestoreParameters.fromJson(reader); + } else if ("createMode".equals(fieldName)) { + deserializedGremlinDatabaseResource.createMode = CreateMode.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedGremlinDatabaseResource; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseRestoreResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseRestoreResource.java new file mode 100644 index 0000000000000..7bfda4b32a46a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseRestoreResource.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Specific Gremlin Databases to restore. + */ +@Fluent +public final class GremlinDatabaseRestoreResource implements JsonSerializable { + /* + * The name of the gremlin database available for restore. + */ + private String databaseName; + + /* + * The names of the graphs available for restore. + */ + private List graphNames; + + /** + * Creates an instance of GremlinDatabaseRestoreResource class. + */ + public GremlinDatabaseRestoreResource() { + } + + /** + * Get the databaseName property: The name of the gremlin database available for restore. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Set the databaseName property: The name of the gremlin database available for restore. + * + * @param databaseName the databaseName value to set. + * @return the GremlinDatabaseRestoreResource object itself. + */ + public GremlinDatabaseRestoreResource withDatabaseName(String databaseName) { + this.databaseName = databaseName; + return this; + } + + /** + * Get the graphNames property: The names of the graphs available for restore. + * + * @return the graphNames value. + */ + public List graphNames() { + return this.graphNames; + } + + /** + * Set the graphNames property: The names of the graphs available for restore. + * + * @param graphNames the graphNames value to set. + * @return the GremlinDatabaseRestoreResource object itself. + */ + public GremlinDatabaseRestoreResource withGraphNames(List graphNames) { + this.graphNames = graphNames; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("databaseName", this.databaseName); + jsonWriter.writeArrayField("graphNames", this.graphNames, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GremlinDatabaseRestoreResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GremlinDatabaseRestoreResource if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the GremlinDatabaseRestoreResource. + */ + public static GremlinDatabaseRestoreResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GremlinDatabaseRestoreResource deserializedGremlinDatabaseRestoreResource + = new GremlinDatabaseRestoreResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("databaseName".equals(fieldName)) { + deserializedGremlinDatabaseRestoreResource.databaseName = reader.getString(); + } else if ("graphNames".equals(fieldName)) { + List graphNames = reader.readArray(reader1 -> reader1.getString()); + deserializedGremlinDatabaseRestoreResource.graphNames = graphNames; + } else { + reader.skipChildren(); + } + } + + return deserializedGremlinDatabaseRestoreResource; + }); + } +} 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..8b46384a90361 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphCreateUpdateParameters.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.GremlinGraphCreateUpdateProperties; +import java.io.IOException; +import java.util.Map; + +/** + * Parameters to create and update Cosmos DB Gremlin graph. + */ +@Fluent +public final class GremlinGraphCreateUpdateParameters extends ArmResourceProperties { + /* + * Properties to create and update Azure Cosmos DB Gremlin graph. + */ + private GremlinGraphCreateUpdateProperties innerProperties = new GremlinGraphCreateUpdateProperties(); + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of GremlinGraphCreateUpdateParameters class. + */ + public GremlinGraphCreateUpdateParameters() { + } + + /** + * Get the innerProperties property: Properties to create and update Azure Cosmos DB Gremlin graph. + * + * @return the innerProperties value. + */ + private GremlinGraphCreateUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@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() { + if (innerProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property innerProperties in model GremlinGraphCreateUpdateParameters")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(GremlinGraphCreateUpdateParameters.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GremlinGraphCreateUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GremlinGraphCreateUpdateParameters if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GremlinGraphCreateUpdateParameters. + */ + public static GremlinGraphCreateUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GremlinGraphCreateUpdateParameters deserializedGremlinGraphCreateUpdateParameters + = new GremlinGraphCreateUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedGremlinGraphCreateUpdateParameters.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedGremlinGraphCreateUpdateParameters.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedGremlinGraphCreateUpdateParameters.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedGremlinGraphCreateUpdateParameters.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedGremlinGraphCreateUpdateParameters.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedGremlinGraphCreateUpdateParameters.innerProperties + = GremlinGraphCreateUpdateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedGremlinGraphCreateUpdateParameters; + }); + } +} 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..33852f8915c4f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphGetPropertiesOptions.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The GremlinGraphGetPropertiesOptions model. + */ +@Fluent +public final class GremlinGraphGetPropertiesOptions extends OptionsResource { + /** + * Creates an instance of GremlinGraphGetPropertiesOptions class. + */ + public GremlinGraphGetPropertiesOptions() { + } + + /** + * {@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() { + if (autoscaleSettings() != null) { + autoscaleSettings().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("throughput", throughput()); + jsonWriter.writeJsonField("autoscaleSettings", autoscaleSettings()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GremlinGraphGetPropertiesOptions from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GremlinGraphGetPropertiesOptions if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the GremlinGraphGetPropertiesOptions. + */ + public static GremlinGraphGetPropertiesOptions fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GremlinGraphGetPropertiesOptions deserializedGremlinGraphGetPropertiesOptions + = new GremlinGraphGetPropertiesOptions(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("throughput".equals(fieldName)) { + deserializedGremlinGraphGetPropertiesOptions.withThroughput(reader.getNullable(JsonReader::getInt)); + } else if ("autoscaleSettings".equals(fieldName)) { + deserializedGremlinGraphGetPropertiesOptions + .withAutoscaleSettings(AutoscaleSettings.fromJson(reader)); + } else { + reader.skipChildren(); + } + } + + return deserializedGremlinGraphGetPropertiesOptions; + }); + } +} 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..c649cf745ee43 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphGetPropertiesResource.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The GremlinGraphGetPropertiesResource model. + */ +@Fluent +public final class GremlinGraphGetPropertiesResource extends GremlinGraphResource { + /* + * A system generated property. A unique identifier. + */ + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of the resource. + */ + private Float ts; + + /* + * A system generated property representing the resource etag required for optimistic concurrency control. + */ + private String etag; + + /** + * Creates an instance of GremlinGraphGetPropertiesResource class. + */ + public GremlinGraphGetPropertiesResource() { + } + + /** + * 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; + } + + /** + * {@inheritDoc} + */ + @Override + public GremlinGraphGetPropertiesResource withAnalyticalStorageTtl(Long analyticalStorageTtl) { + super.withAnalyticalStorageTtl(analyticalStorageTtl); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public GremlinGraphGetPropertiesResource withRestoreParameters(ResourceRestoreParameters restoreParameters) { + super.withRestoreParameters(restoreParameters); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public GremlinGraphGetPropertiesResource withCreateMode(CreateMode createMode) { + super.withCreateMode(createMode); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (id() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property id in model GremlinGraphGetPropertiesResource")); + } + if (indexingPolicy() != null) { + indexingPolicy().validate(); + } + if (partitionKey() != null) { + partitionKey().validate(); + } + if (uniqueKeyPolicy() != null) { + uniqueKeyPolicy().validate(); + } + if (conflictResolutionPolicy() != null) { + conflictResolutionPolicy().validate(); + } + if (restoreParameters() != null) { + restoreParameters().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(GremlinGraphGetPropertiesResource.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", id()); + jsonWriter.writeJsonField("indexingPolicy", indexingPolicy()); + jsonWriter.writeJsonField("partitionKey", partitionKey()); + jsonWriter.writeNumberField("defaultTtl", defaultTtl()); + jsonWriter.writeJsonField("uniqueKeyPolicy", uniqueKeyPolicy()); + jsonWriter.writeJsonField("conflictResolutionPolicy", conflictResolutionPolicy()); + jsonWriter.writeNumberField("analyticalStorageTtl", analyticalStorageTtl()); + jsonWriter.writeJsonField("restoreParameters", restoreParameters()); + jsonWriter.writeStringField("createMode", createMode() == null ? null : createMode().toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GremlinGraphGetPropertiesResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GremlinGraphGetPropertiesResource if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GremlinGraphGetPropertiesResource. + */ + public static GremlinGraphGetPropertiesResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GremlinGraphGetPropertiesResource deserializedGremlinGraphGetPropertiesResource + = new GremlinGraphGetPropertiesResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedGremlinGraphGetPropertiesResource.withId(reader.getString()); + } else if ("indexingPolicy".equals(fieldName)) { + deserializedGremlinGraphGetPropertiesResource.withIndexingPolicy(IndexingPolicy.fromJson(reader)); + } else if ("partitionKey".equals(fieldName)) { + deserializedGremlinGraphGetPropertiesResource + .withPartitionKey(ContainerPartitionKey.fromJson(reader)); + } else if ("defaultTtl".equals(fieldName)) { + deserializedGremlinGraphGetPropertiesResource + .withDefaultTtl(reader.getNullable(JsonReader::getInt)); + } else if ("uniqueKeyPolicy".equals(fieldName)) { + deserializedGremlinGraphGetPropertiesResource.withUniqueKeyPolicy(UniqueKeyPolicy.fromJson(reader)); + } else if ("conflictResolutionPolicy".equals(fieldName)) { + deserializedGremlinGraphGetPropertiesResource + .withConflictResolutionPolicy(ConflictResolutionPolicy.fromJson(reader)); + } else if ("analyticalStorageTtl".equals(fieldName)) { + deserializedGremlinGraphGetPropertiesResource + .withAnalyticalStorageTtl(reader.getNullable(JsonReader::getLong)); + } else if ("restoreParameters".equals(fieldName)) { + deserializedGremlinGraphGetPropertiesResource + .withRestoreParameters(ResourceRestoreParameters.fromJson(reader)); + } else if ("createMode".equals(fieldName)) { + deserializedGremlinGraphGetPropertiesResource + .withCreateMode(CreateMode.fromString(reader.getString())); + } else if ("_rid".equals(fieldName)) { + deserializedGremlinGraphGetPropertiesResource.rid = reader.getString(); + } else if ("_ts".equals(fieldName)) { + deserializedGremlinGraphGetPropertiesResource.ts = reader.getNullable(JsonReader::getFloat); + } else if ("_etag".equals(fieldName)) { + deserializedGremlinGraphGetPropertiesResource.etag = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedGremlinGraphGetPropertiesResource; + }); + } +} 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..cd86867202db4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphGetResults.java @@ -0,0 +1,319 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 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 name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * 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.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 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.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 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); + + /** + * Retrieves continuous backup information for a gremlin graph. + * + * @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 gremlin graph. + * + * @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/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..d1c6d68ac4281 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphListResult.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.GremlinGraphGetResultsInner; +import java.io.IOException; +import java.util.List; + +/** + * The List operation response, that contains the graphs and their properties. + */ +@Immutable +public final class GremlinGraphListResult implements JsonSerializable { + /* + * List of graphs and their properties. + */ + private List value; + + /** + * Creates an instance of GremlinGraphListResult class. + */ + public GremlinGraphListResult() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GremlinGraphListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GremlinGraphListResult if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the GremlinGraphListResult. + */ + public static GremlinGraphListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GremlinGraphListResult deserializedGremlinGraphListResult = new GremlinGraphListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> GremlinGraphGetResultsInner.fromJson(reader1)); + deserializedGremlinGraphListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedGremlinGraphListResult; + }); + } +} 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..ccc78113b5931 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphResource.java @@ -0,0 +1,349 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Cosmos DB Gremlin graph resource object. + */ +@Fluent +public class GremlinGraphResource implements JsonSerializable { + /* + * Name of the Cosmos DB Gremlin graph + */ + private String id; + + /* + * The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the + * graph + */ + private IndexingPolicy indexingPolicy; + + /* + * The configuration of the partition key to be used for partitioning data into multiple partitions + */ + private ContainerPartitionKey partitionKey; + + /* + * Default time to live + */ + private Integer defaultTtl; + + /* + * The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the + * Azure Cosmos DB service. + */ + private UniqueKeyPolicy uniqueKeyPolicy; + + /* + * The conflict resolution policy for the graph. + */ + private ConflictResolutionPolicy conflictResolutionPolicy; + + /* + * Analytical TTL. + */ + private Long analyticalStorageTtl; + + /* + * Parameters to indicate the information about the restore + */ + private ResourceRestoreParameters restoreParameters; + + /* + * Enum to indicate the mode of resource creation. + */ + private CreateMode createMode; + + /** + * Creates an instance of GremlinGraphResource class. + */ + public GremlinGraphResource() { + } + + /** + * 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; + } + + /** + * 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 GremlinGraphResource object itself. + */ + public GremlinGraphResource withAnalyticalStorageTtl(Long analyticalStorageTtl) { + this.analyticalStorageTtl = analyticalStorageTtl; + return this; + } + + /** + * Get the restoreParameters property: Parameters to indicate the information about the restore. + * + * @return the restoreParameters value. + */ + public ResourceRestoreParameters 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 GremlinGraphResource object itself. + */ + public GremlinGraphResource withRestoreParameters(ResourceRestoreParameters restoreParameters) { + this.restoreParameters = restoreParameters; + return this; + } + + /** + * Get the createMode property: Enum to indicate the mode of resource creation. + * + * @return the createMode value. + */ + public CreateMode createMode() { + return this.createMode; + } + + /** + * Set the createMode property: Enum to indicate the mode of resource creation. + * + * @param createMode the createMode value to set. + * @return the GremlinGraphResource object itself. + */ + public GremlinGraphResource withCreateMode(CreateMode createMode) { + this.createMode = createMode; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw LOGGER.atError() + .log(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(); + } + if (restoreParameters() != null) { + restoreParameters().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(GremlinGraphResource.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeJsonField("indexingPolicy", this.indexingPolicy); + jsonWriter.writeJsonField("partitionKey", this.partitionKey); + jsonWriter.writeNumberField("defaultTtl", this.defaultTtl); + jsonWriter.writeJsonField("uniqueKeyPolicy", this.uniqueKeyPolicy); + jsonWriter.writeJsonField("conflictResolutionPolicy", this.conflictResolutionPolicy); + jsonWriter.writeNumberField("analyticalStorageTtl", this.analyticalStorageTtl); + jsonWriter.writeJsonField("restoreParameters", this.restoreParameters); + jsonWriter.writeStringField("createMode", this.createMode == null ? null : this.createMode.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GremlinGraphResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GremlinGraphResource if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GremlinGraphResource. + */ + public static GremlinGraphResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GremlinGraphResource deserializedGremlinGraphResource = new GremlinGraphResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedGremlinGraphResource.id = reader.getString(); + } else if ("indexingPolicy".equals(fieldName)) { + deserializedGremlinGraphResource.indexingPolicy = IndexingPolicy.fromJson(reader); + } else if ("partitionKey".equals(fieldName)) { + deserializedGremlinGraphResource.partitionKey = ContainerPartitionKey.fromJson(reader); + } else if ("defaultTtl".equals(fieldName)) { + deserializedGremlinGraphResource.defaultTtl = reader.getNullable(JsonReader::getInt); + } else if ("uniqueKeyPolicy".equals(fieldName)) { + deserializedGremlinGraphResource.uniqueKeyPolicy = UniqueKeyPolicy.fromJson(reader); + } else if ("conflictResolutionPolicy".equals(fieldName)) { + deserializedGremlinGraphResource.conflictResolutionPolicy + = ConflictResolutionPolicy.fromJson(reader); + } else if ("analyticalStorageTtl".equals(fieldName)) { + deserializedGremlinGraphResource.analyticalStorageTtl = reader.getNullable(JsonReader::getLong); + } else if ("restoreParameters".equals(fieldName)) { + deserializedGremlinGraphResource.restoreParameters = ResourceRestoreParameters.fromJson(reader); + } else if ("createMode".equals(fieldName)) { + deserializedGremlinGraphResource.createMode = CreateMode.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedGremlinGraphResource; + }); + } +} 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..c6342a87ce35a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinResources.java @@ -0,0 +1,577 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 as paginated + * response with {@link PagedIterable}. + */ + 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 as paginated + * response with {@link PagedIterable}. + */ + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along + * with {@link Response}. + */ + Response getGremlinDatabaseWithResponse(String resourceGroupName, String accountName, + String databaseName, 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); + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + Response getGremlinDatabaseThroughputWithResponse(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); + + /** + * 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 as paginated response with + * {@link PagedIterable}. + */ + 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 as paginated response with + * {@link PagedIterable}. + */ + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + Response getGremlinGraphWithResponse(String resourceGroupName, String accountName, + String databaseName, String graphName, 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); + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 + * along with {@link Response}. + */ + Response getGremlinGraphThroughputWithResponse(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); + + /** + * 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); + + /** + * Retrieves continuous backup information for a 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 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 graphName, ContinuousBackupRestoreLocation location); + + /** + * Retrieves continuous backup information for a 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 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 graphName, ContinuousBackupRestoreLocation location, 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 along + * with {@link Response}. + */ + 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 along + * with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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..9aa648e73dd6a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/IncludedPath.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The paths that are included in indexing. + */ +@Fluent +public final class IncludedPath implements JsonSerializable { + /* + * The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard + * (/path/*) + */ + private String path; + + /* + * List of indexes for this path + */ + private List indexes; + + /** + * Creates an instance of IncludedPath class. + */ + public IncludedPath() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("path", this.path); + jsonWriter.writeArrayField("indexes", this.indexes, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IncludedPath from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IncludedPath if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the IncludedPath. + */ + public static IncludedPath fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IncludedPath deserializedIncludedPath = new IncludedPath(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("path".equals(fieldName)) { + deserializedIncludedPath.path = reader.getString(); + } else if ("indexes".equals(fieldName)) { + List indexes = reader.readArray(reader1 -> Indexes.fromJson(reader1)); + deserializedIncludedPath.indexes = indexes; + } else { + reader.skipChildren(); + } + } + + return deserializedIncludedPath; + }); + } +} 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..0798beadf2bc2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/IndexKind.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.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Indicates the type of index. + */ +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 a new instance of IndexKind value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public IndexKind() { + } + + /** + * Creates or finds a IndexKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding IndexKind. + */ + public static IndexKind fromString(String name) { + return fromString(name, IndexKind.class); + } + + /** + * Gets known IndexKind values. + * + * @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..3bc5f9906eb1a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Indexes.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.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The indexes for the path. + */ +@Fluent +public final class Indexes implements JsonSerializable { + /* + * The datatype for which the indexing behavior is applied to. + */ + private DataType dataType; + + /* + * The precision of the index. -1 is maximum precision. + */ + private Integer precision; + + /* + * Indicates the type of index. + */ + private IndexKind kind; + + /** + * Creates an instance of Indexes class. + */ + public Indexes() { + } + + /** + * 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("dataType", this.dataType == null ? null : this.dataType.toString()); + jsonWriter.writeNumberField("precision", this.precision); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Indexes from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Indexes if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IOException If an error occurs while reading the Indexes. + */ + public static Indexes fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Indexes deserializedIndexes = new Indexes(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("dataType".equals(fieldName)) { + deserializedIndexes.dataType = DataType.fromString(reader.getString()); + } else if ("precision".equals(fieldName)) { + deserializedIndexes.precision = reader.getNullable(JsonReader::getInt); + } else if ("kind".equals(fieldName)) { + deserializedIndexes.kind = IndexKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedIndexes; + }); + } +} 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..2694d0420656f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/IndexingMode.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.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Indicates the indexing mode. + */ +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 a new instance of IndexingMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public IndexingMode() { + } + + /** + * Creates or finds a IndexingMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding IndexingMode. + */ + public static IndexingMode fromString(String name) { + return fromString(name, IndexingMode.class); + } + + /** + * Gets known IndexingMode values. + * + * @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..da90792e8bbe8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/IndexingPolicy.java @@ -0,0 +1,253 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Cosmos DB indexing policy. + */ +@Fluent +public final class IndexingPolicy implements JsonSerializable { + /* + * Indicates if the indexing policy is automatic + */ + private Boolean automatic; + + /* + * Indicates the indexing mode. + */ + private IndexingMode indexingMode; + + /* + * List of paths to include in the indexing + */ + private List includedPaths; + + /* + * List of paths to exclude from indexing + */ + private List excludedPaths; + + /* + * List of composite path list + */ + private List> compositeIndexes; + + /* + * List of spatial specifics + */ + private List spatialIndexes; + + /** + * Creates an instance of IndexingPolicy class. + */ + public IndexingPolicy() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("automatic", this.automatic); + jsonWriter.writeStringField("indexingMode", this.indexingMode == null ? null : this.indexingMode.toString()); + jsonWriter.writeArrayField("includedPaths", this.includedPaths, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("excludedPaths", this.excludedPaths, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("compositeIndexes", this.compositeIndexes, + (writer, element) -> writer.writeArray(element, (writer1, element1) -> writer1.writeJson(element1))); + jsonWriter.writeArrayField("spatialIndexes", this.spatialIndexes, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IndexingPolicy from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IndexingPolicy if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the IndexingPolicy. + */ + public static IndexingPolicy fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IndexingPolicy deserializedIndexingPolicy = new IndexingPolicy(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("automatic".equals(fieldName)) { + deserializedIndexingPolicy.automatic = reader.getNullable(JsonReader::getBoolean); + } else if ("indexingMode".equals(fieldName)) { + deserializedIndexingPolicy.indexingMode = IndexingMode.fromString(reader.getString()); + } else if ("includedPaths".equals(fieldName)) { + List includedPaths = reader.readArray(reader1 -> IncludedPath.fromJson(reader1)); + deserializedIndexingPolicy.includedPaths = includedPaths; + } else if ("excludedPaths".equals(fieldName)) { + List excludedPaths = reader.readArray(reader1 -> ExcludedPath.fromJson(reader1)); + deserializedIndexingPolicy.excludedPaths = excludedPaths; + } else if ("compositeIndexes".equals(fieldName)) { + List> compositeIndexes + = reader.readArray(reader1 -> reader1.readArray(reader2 -> CompositePath.fromJson(reader2))); + deserializedIndexingPolicy.compositeIndexes = compositeIndexes; + } else if ("spatialIndexes".equals(fieldName)) { + List spatialIndexes = reader.readArray(reader1 -> SpatialSpec.fromJson(reader1)); + deserializedIndexingPolicy.spatialIndexes = spatialIndexes; + } else { + reader.skipChildren(); + } + } + + return deserializedIndexingPolicy; + }); + } +} 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..009272af8b730 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/IpAddressOrRange.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * IpAddressOrRange object. + */ +@Fluent +public final class IpAddressOrRange implements JsonSerializable { + /* + * 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”. + */ + private String ipAddressOrRange; + + /** + * Creates an instance of IpAddressOrRange class. + */ + public 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("ipAddressOrRange", this.ipAddressOrRange); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IpAddressOrRange from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IpAddressOrRange if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the IpAddressOrRange. + */ + public static IpAddressOrRange fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IpAddressOrRange deserializedIpAddressOrRange = new IpAddressOrRange(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("ipAddressOrRange".equals(fieldName)) { + deserializedIpAddressOrRange.ipAddressOrRange = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedIpAddressOrRange; + }); + } +} 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..887537fd64915 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/KeyKind.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.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The access key to regenerate. + */ +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 a new instance of KeyKind value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public KeyKind() { + } + + /** + * Creates or finds a KeyKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding KeyKind. + */ + public static KeyKind fromString(String name) { + return fromString(name, KeyKind.class); + } + + /** + * Gets known KeyKind values. + * + * @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/KeyWrapMetadata.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/KeyWrapMetadata.java new file mode 100644 index 0000000000000..c47aa46ff08ed --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/KeyWrapMetadata.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents key wrap metadata that a key wrapping provider can use to wrap/unwrap a client encryption key. + */ +@Fluent +public final class KeyWrapMetadata implements JsonSerializable { + /* + * The name of associated KeyEncryptionKey (aka CustomerManagedKey). + */ + private String name; + + /* + * ProviderName of KeyStoreProvider. + */ + private String type; + + /* + * Reference / link to the KeyEncryptionKey. + */ + private String value; + + /* + * Algorithm used in wrapping and unwrapping of the data encryption key. + */ + private String algorithm; + + /** + * Creates an instance of KeyWrapMetadata class. + */ + public KeyWrapMetadata() { + } + + /** + * Get the name property: The name of associated KeyEncryptionKey (aka CustomerManagedKey). + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of associated KeyEncryptionKey (aka CustomerManagedKey). + * + * @param name the name value to set. + * @return the KeyWrapMetadata object itself. + */ + public KeyWrapMetadata withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: ProviderName of KeyStoreProvider. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: ProviderName of KeyStoreProvider. + * + * @param type the type value to set. + * @return the KeyWrapMetadata object itself. + */ + public KeyWrapMetadata withType(String type) { + this.type = type; + return this; + } + + /** + * Get the value property: Reference / link to the KeyEncryptionKey. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: Reference / link to the KeyEncryptionKey. + * + * @param value the value value to set. + * @return the KeyWrapMetadata object itself. + */ + public KeyWrapMetadata withValue(String value) { + this.value = value; + return this; + } + + /** + * Get the algorithm property: Algorithm used in wrapping and unwrapping of the data encryption key. + * + * @return the algorithm value. + */ + public String algorithm() { + return this.algorithm; + } + + /** + * Set the algorithm property: Algorithm used in wrapping and unwrapping of the data encryption key. + * + * @param algorithm the algorithm value to set. + * @return the KeyWrapMetadata object itself. + */ + public KeyWrapMetadata withAlgorithm(String algorithm) { + this.algorithm = algorithm; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeStringField("value", this.value); + jsonWriter.writeStringField("algorithm", this.algorithm); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KeyWrapMetadata from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KeyWrapMetadata if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the KeyWrapMetadata. + */ + public static KeyWrapMetadata fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KeyWrapMetadata deserializedKeyWrapMetadata = new KeyWrapMetadata(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedKeyWrapMetadata.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedKeyWrapMetadata.type = reader.getString(); + } else if ("value".equals(fieldName)) { + deserializedKeyWrapMetadata.value = reader.getString(); + } else if ("algorithm".equals(fieldName)) { + deserializedKeyWrapMetadata.algorithm = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedKeyWrapMetadata; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Kind.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Kind.java new file mode 100644 index 0000000000000..dce499dfc103a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Kind.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.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Kind of the connection string key. + */ +public final class Kind extends ExpandableStringEnum { + /** + * Static value Primary for Kind. + */ + public static final Kind PRIMARY = fromString("Primary"); + + /** + * Static value Secondary for Kind. + */ + public static final Kind SECONDARY = fromString("Secondary"); + + /** + * Static value PrimaryReadonly for Kind. + */ + public static final Kind PRIMARY_READONLY = fromString("PrimaryReadonly"); + + /** + * Static value SecondaryReadonly for Kind. + */ + public static final Kind SECONDARY_READONLY = fromString("SecondaryReadonly"); + + /** + * Creates a new instance of Kind value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Kind() { + } + + /** + * Creates or finds a Kind from its string representation. + * + * @param name a name to look for. + * @return the corresponding Kind. + */ + public static Kind fromString(String name) { + return fromString(name, Kind.class); + } + + /** + * Gets known Kind values. + * + * @return known Kind values. + */ + public static Collection values() { + return values(Kind.class); + } +} 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..fb43a3826ca73 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ListClusters.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ClusterResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * List of managed Cassandra clusters. + */ +@Fluent +public final class ListClusters implements JsonSerializable { + /* + * Container for the array of clusters. + */ + private List value; + + /** + * Creates an instance of ListClusters class. + */ + public ListClusters() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ListClusters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ListClusters if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ListClusters. + */ + public static ListClusters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ListClusters deserializedListClusters = new ListClusters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> ClusterResourceInner.fromJson(reader1)); + deserializedListClusters.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedListClusters; + }); + } +} 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..a3308ac3b0cdc --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ListDataCenters.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DataCenterResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * List of managed Cassandra data centers and their properties. + */ +@Immutable +public final class ListDataCenters implements JsonSerializable { + /* + * Container for array of data centers. + */ + private List value; + + /** + * Creates an instance of ListDataCenters class. + */ + public ListDataCenters() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ListDataCenters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ListDataCenters if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ListDataCenters. + */ + public static ListDataCenters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ListDataCenters deserializedListDataCenters = new ListDataCenters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> DataCenterResourceInner.fromJson(reader1)); + deserializedListDataCenters.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedListDataCenters; + }); + } +} 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..a0a7bddf325e4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Location.java @@ -0,0 +1,217 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * A region in which the Azure Cosmos DB database account is deployed. + */ +@Fluent +public final class Location implements JsonSerializable { + /* + * The unique identifier of the region within the database account. Example: + * <accountName>-<locationName>. + */ + private String id; + + /* + * The name of the region. + */ + private String locationName; + + /* + * The connection endpoint for the specific region. Example: + * https://<accountName>-<locationName>.documents.azure.com:443/ + */ + 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. + */ + 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. + */ + private Integer failoverPriority; + + /* + * Flag to indicate whether or not this region is an AvailabilityZone region + */ + private Boolean isZoneRedundant; + + /** + * Creates an instance of Location class. + */ + public Location() { + } + + /** + * 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("locationName", this.locationName); + jsonWriter.writeNumberField("failoverPriority", this.failoverPriority); + jsonWriter.writeBooleanField("isZoneRedundant", this.isZoneRedundant); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Location from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Location if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the Location. + */ + public static Location fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Location deserializedLocation = new Location(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedLocation.id = reader.getString(); + } else if ("locationName".equals(fieldName)) { + deserializedLocation.locationName = reader.getString(); + } else if ("documentEndpoint".equals(fieldName)) { + deserializedLocation.documentEndpoint = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedLocation.provisioningState = reader.getString(); + } else if ("failoverPriority".equals(fieldName)) { + deserializedLocation.failoverPriority = reader.getNullable(JsonReader::getInt); + } else if ("isZoneRedundant".equals(fieldName)) { + deserializedLocation.isZoneRedundant = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedLocation; + }); + } +} 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..44aa08c1a14c0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/LocationGetResult.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.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..1dd446fa0f6f1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/LocationListResult.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.LocationGetResultInner; +import java.io.IOException; +import java.util.List; + +/** + * The List operation response, that contains Cosmos DB locations and their properties. + */ +@Immutable +public final class LocationListResult implements JsonSerializable { + /* + * List of Cosmos DB locations and their properties. + */ + private List value; + + /** + * Creates an instance of LocationListResult class. + */ + public LocationListResult() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LocationListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LocationListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the LocationListResult. + */ + public static LocationListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LocationListResult deserializedLocationListResult = new LocationListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> LocationGetResultInner.fromJson(reader1)); + deserializedLocationListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedLocationListResult; + }); + } +} 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..3f685bdd4718b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/LocationProperties.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Cosmos DB location metadata. + */ +@Immutable +public final class LocationProperties implements JsonSerializable { + /* + * Flag indicating whether the location supports availability zones or not. + */ + private Boolean supportsAvailabilityZone; + + /* + * Flag indicating whether the location is residency sensitive. + */ + private Boolean isResidencyRestricted; + + /* + * The properties of available backup storage redundancies. + */ + private List backupStorageRedundancies; + + /* + * Flag indicating whether the subscription have access in region for Non-Availability Zones. + */ + private Boolean isSubscriptionRegionAccessAllowedForRegular; + + /* + * Flag indicating whether the subscription have access in region for Availability Zones(Az). + */ + private Boolean isSubscriptionRegionAccessAllowedForAz; + + /* + * Enum to indicate current buildout status of the region. + */ + private Status status; + + /** + * Creates an instance of LocationProperties class. + */ + public LocationProperties() { + } + + /** + * 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; + } + + /** + * Get the isSubscriptionRegionAccessAllowedForRegular property: Flag indicating whether the subscription have + * access in region for Non-Availability Zones. + * + * @return the isSubscriptionRegionAccessAllowedForRegular value. + */ + public Boolean isSubscriptionRegionAccessAllowedForRegular() { + return this.isSubscriptionRegionAccessAllowedForRegular; + } + + /** + * Get the isSubscriptionRegionAccessAllowedForAz property: Flag indicating whether the subscription have access in + * region for Availability Zones(Az). + * + * @return the isSubscriptionRegionAccessAllowedForAz value. + */ + public Boolean isSubscriptionRegionAccessAllowedForAz() { + return this.isSubscriptionRegionAccessAllowedForAz; + } + + /** + * Get the status property: Enum to indicate current buildout status of the region. + * + * @return the status value. + */ + public Status status() { + return this.status; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LocationProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LocationProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the LocationProperties. + */ + public static LocationProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LocationProperties deserializedLocationProperties = new LocationProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("supportsAvailabilityZone".equals(fieldName)) { + deserializedLocationProperties.supportsAvailabilityZone + = reader.getNullable(JsonReader::getBoolean); + } else if ("isResidencyRestricted".equals(fieldName)) { + deserializedLocationProperties.isResidencyRestricted = reader.getNullable(JsonReader::getBoolean); + } else if ("backupStorageRedundancies".equals(fieldName)) { + List backupStorageRedundancies + = reader.readArray(reader1 -> BackupStorageRedundancy.fromString(reader1.getString())); + deserializedLocationProperties.backupStorageRedundancies = backupStorageRedundancies; + } else if ("isSubscriptionRegionAccessAllowedForRegular".equals(fieldName)) { + deserializedLocationProperties.isSubscriptionRegionAccessAllowedForRegular + = reader.getNullable(JsonReader::getBoolean); + } else if ("isSubscriptionRegionAccessAllowedForAz".equals(fieldName)) { + deserializedLocationProperties.isSubscriptionRegionAccessAllowedForAz + = reader.getNullable(JsonReader::getBoolean); + } else if ("status".equals(fieldName)) { + deserializedLocationProperties.status = Status.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedLocationProperties; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Locations.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Locations.java new file mode 100644 index 0000000000000..01aede44847a4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Locations.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.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of Locations. + */ +public interface Locations { + /** + * 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 as paginated response + * with {@link PagedIterable}. + */ + 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 as paginated response + * with {@link PagedIterable}. + */ + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + Response getWithResponse(String location, 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 get(String location); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ManagedCassandraArmResourceProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ManagedCassandraArmResourceProperties.java new file mode 100644 index 0000000000000..05bb82f453ebd --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ManagedCassandraArmResourceProperties.java @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * The core properties of ARM resources. + */ +@Fluent +public class ManagedCassandraArmResourceProperties extends Resource { + /* + * Identity for the resource. + */ + private ManagedCassandraManagedServiceIdentity identity; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ManagedCassandraArmResourceProperties class. + */ + public ManagedCassandraArmResourceProperties() { + } + + /** + * Get the identity property: Identity for the resource. + * + * @return the identity value. + */ + public ManagedCassandraManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: Identity for the resource. + * + * @param identity the identity value to set. + * @return the ManagedCassandraArmResourceProperties object itself. + */ + public ManagedCassandraArmResourceProperties withIdentity(ManagedCassandraManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public ManagedCassandraArmResourceProperties withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ManagedCassandraArmResourceProperties 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("identity", this.identity); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedCassandraArmResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedCassandraArmResourceProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ManagedCassandraArmResourceProperties. + */ + public static ManagedCassandraArmResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedCassandraArmResourceProperties deserializedManagedCassandraArmResourceProperties + = new ManagedCassandraArmResourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedManagedCassandraArmResourceProperties.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedManagedCassandraArmResourceProperties.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedManagedCassandraArmResourceProperties.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedManagedCassandraArmResourceProperties.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedManagedCassandraArmResourceProperties.withTags(tags); + } else if ("identity".equals(fieldName)) { + deserializedManagedCassandraArmResourceProperties.identity + = ManagedCassandraManagedServiceIdentity.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedManagedCassandraArmResourceProperties; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ManagedCassandraManagedServiceIdentity.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ManagedCassandraManagedServiceIdentity.java new file mode 100644 index 0000000000000..3f07989c713ac --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ManagedCassandraManagedServiceIdentity.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Identity for the resource. + */ +@Fluent +public final class ManagedCassandraManagedServiceIdentity + implements JsonSerializable { + /* + * The object id of the identity resource. + */ + private String principalId; + + /* + * The tenant id of the resource. + */ + private String tenantId; + + /* + * The type of the resource. + */ + private ManagedCassandraResourceIdentityType type; + + /** + * Creates an instance of ManagedCassandraManagedServiceIdentity class. + */ + public ManagedCassandraManagedServiceIdentity() { + } + + /** + * Get the principalId property: The object id of the identity resource. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant id of the resource. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + public ManagedCassandraResourceIdentityType type() { + return this.type; + } + + /** + * Set the type property: The type of the resource. + * + * @param type the type value to set. + * @return the ManagedCassandraManagedServiceIdentity object itself. + */ + public ManagedCassandraManagedServiceIdentity withType(ManagedCassandraResourceIdentityType type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedCassandraManagedServiceIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedCassandraManagedServiceIdentity if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ManagedCassandraManagedServiceIdentity. + */ + public static ManagedCassandraManagedServiceIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedCassandraManagedServiceIdentity deserializedManagedCassandraManagedServiceIdentity + = new ManagedCassandraManagedServiceIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("principalId".equals(fieldName)) { + deserializedManagedCassandraManagedServiceIdentity.principalId = reader.getString(); + } else if ("tenantId".equals(fieldName)) { + deserializedManagedCassandraManagedServiceIdentity.tenantId = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedManagedCassandraManagedServiceIdentity.type + = ManagedCassandraResourceIdentityType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedManagedCassandraManagedServiceIdentity; + }); + } +} 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..f5c2b12c53ac9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ManagedCassandraProvisioningState.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.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The status of the resource at the time the operation was called. + */ +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 a new instance of ManagedCassandraProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ManagedCassandraProvisioningState() { + } + + /** + * Creates or finds a ManagedCassandraProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedCassandraProvisioningState. + */ + public static ManagedCassandraProvisioningState fromString(String name) { + return fromString(name, ManagedCassandraProvisioningState.class); + } + + /** + * Gets known ManagedCassandraProvisioningState values. + * + * @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/ManagedCassandraReaperStatus.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ManagedCassandraReaperStatus.java new file mode 100644 index 0000000000000..8da46f0426483 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ManagedCassandraReaperStatus.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * The ManagedCassandraReaperStatus model. + */ +@Fluent +public final class ManagedCassandraReaperStatus implements JsonSerializable { + /* + * The healthy property. + */ + private Boolean healthy; + + /* + * Dictionary of + */ + private Map repairRunIds; + + /* + * Dictionary of + */ + private Map repairSchedules; + + /** + * Creates an instance of ManagedCassandraReaperStatus class. + */ + public ManagedCassandraReaperStatus() { + } + + /** + * Get the healthy property: The healthy property. + * + * @return the healthy value. + */ + public Boolean healthy() { + return this.healthy; + } + + /** + * Set the healthy property: The healthy property. + * + * @param healthy the healthy value to set. + * @return the ManagedCassandraReaperStatus object itself. + */ + public ManagedCassandraReaperStatus withHealthy(Boolean healthy) { + this.healthy = healthy; + return this; + } + + /** + * Get the repairRunIds property: Dictionary of <string>. + * + * @return the repairRunIds value. + */ + public Map repairRunIds() { + return this.repairRunIds; + } + + /** + * Set the repairRunIds property: Dictionary of <string>. + * + * @param repairRunIds the repairRunIds value to set. + * @return the ManagedCassandraReaperStatus object itself. + */ + public ManagedCassandraReaperStatus withRepairRunIds(Map repairRunIds) { + this.repairRunIds = repairRunIds; + return this; + } + + /** + * Get the repairSchedules property: Dictionary of <string>. + * + * @return the repairSchedules value. + */ + public Map repairSchedules() { + return this.repairSchedules; + } + + /** + * Set the repairSchedules property: Dictionary of <string>. + * + * @param repairSchedules the repairSchedules value to set. + * @return the ManagedCassandraReaperStatus object itself. + */ + public ManagedCassandraReaperStatus withRepairSchedules(Map repairSchedules) { + this.repairSchedules = repairSchedules; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("healthy", this.healthy); + jsonWriter.writeMapField("repairRunIds", this.repairRunIds, (writer, element) -> writer.writeString(element)); + jsonWriter.writeMapField("repairSchedules", this.repairSchedules, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedCassandraReaperStatus from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedCassandraReaperStatus if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ManagedCassandraReaperStatus. + */ + public static ManagedCassandraReaperStatus fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedCassandraReaperStatus deserializedManagedCassandraReaperStatus = new ManagedCassandraReaperStatus(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("healthy".equals(fieldName)) { + deserializedManagedCassandraReaperStatus.healthy = reader.getNullable(JsonReader::getBoolean); + } else if ("repairRunIds".equals(fieldName)) { + Map repairRunIds = reader.readMap(reader1 -> reader1.getString()); + deserializedManagedCassandraReaperStatus.repairRunIds = repairRunIds; + } else if ("repairSchedules".equals(fieldName)) { + Map repairSchedules = reader.readMap(reader1 -> reader1.getString()); + deserializedManagedCassandraReaperStatus.repairSchedules = repairSchedules; + } else { + reader.skipChildren(); + } + } + + return deserializedManagedCassandraReaperStatus; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ManagedCassandraResourceIdentityType.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ManagedCassandraResourceIdentityType.java new file mode 100644 index 0000000000000..12f31acbb41e6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ManagedCassandraResourceIdentityType.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.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The type of the resource. + */ +public final class ManagedCassandraResourceIdentityType + extends ExpandableStringEnum { + /** + * Static value SystemAssigned for ManagedCassandraResourceIdentityType. + */ + public static final ManagedCassandraResourceIdentityType SYSTEM_ASSIGNED = fromString("SystemAssigned"); + + /** + * Static value None for ManagedCassandraResourceIdentityType. + */ + public static final ManagedCassandraResourceIdentityType NONE = fromString("None"); + + /** + * Creates a new instance of ManagedCassandraResourceIdentityType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ManagedCassandraResourceIdentityType() { + } + + /** + * Creates or finds a ManagedCassandraResourceIdentityType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedCassandraResourceIdentityType. + */ + public static ManagedCassandraResourceIdentityType fromString(String name) { + return fromString(name, ManagedCassandraResourceIdentityType.class); + } + + /** + * Gets known ManagedCassandraResourceIdentityType values. + * + * @return known ManagedCassandraResourceIdentityType values. + */ + public static Collection values() { + return values(ManagedCassandraResourceIdentityType.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..ff85a909f98d1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ManagedServiceIdentity.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Identity for the resource. + */ +@Fluent +public final class ManagedServiceIdentity implements JsonSerializable { + /* + * The principal id of the system assigned identity. This property will only be provided for a system assigned + * identity. + */ + private String principalId; + + /* + * The tenant id of the system assigned identity. This property will only be provided for a system assigned + * identity. + */ + 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. + */ + 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}'. + */ + private Map userAssignedIdentities; + + /** + * Creates an instance of ManagedServiceIdentity class. + */ + public ManagedServiceIdentity() { + } + + /** + * 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(); + } + }); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeMapField("userAssignedIdentities", this.userAssignedIdentities, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedServiceIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedServiceIdentity if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the ManagedServiceIdentity. + */ + public static ManagedServiceIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedServiceIdentity deserializedManagedServiceIdentity = new ManagedServiceIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("principalId".equals(fieldName)) { + deserializedManagedServiceIdentity.principalId = reader.getString(); + } else if ("tenantId".equals(fieldName)) { + deserializedManagedServiceIdentity.tenantId = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedManagedServiceIdentity.type = ResourceIdentityType.fromString(reader.getString()); + } else if ("userAssignedIdentities".equals(fieldName)) { + Map userAssignedIdentities + = reader.readMap(reader1 -> ManagedServiceIdentityUserAssignedIdentities.fromJson(reader1)); + deserializedManagedServiceIdentity.userAssignedIdentities = userAssignedIdentities; + } else { + reader.skipChildren(); + } + } + + return deserializedManagedServiceIdentity; + }); + } +} 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..5a1948bb29791 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ManagedServiceIdentityUserAssignedIdentities.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ManagedServiceIdentityUserAssignedIdentities model. + */ +@Immutable +public final class ManagedServiceIdentityUserAssignedIdentities + implements JsonSerializable { + /* + * The principal id of user assigned identity. + */ + private String principalId; + + /* + * The client id of user assigned identity. + */ + private String clientId; + + /** + * Creates an instance of ManagedServiceIdentityUserAssignedIdentities class. + */ + public ManagedServiceIdentityUserAssignedIdentities() { + } + + /** + * 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedServiceIdentityUserAssignedIdentities from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedServiceIdentityUserAssignedIdentities if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ManagedServiceIdentityUserAssignedIdentities. + */ + public static ManagedServiceIdentityUserAssignedIdentities fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedServiceIdentityUserAssignedIdentities deserializedManagedServiceIdentityUserAssignedIdentities + = new ManagedServiceIdentityUserAssignedIdentities(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("principalId".equals(fieldName)) { + deserializedManagedServiceIdentityUserAssignedIdentities.principalId = reader.getString(); + } else if ("clientId".equals(fieldName)) { + deserializedManagedServiceIdentityUserAssignedIdentities.clientId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedManagedServiceIdentityUserAssignedIdentities; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MaterializedViewsBuilderRegionalServiceResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MaterializedViewsBuilderRegionalServiceResource.java new file mode 100644 index 0000000000000..f558c27b440d0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MaterializedViewsBuilderRegionalServiceResource.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.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Resource for a regional service location. + */ +@Immutable +public final class MaterializedViewsBuilderRegionalServiceResource extends RegionalServiceResource { + /* + * Describes the status of a service. + */ + private ServiceStatus status; + + /* + * The location name. + */ + private String location; + + /* + * The regional service name. + */ + private String name; + + /** + * Creates an instance of MaterializedViewsBuilderRegionalServiceResource class. + */ + public MaterializedViewsBuilderRegionalServiceResource() { + } + + /** + * Get the status property: Describes the status of a service. + * + * @return the status value. + */ + @Override + public ServiceStatus status() { + return this.status; + } + + /** + * Get the location property: The location name. + * + * @return the location value. + */ + @Override + public String location() { + return this.location; + } + + /** + * Get the name property: The regional service name. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MaterializedViewsBuilderRegionalServiceResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MaterializedViewsBuilderRegionalServiceResource if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the MaterializedViewsBuilderRegionalServiceResource. + */ + public static MaterializedViewsBuilderRegionalServiceResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MaterializedViewsBuilderRegionalServiceResource deserializedMaterializedViewsBuilderRegionalServiceResource + = new MaterializedViewsBuilderRegionalServiceResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedMaterializedViewsBuilderRegionalServiceResource.name = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedMaterializedViewsBuilderRegionalServiceResource.location = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedMaterializedViewsBuilderRegionalServiceResource.status + = ServiceStatus.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedMaterializedViewsBuilderRegionalServiceResource; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MaterializedViewsBuilderServiceResourceCreateUpdateProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MaterializedViewsBuilderServiceResourceCreateUpdateProperties.java new file mode 100644 index 0000000000000..84b1c61685658 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MaterializedViewsBuilderServiceResourceCreateUpdateProperties.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Properties for Create or Update request for MaterializedViewsBuilderServiceResource. + */ +@Fluent +public final class MaterializedViewsBuilderServiceResourceCreateUpdateProperties + extends ServiceResourceCreateUpdateProperties { + /* + * ServiceType for the service. + */ + private ServiceType serviceType = ServiceType.MATERIALIZED_VIEWS_BUILDER; + + /** + * Creates an instance of MaterializedViewsBuilderServiceResourceCreateUpdateProperties class. + */ + public MaterializedViewsBuilderServiceResourceCreateUpdateProperties() { + } + + /** + * Get the serviceType property: ServiceType for the service. + * + * @return the serviceType value. + */ + @Override + public ServiceType serviceType() { + return this.serviceType; + } + + /** + * {@inheritDoc} + */ + @Override + public MaterializedViewsBuilderServiceResourceCreateUpdateProperties withInstanceSize(ServiceSize instanceSize) { + super.withInstanceSize(instanceSize); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public MaterializedViewsBuilderServiceResourceCreateUpdateProperties withInstanceCount(Integer instanceCount) { + super.withInstanceCount(instanceCount); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("instanceSize", instanceSize() == null ? null : instanceSize().toString()); + jsonWriter.writeNumberField("instanceCount", instanceCount()); + jsonWriter.writeStringField("serviceType", this.serviceType == null ? null : this.serviceType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MaterializedViewsBuilderServiceResourceCreateUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MaterializedViewsBuilderServiceResourceCreateUpdateProperties if the JsonReader was + * pointing to an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the + * MaterializedViewsBuilderServiceResourceCreateUpdateProperties. + */ + public static MaterializedViewsBuilderServiceResourceCreateUpdateProperties fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + MaterializedViewsBuilderServiceResourceCreateUpdateProperties deserializedMaterializedViewsBuilderServiceResourceCreateUpdateProperties + = new MaterializedViewsBuilderServiceResourceCreateUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("instanceSize".equals(fieldName)) { + deserializedMaterializedViewsBuilderServiceResourceCreateUpdateProperties + .withInstanceSize(ServiceSize.fromString(reader.getString())); + } else if ("instanceCount".equals(fieldName)) { + deserializedMaterializedViewsBuilderServiceResourceCreateUpdateProperties + .withInstanceCount(reader.getNullable(JsonReader::getInt)); + } else if ("serviceType".equals(fieldName)) { + deserializedMaterializedViewsBuilderServiceResourceCreateUpdateProperties.serviceType + = ServiceType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedMaterializedViewsBuilderServiceResourceCreateUpdateProperties; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MaterializedViewsBuilderServiceResourceProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MaterializedViewsBuilderServiceResourceProperties.java new file mode 100644 index 0000000000000..784b10808fa1a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MaterializedViewsBuilderServiceResourceProperties.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** + * Properties for MaterializedViewsBuilderServiceResource. + */ +@Fluent +public final class MaterializedViewsBuilderServiceResourceProperties extends ServiceResourceProperties { + /* + * ServiceType for the service. + */ + private ServiceType serviceType = ServiceType.MATERIALIZED_VIEWS_BUILDER; + + /* + * An array that contains all of the locations for the service. + */ + private List locations; + + /* + * Describes the status of a service. + */ + private ServiceStatus status; + + /* + * Time of the last state change (ISO-8601 format). + */ + private OffsetDateTime creationTime; + + /** + * Creates an instance of MaterializedViewsBuilderServiceResourceProperties class. + */ + public MaterializedViewsBuilderServiceResourceProperties() { + } + + /** + * Get the serviceType property: ServiceType for the service. + * + * @return the serviceType value. + */ + @Override + public ServiceType serviceType() { + return this.serviceType; + } + + /** + * 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; + } + + /** + * Get the status property: Describes the status of a service. + * + * @return the status value. + */ + @Override + public ServiceStatus status() { + return this.status; + } + + /** + * Get the creationTime property: Time of the last state change (ISO-8601 format). + * + * @return the creationTime value. + */ + @Override + public OffsetDateTime creationTime() { + return this.creationTime; + } + + /** + * {@inheritDoc} + */ + @Override + public MaterializedViewsBuilderServiceResourceProperties withInstanceSize(ServiceSize instanceSize) { + super.withInstanceSize(instanceSize); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public MaterializedViewsBuilderServiceResourceProperties withInstanceCount(Integer instanceCount) { + super.withInstanceCount(instanceCount); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (locations() != null) { + locations().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("instanceSize", instanceSize() == null ? null : instanceSize().toString()); + jsonWriter.writeNumberField("instanceCount", instanceCount()); + jsonWriter.writeStringField("serviceType", this.serviceType == null ? null : this.serviceType.toString()); + if (additionalProperties() != null) { + for (Map.Entry additionalProperty : additionalProperties().entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MaterializedViewsBuilderServiceResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MaterializedViewsBuilderServiceResourceProperties if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the MaterializedViewsBuilderServiceResourceProperties. + */ + public static MaterializedViewsBuilderServiceResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MaterializedViewsBuilderServiceResourceProperties deserializedMaterializedViewsBuilderServiceResourceProperties + = new MaterializedViewsBuilderServiceResourceProperties(); + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("creationTime".equals(fieldName)) { + deserializedMaterializedViewsBuilderServiceResourceProperties.creationTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("instanceSize".equals(fieldName)) { + deserializedMaterializedViewsBuilderServiceResourceProperties + .withInstanceSize(ServiceSize.fromString(reader.getString())); + } else if ("instanceCount".equals(fieldName)) { + deserializedMaterializedViewsBuilderServiceResourceProperties + .withInstanceCount(reader.getNullable(JsonReader::getInt)); + } else if ("status".equals(fieldName)) { + deserializedMaterializedViewsBuilderServiceResourceProperties.status + = ServiceStatus.fromString(reader.getString()); + } else if ("serviceType".equals(fieldName)) { + deserializedMaterializedViewsBuilderServiceResourceProperties.serviceType + = ServiceType.fromString(reader.getString()); + } else if ("locations".equals(fieldName)) { + List locations = reader + .readArray(reader1 -> MaterializedViewsBuilderRegionalServiceResource.fromJson(reader1)); + deserializedMaterializedViewsBuilderServiceResourceProperties.locations = locations; + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.readUntyped()); + } + } + deserializedMaterializedViewsBuilderServiceResourceProperties + .withAdditionalProperties(additionalProperties); + + return deserializedMaterializedViewsBuilderServiceResourceProperties; + }); + } +} 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..4685ed16f20ad --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Metric.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.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..0091e43c6a64d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricAvailability.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The availability of the metric. + */ +@Immutable +public final class MetricAvailability implements JsonSerializable { + /* + * The time grain to be used to summarize the metric values. + */ + private String timeGrain; + + /* + * The retention for the metric values. + */ + private String retention; + + /** + * Creates an instance of MetricAvailability class. + */ + public MetricAvailability() { + } + + /** + * 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MetricAvailability from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MetricAvailability if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the MetricAvailability. + */ + public static MetricAvailability fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MetricAvailability deserializedMetricAvailability = new MetricAvailability(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("timeGrain".equals(fieldName)) { + deserializedMetricAvailability.timeGrain = reader.getString(); + } else if ("retention".equals(fieldName)) { + deserializedMetricAvailability.retention = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMetricAvailability; + }); + } +} 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..42823c1d5a8c3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricDefinition.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.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..4788e3b360fbf --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricDefinitionsListResult.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricDefinitionInner; +import java.io.IOException; +import java.util.List; + +/** + * The response to a list metric definitions request. + */ +@Immutable +public final class MetricDefinitionsListResult implements JsonSerializable { + /* + * The list of metric definitions for the account. + */ + private List value; + + /** + * Creates an instance of MetricDefinitionsListResult class. + */ + public MetricDefinitionsListResult() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MetricDefinitionsListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MetricDefinitionsListResult if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the MetricDefinitionsListResult. + */ + public static MetricDefinitionsListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MetricDefinitionsListResult deserializedMetricDefinitionsListResult = new MetricDefinitionsListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> MetricDefinitionInner.fromJson(reader1)); + deserializedMetricDefinitionsListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedMetricDefinitionsListResult; + }); + } +} 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..d24e3cd38a664 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricListResult.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.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricInner; +import java.io.IOException; +import java.util.List; + +/** + * The response to a list metrics request. + */ +@Immutable +public final class MetricListResult implements JsonSerializable { + /* + * The list of metrics for the account. + */ + private List value; + + /** + * Creates an instance of MetricListResult class. + */ + public MetricListResult() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MetricListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MetricListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the MetricListResult. + */ + public static MetricListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MetricListResult deserializedMetricListResult = new MetricListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> MetricInner.fromJson(reader1)); + deserializedMetricListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedMetricListResult; + }); + } +} 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..2c32000cf95a4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricName.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * A metric name. + */ +@Immutable +public final class MetricName implements JsonSerializable { + /* + * The name of the metric. + */ + private String value; + + /* + * The friendly name of the metric. + */ + private String localizedValue; + + /** + * Creates an instance of MetricName class. + */ + public MetricName() { + } + + /** + * 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MetricName from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MetricName if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the MetricName. + */ + public static MetricName fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MetricName deserializedMetricName = new MetricName(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + deserializedMetricName.value = reader.getString(); + } else if ("localizedValue".equals(fieldName)) { + deserializedMetricName.localizedValue = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMetricName; + }); + } +} 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..ac43be2f6d638 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricValue.java @@ -0,0 +1,230 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * Represents metrics values. + */ +@Immutable +public class MetricValue implements JsonSerializable { + /* + * The number of values for the metric. + */ + private Integer count; + + /* + * The average value of the metric. + */ + private Double average; + + /* + * The max value of the metric. + */ + private Double maximum; + + /* + * The min value of the metric. + */ + private Double minimum; + + /* + * The metric timestamp (ISO-8601 format). + */ + private OffsetDateTime timestamp; + + /* + * The total value of the metric. + */ + private Double total; + + /** + * Creates an instance of MetricValue class. + */ + public MetricValue() { + } + + /** + * Get the count property: The number of values for the metric. + * + * @return the count value. + */ + public Integer count() { + return this.count; + } + + /** + * Set the count property: The number of values for the metric. + * + * @param count the count value to set. + * @return the MetricValue object itself. + */ + MetricValue withCount(Integer count) { + this.count = count; + return this; + } + + /** + * Get the average property: The average value of the metric. + * + * @return the average value. + */ + public Double average() { + return this.average; + } + + /** + * Set the average property: The average value of the metric. + * + * @param average the average value to set. + * @return the MetricValue object itself. + */ + MetricValue withAverage(Double average) { + this.average = average; + return this; + } + + /** + * Get the maximum property: The max value of the metric. + * + * @return the maximum value. + */ + public Double maximum() { + return this.maximum; + } + + /** + * Set the maximum property: The max value of the metric. + * + * @param maximum the maximum value to set. + * @return the MetricValue object itself. + */ + MetricValue withMaximum(Double maximum) { + this.maximum = maximum; + return this; + } + + /** + * Get the minimum property: The min value of the metric. + * + * @return the minimum value. + */ + public Double minimum() { + return this.minimum; + } + + /** + * Set the minimum property: The min value of the metric. + * + * @param minimum the minimum value to set. + * @return the MetricValue object itself. + */ + MetricValue withMinimum(Double minimum) { + this.minimum = minimum; + return this; + } + + /** + * Get the timestamp property: The metric timestamp (ISO-8601 format). + * + * @return the timestamp value. + */ + public OffsetDateTime timestamp() { + return this.timestamp; + } + + /** + * Set the timestamp property: The metric timestamp (ISO-8601 format). + * + * @param timestamp the timestamp value to set. + * @return the MetricValue object itself. + */ + MetricValue withTimestamp(OffsetDateTime timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Get the total property: The total value of the metric. + * + * @return the total value. + */ + public Double total() { + return this.total; + } + + /** + * Set the total property: The total value of the metric. + * + * @param total the total value to set. + * @return the MetricValue object itself. + */ + MetricValue withTotal(Double total) { + this.total = total; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MetricValue from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MetricValue if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the MetricValue. + */ + public static MetricValue fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MetricValue deserializedMetricValue = new MetricValue(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("_count".equals(fieldName)) { + deserializedMetricValue.count = reader.getNullable(JsonReader::getInt); + } else if ("average".equals(fieldName)) { + deserializedMetricValue.average = reader.getNullable(JsonReader::getDouble); + } else if ("maximum".equals(fieldName)) { + deserializedMetricValue.maximum = reader.getNullable(JsonReader::getDouble); + } else if ("minimum".equals(fieldName)) { + deserializedMetricValue.minimum = reader.getNullable(JsonReader::getDouble); + } else if ("timestamp".equals(fieldName)) { + deserializedMetricValue.timestamp = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("total".equals(fieldName)) { + deserializedMetricValue.total = reader.getNullable(JsonReader::getDouble); + } else { + reader.skipChildren(); + } + } + + return deserializedMetricValue; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MinimalTlsVersion.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MinimalTlsVersion.java new file mode 100644 index 0000000000000..a866edcaa6926 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MinimalTlsVersion.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.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Indicates the minimum allowed Tls version. The default value is Tls 1.2. Cassandra and Mongo APIs only work with Tls + * 1.2. + */ +public final class MinimalTlsVersion extends ExpandableStringEnum { + /** + * Static value Tls for MinimalTlsVersion. + */ + public static final MinimalTlsVersion TLS = fromString("Tls"); + + /** + * Static value Tls11 for MinimalTlsVersion. + */ + public static final MinimalTlsVersion TLS11 = fromString("Tls11"); + + /** + * Static value Tls12 for MinimalTlsVersion. + */ + public static final MinimalTlsVersion TLS12 = fromString("Tls12"); + + /** + * Creates a new instance of MinimalTlsVersion value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public MinimalTlsVersion() { + } + + /** + * Creates or finds a MinimalTlsVersion from its string representation. + * + * @param name a name to look for. + * @return the corresponding MinimalTlsVersion. + */ + public static MinimalTlsVersion fromString(String name) { + return fromString(name, MinimalTlsVersion.class); + } + + /** + * Gets known MinimalTlsVersion values. + * + * @return known MinimalTlsVersion values. + */ + public static Collection values() { + return values(MinimalTlsVersion.class); + } +} 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..e695bec56dc88 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionCreateUpdateParameters.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MongoDBCollectionCreateUpdateProperties; +import java.io.IOException; +import java.util.Map; + +/** + * Parameters to create and update Cosmos DB MongoDB collection. + */ +@Fluent +public final class MongoDBCollectionCreateUpdateParameters extends ArmResourceProperties { + /* + * Properties to create and update Azure Cosmos DB MongoDB collection. + */ + private MongoDBCollectionCreateUpdateProperties innerProperties = new MongoDBCollectionCreateUpdateProperties(); + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of MongoDBCollectionCreateUpdateParameters class. + */ + public MongoDBCollectionCreateUpdateParameters() { + } + + /** + * Get the innerProperties property: Properties to create and update Azure Cosmos DB MongoDB collection. + * + * @return the innerProperties value. + */ + private MongoDBCollectionCreateUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@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() { + if (innerProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property innerProperties in model MongoDBCollectionCreateUpdateParameters")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MongoDBCollectionCreateUpdateParameters.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MongoDBCollectionCreateUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MongoDBCollectionCreateUpdateParameters if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MongoDBCollectionCreateUpdateParameters. + */ + public static MongoDBCollectionCreateUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MongoDBCollectionCreateUpdateParameters deserializedMongoDBCollectionCreateUpdateParameters + = new MongoDBCollectionCreateUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedMongoDBCollectionCreateUpdateParameters.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedMongoDBCollectionCreateUpdateParameters.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedMongoDBCollectionCreateUpdateParameters.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedMongoDBCollectionCreateUpdateParameters.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedMongoDBCollectionCreateUpdateParameters.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedMongoDBCollectionCreateUpdateParameters.innerProperties + = MongoDBCollectionCreateUpdateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMongoDBCollectionCreateUpdateParameters; + }); + } +} 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..b9e3ce2b68abb --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionGetPropertiesOptions.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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The MongoDBCollectionGetPropertiesOptions model. + */ +@Fluent +public final class MongoDBCollectionGetPropertiesOptions extends OptionsResource { + /** + * Creates an instance of MongoDBCollectionGetPropertiesOptions class. + */ + public MongoDBCollectionGetPropertiesOptions() { + } + + /** + * {@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() { + if (autoscaleSettings() != null) { + autoscaleSettings().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("throughput", throughput()); + jsonWriter.writeJsonField("autoscaleSettings", autoscaleSettings()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MongoDBCollectionGetPropertiesOptions from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MongoDBCollectionGetPropertiesOptions if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the MongoDBCollectionGetPropertiesOptions. + */ + public static MongoDBCollectionGetPropertiesOptions fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MongoDBCollectionGetPropertiesOptions deserializedMongoDBCollectionGetPropertiesOptions + = new MongoDBCollectionGetPropertiesOptions(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("throughput".equals(fieldName)) { + deserializedMongoDBCollectionGetPropertiesOptions + .withThroughput(reader.getNullable(JsonReader::getInt)); + } else if ("autoscaleSettings".equals(fieldName)) { + deserializedMongoDBCollectionGetPropertiesOptions + .withAutoscaleSettings(AutoscaleSettings.fromJson(reader)); + } else { + reader.skipChildren(); + } + } + + return deserializedMongoDBCollectionGetPropertiesOptions; + }); + } +} 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..9b03a771e9743 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionGetPropertiesResource.java @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * The MongoDBCollectionGetPropertiesResource model. + */ +@Fluent +public final class MongoDBCollectionGetPropertiesResource extends MongoDBCollectionResource { + /* + * A system generated property. A unique identifier. + */ + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of the resource. + */ + private Float ts; + + /* + * A system generated property representing the resource etag required for optimistic concurrency control. + */ + private String etag; + + /** + * Creates an instance of MongoDBCollectionGetPropertiesResource class. + */ + public MongoDBCollectionGetPropertiesResource() { + } + + /** + * 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; + } + + /** + * {@inheritDoc} + */ + @Override + public MongoDBCollectionGetPropertiesResource withRestoreParameters(ResourceRestoreParameters restoreParameters) { + super.withRestoreParameters(restoreParameters); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public MongoDBCollectionGetPropertiesResource withCreateMode(CreateMode createMode) { + super.withCreateMode(createMode); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (id() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property id in model MongoDBCollectionGetPropertiesResource")); + } + if (indexes() != null) { + indexes().forEach(e -> e.validate()); + } + if (restoreParameters() != null) { + restoreParameters().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MongoDBCollectionGetPropertiesResource.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", id()); + jsonWriter.writeMapField("shardKey", shardKey(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("indexes", indexes(), (writer, element) -> writer.writeJson(element)); + jsonWriter.writeNumberField("analyticalStorageTtl", analyticalStorageTtl()); + jsonWriter.writeJsonField("restoreParameters", restoreParameters()); + jsonWriter.writeStringField("createMode", createMode() == null ? null : createMode().toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MongoDBCollectionGetPropertiesResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MongoDBCollectionGetPropertiesResource if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MongoDBCollectionGetPropertiesResource. + */ + public static MongoDBCollectionGetPropertiesResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MongoDBCollectionGetPropertiesResource deserializedMongoDBCollectionGetPropertiesResource + = new MongoDBCollectionGetPropertiesResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedMongoDBCollectionGetPropertiesResource.withId(reader.getString()); + } else if ("shardKey".equals(fieldName)) { + Map shardKey = reader.readMap(reader1 -> reader1.getString()); + deserializedMongoDBCollectionGetPropertiesResource.withShardKey(shardKey); + } else if ("indexes".equals(fieldName)) { + List indexes = reader.readArray(reader1 -> MongoIndex.fromJson(reader1)); + deserializedMongoDBCollectionGetPropertiesResource.withIndexes(indexes); + } else if ("analyticalStorageTtl".equals(fieldName)) { + deserializedMongoDBCollectionGetPropertiesResource + .withAnalyticalStorageTtl(reader.getNullable(JsonReader::getInt)); + } else if ("restoreParameters".equals(fieldName)) { + deserializedMongoDBCollectionGetPropertiesResource + .withRestoreParameters(ResourceRestoreParameters.fromJson(reader)); + } else if ("createMode".equals(fieldName)) { + deserializedMongoDBCollectionGetPropertiesResource + .withCreateMode(CreateMode.fromString(reader.getString())); + } else if ("_rid".equals(fieldName)) { + deserializedMongoDBCollectionGetPropertiesResource.rid = reader.getString(); + } else if ("_ts".equals(fieldName)) { + deserializedMongoDBCollectionGetPropertiesResource.ts = reader.getNullable(JsonReader::getFloat); + } else if ("_etag".equals(fieldName)) { + deserializedMongoDBCollectionGetPropertiesResource.etag = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMongoDBCollectionGetPropertiesResource; + }); + } +} 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..76347f2642db0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionGetResults.java @@ -0,0 +1,319 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 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 name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * 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.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 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.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 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); + + /** + * Retrieves continuous backup information for a Mongodb collection. + * + * @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 Mongodb collection. + * + * @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/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..790a44a02649f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionListResult.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MongoDBCollectionGetResultsInner; +import java.io.IOException; +import java.util.List; + +/** + * The List operation response, that contains the MongoDB collections and their properties. + */ +@Immutable +public final class MongoDBCollectionListResult implements JsonSerializable { + /* + * List of MongoDB collections and their properties. + */ + private List value; + + /** + * Creates an instance of MongoDBCollectionListResult class. + */ + public MongoDBCollectionListResult() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MongoDBCollectionListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MongoDBCollectionListResult if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the MongoDBCollectionListResult. + */ + public static MongoDBCollectionListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MongoDBCollectionListResult deserializedMongoDBCollectionListResult = new MongoDBCollectionListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> MongoDBCollectionGetResultsInner.fromJson(reader1)); + deserializedMongoDBCollectionListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedMongoDBCollectionListResult; + }); + } +} 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..e5504b57a94c1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionResource.java @@ -0,0 +1,252 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * Cosmos DB MongoDB collection resource object. + */ +@Fluent +public class MongoDBCollectionResource implements JsonSerializable { + /* + * Name of the Cosmos DB MongoDB collection + */ + private String id; + + /* + * A key-value pair of shard keys to be applied for the request. + */ + private Map shardKey; + + /* + * List of index keys + */ + private List indexes; + + /* + * Analytical TTL. + */ + private Integer analyticalStorageTtl; + + /* + * Parameters to indicate the information about the restore + */ + private ResourceRestoreParameters restoreParameters; + + /* + * Enum to indicate the mode of resource creation. + */ + private CreateMode createMode; + + /** + * Creates an instance of MongoDBCollectionResource class. + */ + public MongoDBCollectionResource() { + } + + /** + * 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; + } + + /** + * Get the restoreParameters property: Parameters to indicate the information about the restore. + * + * @return the restoreParameters value. + */ + public ResourceRestoreParameters 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 MongoDBCollectionResource object itself. + */ + public MongoDBCollectionResource withRestoreParameters(ResourceRestoreParameters restoreParameters) { + this.restoreParameters = restoreParameters; + return this; + } + + /** + * Get the createMode property: Enum to indicate the mode of resource creation. + * + * @return the createMode value. + */ + public CreateMode createMode() { + return this.createMode; + } + + /** + * Set the createMode property: Enum to indicate the mode of resource creation. + * + * @param createMode the createMode value to set. + * @return the MongoDBCollectionResource object itself. + */ + public MongoDBCollectionResource withCreateMode(CreateMode createMode) { + this.createMode = createMode; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property id in model MongoDBCollectionResource")); + } + if (indexes() != null) { + indexes().forEach(e -> e.validate()); + } + if (restoreParameters() != null) { + restoreParameters().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MongoDBCollectionResource.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeMapField("shardKey", this.shardKey, (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("indexes", this.indexes, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeNumberField("analyticalStorageTtl", this.analyticalStorageTtl); + jsonWriter.writeJsonField("restoreParameters", this.restoreParameters); + jsonWriter.writeStringField("createMode", this.createMode == null ? null : this.createMode.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MongoDBCollectionResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MongoDBCollectionResource if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MongoDBCollectionResource. + */ + public static MongoDBCollectionResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MongoDBCollectionResource deserializedMongoDBCollectionResource = new MongoDBCollectionResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedMongoDBCollectionResource.id = reader.getString(); + } else if ("shardKey".equals(fieldName)) { + Map shardKey = reader.readMap(reader1 -> reader1.getString()); + deserializedMongoDBCollectionResource.shardKey = shardKey; + } else if ("indexes".equals(fieldName)) { + List indexes = reader.readArray(reader1 -> MongoIndex.fromJson(reader1)); + deserializedMongoDBCollectionResource.indexes = indexes; + } else if ("analyticalStorageTtl".equals(fieldName)) { + deserializedMongoDBCollectionResource.analyticalStorageTtl = reader.getNullable(JsonReader::getInt); + } else if ("restoreParameters".equals(fieldName)) { + deserializedMongoDBCollectionResource.restoreParameters + = ResourceRestoreParameters.fromJson(reader); + } else if ("createMode".equals(fieldName)) { + deserializedMongoDBCollectionResource.createMode = CreateMode.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedMongoDBCollectionResource; + }); + } +} 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..87ffbd64bd27f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseCreateUpdateParameters.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MongoDBDatabaseCreateUpdateProperties; +import java.io.IOException; +import java.util.Map; + +/** + * Parameters to create and update Cosmos DB MongoDB database. + */ +@Fluent +public final class MongoDBDatabaseCreateUpdateParameters extends ArmResourceProperties { + /* + * Properties to create and update Azure Cosmos DB MongoDB database. + */ + private MongoDBDatabaseCreateUpdateProperties innerProperties = new MongoDBDatabaseCreateUpdateProperties(); + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of MongoDBDatabaseCreateUpdateParameters class. + */ + public MongoDBDatabaseCreateUpdateParameters() { + } + + /** + * Get the innerProperties property: Properties to create and update Azure Cosmos DB MongoDB database. + * + * @return the innerProperties value. + */ + private MongoDBDatabaseCreateUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@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() { + if (innerProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property innerProperties in model MongoDBDatabaseCreateUpdateParameters")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MongoDBDatabaseCreateUpdateParameters.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MongoDBDatabaseCreateUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MongoDBDatabaseCreateUpdateParameters if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MongoDBDatabaseCreateUpdateParameters. + */ + public static MongoDBDatabaseCreateUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MongoDBDatabaseCreateUpdateParameters deserializedMongoDBDatabaseCreateUpdateParameters + = new MongoDBDatabaseCreateUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedMongoDBDatabaseCreateUpdateParameters.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedMongoDBDatabaseCreateUpdateParameters.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedMongoDBDatabaseCreateUpdateParameters.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedMongoDBDatabaseCreateUpdateParameters.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedMongoDBDatabaseCreateUpdateParameters.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedMongoDBDatabaseCreateUpdateParameters.innerProperties + = MongoDBDatabaseCreateUpdateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMongoDBDatabaseCreateUpdateParameters; + }); + } +} 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..7a66f81304ce4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseGetPropertiesOptions.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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The MongoDBDatabaseGetPropertiesOptions model. + */ +@Fluent +public final class MongoDBDatabaseGetPropertiesOptions extends OptionsResource { + /** + * Creates an instance of MongoDBDatabaseGetPropertiesOptions class. + */ + public MongoDBDatabaseGetPropertiesOptions() { + } + + /** + * {@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() { + if (autoscaleSettings() != null) { + autoscaleSettings().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("throughput", throughput()); + jsonWriter.writeJsonField("autoscaleSettings", autoscaleSettings()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MongoDBDatabaseGetPropertiesOptions from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MongoDBDatabaseGetPropertiesOptions if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the MongoDBDatabaseGetPropertiesOptions. + */ + public static MongoDBDatabaseGetPropertiesOptions fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MongoDBDatabaseGetPropertiesOptions deserializedMongoDBDatabaseGetPropertiesOptions + = new MongoDBDatabaseGetPropertiesOptions(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("throughput".equals(fieldName)) { + deserializedMongoDBDatabaseGetPropertiesOptions + .withThroughput(reader.getNullable(JsonReader::getInt)); + } else if ("autoscaleSettings".equals(fieldName)) { + deserializedMongoDBDatabaseGetPropertiesOptions + .withAutoscaleSettings(AutoscaleSettings.fromJson(reader)); + } else { + reader.skipChildren(); + } + } + + return deserializedMongoDBDatabaseGetPropertiesOptions; + }); + } +} 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..157324809f8ea --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseGetPropertiesResource.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The MongoDBDatabaseGetPropertiesResource model. + */ +@Fluent +public final class MongoDBDatabaseGetPropertiesResource extends MongoDBDatabaseResource { + /* + * A system generated property. A unique identifier. + */ + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of the resource. + */ + private Float ts; + + /* + * A system generated property representing the resource etag required for optimistic concurrency control. + */ + private String etag; + + /** + * Creates an instance of MongoDBDatabaseGetPropertiesResource class. + */ + public MongoDBDatabaseGetPropertiesResource() { + } + + /** + * 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; + } + + /** + * {@inheritDoc} + */ + @Override + public MongoDBDatabaseGetPropertiesResource withRestoreParameters(ResourceRestoreParameters restoreParameters) { + super.withRestoreParameters(restoreParameters); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public MongoDBDatabaseGetPropertiesResource withCreateMode(CreateMode createMode) { + super.withCreateMode(createMode); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (id() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property id in model MongoDBDatabaseGetPropertiesResource")); + } + if (restoreParameters() != null) { + restoreParameters().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MongoDBDatabaseGetPropertiesResource.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", id()); + jsonWriter.writeJsonField("restoreParameters", restoreParameters()); + jsonWriter.writeStringField("createMode", createMode() == null ? null : createMode().toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MongoDBDatabaseGetPropertiesResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MongoDBDatabaseGetPropertiesResource if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MongoDBDatabaseGetPropertiesResource. + */ + public static MongoDBDatabaseGetPropertiesResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MongoDBDatabaseGetPropertiesResource deserializedMongoDBDatabaseGetPropertiesResource + = new MongoDBDatabaseGetPropertiesResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedMongoDBDatabaseGetPropertiesResource.withId(reader.getString()); + } else if ("restoreParameters".equals(fieldName)) { + deserializedMongoDBDatabaseGetPropertiesResource + .withRestoreParameters(ResourceRestoreParameters.fromJson(reader)); + } else if ("createMode".equals(fieldName)) { + deserializedMongoDBDatabaseGetPropertiesResource + .withCreateMode(CreateMode.fromString(reader.getString())); + } else if ("_rid".equals(fieldName)) { + deserializedMongoDBDatabaseGetPropertiesResource.rid = reader.getString(); + } else if ("_ts".equals(fieldName)) { + deserializedMongoDBDatabaseGetPropertiesResource.ts = reader.getNullable(JsonReader::getFloat); + } else if ("_etag".equals(fieldName)) { + deserializedMongoDBDatabaseGetPropertiesResource.etag = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMongoDBDatabaseGetPropertiesResource; + }); + } +} 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..07e048daf1446 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseGetResults.java @@ -0,0 +1,295 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 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 name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * 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.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 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.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 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..6d7392cd2a247 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseListResult.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MongoDBDatabaseGetResultsInner; +import java.io.IOException; +import java.util.List; + +/** + * The List operation response, that contains the MongoDB databases and their properties. + */ +@Immutable +public final class MongoDBDatabaseListResult implements JsonSerializable { + /* + * List of MongoDB databases and their properties. + */ + private List value; + + /** + * Creates an instance of MongoDBDatabaseListResult class. + */ + public MongoDBDatabaseListResult() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MongoDBDatabaseListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MongoDBDatabaseListResult if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the MongoDBDatabaseListResult. + */ + public static MongoDBDatabaseListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MongoDBDatabaseListResult deserializedMongoDBDatabaseListResult = new MongoDBDatabaseListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> MongoDBDatabaseGetResultsInner.fromJson(reader1)); + deserializedMongoDBDatabaseListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedMongoDBDatabaseListResult; + }); + } +} 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..3b9c3d1c59c33 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseResource.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Cosmos DB MongoDB database resource object. + */ +@Fluent +public class MongoDBDatabaseResource implements JsonSerializable { + /* + * Name of the Cosmos DB MongoDB database + */ + private String id; + + /* + * Parameters to indicate the information about the restore + */ + private ResourceRestoreParameters restoreParameters; + + /* + * Enum to indicate the mode of resource creation. + */ + private CreateMode createMode; + + /** + * Creates an instance of MongoDBDatabaseResource class. + */ + public MongoDBDatabaseResource() { + } + + /** + * 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; + } + + /** + * Get the restoreParameters property: Parameters to indicate the information about the restore. + * + * @return the restoreParameters value. + */ + public ResourceRestoreParameters 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 MongoDBDatabaseResource object itself. + */ + public MongoDBDatabaseResource withRestoreParameters(ResourceRestoreParameters restoreParameters) { + this.restoreParameters = restoreParameters; + return this; + } + + /** + * Get the createMode property: Enum to indicate the mode of resource creation. + * + * @return the createMode value. + */ + public CreateMode createMode() { + return this.createMode; + } + + /** + * Set the createMode property: Enum to indicate the mode of resource creation. + * + * @param createMode the createMode value to set. + * @return the MongoDBDatabaseResource object itself. + */ + public MongoDBDatabaseResource withCreateMode(CreateMode createMode) { + this.createMode = createMode; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property id in model MongoDBDatabaseResource")); + } + if (restoreParameters() != null) { + restoreParameters().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MongoDBDatabaseResource.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeJsonField("restoreParameters", this.restoreParameters); + jsonWriter.writeStringField("createMode", this.createMode == null ? null : this.createMode.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MongoDBDatabaseResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MongoDBDatabaseResource if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MongoDBDatabaseResource. + */ + public static MongoDBDatabaseResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MongoDBDatabaseResource deserializedMongoDBDatabaseResource = new MongoDBDatabaseResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedMongoDBDatabaseResource.id = reader.getString(); + } else if ("restoreParameters".equals(fieldName)) { + deserializedMongoDBDatabaseResource.restoreParameters = ResourceRestoreParameters.fromJson(reader); + } else if ("createMode".equals(fieldName)) { + deserializedMongoDBDatabaseResource.createMode = CreateMode.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedMongoDBDatabaseResource; + }); + } +} 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..de7b79d554921 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBResources.java @@ -0,0 +1,849 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 as paginated + * response with {@link PagedIterable}. + */ + 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 as paginated + * response with {@link PagedIterable}. + */ + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along + * with {@link Response}. + */ + Response getMongoDBDatabaseWithResponse(String resourceGroupName, String accountName, + String databaseName, 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); + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + Response getMongoDBDatabaseThroughputWithResponse(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); + + /** + * 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 as paginated + * response with {@link PagedIterable}. + */ + 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 as paginated + * response with {@link PagedIterable}. + */ + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + Response getMongoDBCollectionWithResponse(String resourceGroupName, String accountName, + String databaseName, String collectionName, 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); + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + Response getMongoDBCollectionThroughputWithResponse(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); + + /** + * 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); + + /** + * Retrieves the properties of an existing Azure Cosmos DB Mongo Role Definition with the given Id. + * + * @param mongoRoleDefinitionId The ID for the Role Definition {dbName.roleName}. + * @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 Mongo Role Definition along with {@link Response}. + */ + Response getMongoRoleDefinitionWithResponse(String mongoRoleDefinitionId, + String resourceGroupName, String accountName, Context context); + + /** + * Retrieves the properties of an existing Azure Cosmos DB Mongo Role Definition with the given Id. + * + * @param mongoRoleDefinitionId The ID for the Role Definition {dbName.roleName}. + * @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 Mongo Role Definition. + */ + MongoRoleDefinitionGetResults getMongoRoleDefinition(String mongoRoleDefinitionId, String resourceGroupName, + String accountName); + + /** + * Deletes an existing Azure Cosmos DB Mongo Role Definition. + * + * @param mongoRoleDefinitionId The ID for the Role Definition {dbName.roleName}. + * @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 deleteMongoRoleDefinition(String mongoRoleDefinitionId, String resourceGroupName, String accountName); + + /** + * Deletes an existing Azure Cosmos DB Mongo Role Definition. + * + * @param mongoRoleDefinitionId The ID for the Role Definition {dbName.roleName}. + * @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 deleteMongoRoleDefinition(String mongoRoleDefinitionId, String resourceGroupName, String accountName, + Context context); + + /** + * Retrieves the list of all Azure Cosmos DB Mongo 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 Mongo Role Definitions as paginated response with {@link PagedIterable}. + */ + PagedIterable listMongoRoleDefinitions(String resourceGroupName, String accountName); + + /** + * Retrieves the list of all Azure Cosmos DB Mongo 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 Mongo Role Definitions as paginated response with {@link PagedIterable}. + */ + PagedIterable listMongoRoleDefinitions(String resourceGroupName, String accountName, + Context context); + + /** + * Retrieves the properties of an existing Azure Cosmos DB Mongo User Definition with the given Id. + * + * @param mongoUserDefinitionId The ID for the User Definition {dbName.userName}. + * @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 User Definition along with {@link Response}. + */ + Response getMongoUserDefinitionWithResponse(String mongoUserDefinitionId, + String resourceGroupName, String accountName, Context context); + + /** + * Retrieves the properties of an existing Azure Cosmos DB Mongo User Definition with the given Id. + * + * @param mongoUserDefinitionId The ID for the User Definition {dbName.userName}. + * @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 User Definition. + */ + MongoUserDefinitionGetResults getMongoUserDefinition(String mongoUserDefinitionId, String resourceGroupName, + String accountName); + + /** + * Deletes an existing Azure Cosmos DB Mongo User Definition. + * + * @param mongoUserDefinitionId The ID for the User Definition {dbName.userName}. + * @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 deleteMongoUserDefinition(String mongoUserDefinitionId, String resourceGroupName, String accountName); + + /** + * Deletes an existing Azure Cosmos DB Mongo User Definition. + * + * @param mongoUserDefinitionId The ID for the User Definition {dbName.userName}. + * @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 deleteMongoUserDefinition(String mongoUserDefinitionId, String resourceGroupName, String accountName, + Context context); + + /** + * Retrieves the list of all Azure Cosmos DB Mongo User 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 relevant User Definition as paginated response with {@link PagedIterable}. + */ + PagedIterable listMongoUserDefinitions(String resourceGroupName, String accountName); + + /** + * Retrieves the list of all Azure Cosmos DB Mongo User 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 relevant User Definition as paginated response with {@link PagedIterable}. + */ + PagedIterable listMongoUserDefinitions(String resourceGroupName, String accountName, + Context context); + + /** + * Retrieves continuous backup information for a 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 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 collectionName, ContinuousBackupRestoreLocation location); + + /** + * Retrieves continuous backup information for a 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 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 collectionName, ContinuousBackupRestoreLocation location, 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 along + * with {@link Response}. + */ + 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 along + * with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + Response getMongoDBCollectionByIdWithResponse(String id, Context context); + + /** + * Retrieves the properties of an existing Azure Cosmos DB Mongo 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 Mongo Role Definition along with {@link Response}. + */ + MongoRoleDefinitionGetResults getMongoRoleDefinitionById(String id); + + /** + * Retrieves the properties of an existing Azure Cosmos DB Mongo 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 Mongo Role Definition along with {@link Response}. + */ + Response getMongoRoleDefinitionByIdWithResponse(String id, Context context); + + /** + * Retrieves the properties of an existing Azure Cosmos DB Mongo User 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 User Definition along with {@link Response}. + */ + MongoUserDefinitionGetResults getMongoUserDefinitionById(String id); + + /** + * Retrieves the properties of an existing Azure Cosmos DB Mongo User 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 User Definition along with {@link Response}. + */ + Response getMongoUserDefinitionByIdWithResponse(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); + + /** + * Deletes an existing Azure Cosmos DB Mongo 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 deleteMongoRoleDefinitionById(String id); + + /** + * Deletes an existing Azure Cosmos DB Mongo 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 deleteMongoRoleDefinitionByIdWithResponse(String id, Context context); + + /** + * Deletes an existing Azure Cosmos DB Mongo User 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 deleteMongoUserDefinitionById(String id); + + /** + * Deletes an existing Azure Cosmos DB Mongo User 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 deleteMongoUserDefinitionByIdWithResponse(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); + + /** + * Begins definition for a new MongoRoleDefinitionGetResults resource. + * + * @param name resource name. + * @return the first stage of the new MongoRoleDefinitionGetResults definition. + */ + MongoRoleDefinitionGetResults.DefinitionStages.Blank defineUpdateMongoRoleDefinition(String name); + + /** + * Begins definition for a new MongoUserDefinitionGetResults resource. + * + * @param name resource name. + * @return the first stage of the new MongoUserDefinitionGetResults definition. + */ + MongoUserDefinitionGetResults.DefinitionStages.Blank defineUpdateMongoUserDefinition(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..c32c1e4e5ba1d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoIndex.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Cosmos DB MongoDB collection index key. + */ +@Fluent +public final class MongoIndex implements JsonSerializable { + /* + * Cosmos DB MongoDB collection index keys + */ + private MongoIndexKeys key; + + /* + * Cosmos DB MongoDB collection index key options + */ + private MongoIndexOptions options; + + /** + * Creates an instance of MongoIndex class. + */ + public MongoIndex() { + } + + /** + * 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("key", this.key); + jsonWriter.writeJsonField("options", this.options); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MongoIndex from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MongoIndex if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the MongoIndex. + */ + public static MongoIndex fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MongoIndex deserializedMongoIndex = new MongoIndex(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("key".equals(fieldName)) { + deserializedMongoIndex.key = MongoIndexKeys.fromJson(reader); + } else if ("options".equals(fieldName)) { + deserializedMongoIndex.options = MongoIndexOptions.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMongoIndex; + }); + } +} 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..1486b4422d439 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoIndexKeys.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Cosmos DB MongoDB collection resource object. + */ +@Fluent +public final class MongoIndexKeys implements JsonSerializable { + /* + * List of keys for each MongoDB collection in the Azure Cosmos DB service + */ + private List keys; + + /** + * Creates an instance of MongoIndexKeys class. + */ + public MongoIndexKeys() { + } + + /** + * 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("keys", this.keys, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MongoIndexKeys from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MongoIndexKeys if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the MongoIndexKeys. + */ + public static MongoIndexKeys fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MongoIndexKeys deserializedMongoIndexKeys = new MongoIndexKeys(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("keys".equals(fieldName)) { + List keys = reader.readArray(reader1 -> reader1.getString()); + deserializedMongoIndexKeys.keys = keys; + } else { + reader.skipChildren(); + } + } + + return deserializedMongoIndexKeys; + }); + } +} 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..a6ade4e2e764b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoIndexOptions.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Cosmos DB MongoDB collection index options. + */ +@Fluent +public final class MongoIndexOptions implements JsonSerializable { + /* + * Expire after seconds + */ + private Integer expireAfterSeconds; + + /* + * Is unique or not + */ + private Boolean unique; + + /** + * Creates an instance of MongoIndexOptions class. + */ + public MongoIndexOptions() { + } + + /** + * 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("expireAfterSeconds", this.expireAfterSeconds); + jsonWriter.writeBooleanField("unique", this.unique); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MongoIndexOptions from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MongoIndexOptions if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the MongoIndexOptions. + */ + public static MongoIndexOptions fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MongoIndexOptions deserializedMongoIndexOptions = new MongoIndexOptions(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("expireAfterSeconds".equals(fieldName)) { + deserializedMongoIndexOptions.expireAfterSeconds = reader.getNullable(JsonReader::getInt); + } else if ("unique".equals(fieldName)) { + deserializedMongoIndexOptions.unique = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedMongoIndexOptions; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoRoleDefinitionCreateUpdateParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoRoleDefinitionCreateUpdateParameters.java new file mode 100644 index 0000000000000..07bdf28ccfe4f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoRoleDefinitionCreateUpdateParameters.java @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MongoRoleDefinitionResource; +import java.io.IOException; +import java.util.List; + +/** + * Parameters to create and update an Azure Cosmos DB Mongo Role Definition. + */ +@Fluent +public final class MongoRoleDefinitionCreateUpdateParameters + implements JsonSerializable { + /* + * Properties to create and update an Azure Cosmos DB Mongo Role Definition. + */ + private MongoRoleDefinitionResource innerProperties; + + /** + * Creates an instance of MongoRoleDefinitionCreateUpdateParameters class. + */ + public MongoRoleDefinitionCreateUpdateParameters() { + } + + /** + * Get the innerProperties property: Properties to create and update an Azure Cosmos DB Mongo Role Definition. + * + * @return the innerProperties value. + */ + private MongoRoleDefinitionResource 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 MongoRoleDefinitionCreateUpdateParameters object itself. + */ + public MongoRoleDefinitionCreateUpdateParameters withRoleName(String roleName) { + if (this.innerProperties() == null) { + this.innerProperties = new MongoRoleDefinitionResource(); + } + 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 MongoRoleDefinitionType 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 MongoRoleDefinitionCreateUpdateParameters object itself. + */ + public MongoRoleDefinitionCreateUpdateParameters withType(MongoRoleDefinitionType type) { + if (this.innerProperties() == null) { + this.innerProperties = new MongoRoleDefinitionResource(); + } + this.innerProperties().withType(type); + return this; + } + + /** + * Get the databaseName property: The database name for which access is being granted for this Role Definition. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.innerProperties() == null ? null : this.innerProperties().databaseName(); + } + + /** + * Set the databaseName property: The database name for which access is being granted for this Role Definition. + * + * @param databaseName the databaseName value to set. + * @return the MongoRoleDefinitionCreateUpdateParameters object itself. + */ + public MongoRoleDefinitionCreateUpdateParameters withDatabaseName(String databaseName) { + if (this.innerProperties() == null) { + this.innerProperties = new MongoRoleDefinitionResource(); + } + this.innerProperties().withDatabaseName(databaseName); + return this; + } + + /** + * Get the privileges property: A set of privileges contained by the Role Definition. This will allow application of + * this Role Definition on the entire database account or any underlying Database / Collection. Scopes higher than + * Database are not enforceable as privilege. + * + * @return the privileges value. + */ + public List privileges() { + return this.innerProperties() == null ? null : this.innerProperties().privileges(); + } + + /** + * Set the privileges property: A set of privileges contained by the Role Definition. This will allow application of + * this Role Definition on the entire database account or any underlying Database / Collection. Scopes higher than + * Database are not enforceable as privilege. + * + * @param privileges the privileges value to set. + * @return the MongoRoleDefinitionCreateUpdateParameters object itself. + */ + public MongoRoleDefinitionCreateUpdateParameters withPrivileges(List privileges) { + if (this.innerProperties() == null) { + this.innerProperties = new MongoRoleDefinitionResource(); + } + this.innerProperties().withPrivileges(privileges); + return this; + } + + /** + * Get the roles property: The set of roles inherited by this Role Definition. + * + * @return the roles value. + */ + public List roles() { + return this.innerProperties() == null ? null : this.innerProperties().roles(); + } + + /** + * Set the roles property: The set of roles inherited by this Role Definition. + * + * @param roles the roles value to set. + * @return the MongoRoleDefinitionCreateUpdateParameters object itself. + */ + public MongoRoleDefinitionCreateUpdateParameters withRoles(List roles) { + if (this.innerProperties() == null) { + this.innerProperties = new MongoRoleDefinitionResource(); + } + this.innerProperties().withRoles(roles); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MongoRoleDefinitionCreateUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MongoRoleDefinitionCreateUpdateParameters if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the MongoRoleDefinitionCreateUpdateParameters. + */ + public static MongoRoleDefinitionCreateUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MongoRoleDefinitionCreateUpdateParameters deserializedMongoRoleDefinitionCreateUpdateParameters + = new MongoRoleDefinitionCreateUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedMongoRoleDefinitionCreateUpdateParameters.innerProperties + = MongoRoleDefinitionResource.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMongoRoleDefinitionCreateUpdateParameters; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoRoleDefinitionGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoRoleDefinitionGetResults.java new file mode 100644 index 0000000000000..0064f0eeb1bfc --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoRoleDefinitionGetResults.java @@ -0,0 +1,332 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.MongoRoleDefinitionGetResultsInner; +import java.util.List; + +/** + * An immutable client-side representation of MongoRoleDefinitionGetResults. + */ +public interface MongoRoleDefinitionGetResults { + /** + * 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. + */ + MongoRoleDefinitionType typePropertiesType(); + + /** + * Gets the databaseName property: The database name for which access is being granted for this Role Definition. + * + * @return the databaseName value. + */ + String databaseName(); + + /** + * Gets the privileges property: A set of privileges contained by the Role Definition. This will allow application + * of this Role Definition on the entire database account or any underlying Database / Collection. Scopes higher + * than Database are not enforceable as privilege. + * + * @return the privileges value. + */ + List privileges(); + + /** + * Gets the roles property: The set of roles inherited by this Role Definition. + * + * @return the roles value. + */ + List roles(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.MongoRoleDefinitionGetResultsInner + * object. + * + * @return the inner object. + */ + MongoRoleDefinitionGetResultsInner innerModel(); + + /** + * The entirety of the MongoRoleDefinitionGetResults definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The MongoRoleDefinitionGetResults definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the MongoRoleDefinitionGetResults definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the MongoRoleDefinitionGetResults 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 MongoRoleDefinitionGetResults 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.WithDatabaseName, DefinitionStages.WithPrivileges, DefinitionStages.WithRoles { + /** + * Executes the create request. + * + * @return the created resource. + */ + MongoRoleDefinitionGetResults create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + MongoRoleDefinitionGetResults create(Context context); + } + + /** + * The stage of the MongoRoleDefinitionGetResults 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 MongoRoleDefinitionGetResults 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(MongoRoleDefinitionType type); + } + + /** + * The stage of the MongoRoleDefinitionGetResults definition allowing to specify databaseName. + */ + interface WithDatabaseName { + /** + * Specifies the databaseName property: The database name for which access is being granted for this Role + * Definition.. + * + * @param databaseName The database name for which access is being granted for this Role Definition. + * @return the next definition stage. + */ + WithCreate withDatabaseName(String databaseName); + } + + /** + * The stage of the MongoRoleDefinitionGetResults definition allowing to specify privileges. + */ + interface WithPrivileges { + /** + * Specifies the privileges property: A set of privileges contained by the Role Definition. This will allow + * application of this Role Definition on the entire database account or any underlying Database / + * Collection. Scopes higher than Database are not enforceable as privilege.. + * + * @param privileges A set of privileges contained by the Role Definition. This will allow application of + * this Role Definition on the entire database account or any underlying Database / Collection. Scopes + * higher than Database are not enforceable as privilege. + * @return the next definition stage. + */ + WithCreate withPrivileges(List privileges); + } + + /** + * The stage of the MongoRoleDefinitionGetResults definition allowing to specify roles. + */ + interface WithRoles { + /** + * Specifies the roles property: The set of roles inherited by this Role Definition.. + * + * @param roles The set of roles inherited by this Role Definition. + * @return the next definition stage. + */ + WithCreate withRoles(List roles); + } + } + + /** + * Begins update for the MongoRoleDefinitionGetResults resource. + * + * @return the stage of resource update. + */ + MongoRoleDefinitionGetResults.Update update(); + + /** + * The template for MongoRoleDefinitionGetResults update. + */ + interface Update extends UpdateStages.WithRoleName, UpdateStages.WithType, UpdateStages.WithDatabaseName, + UpdateStages.WithPrivileges, UpdateStages.WithRoles { + /** + * Executes the update request. + * + * @return the updated resource. + */ + MongoRoleDefinitionGetResults apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + MongoRoleDefinitionGetResults apply(Context context); + } + + /** + * The MongoRoleDefinitionGetResults update stages. + */ + interface UpdateStages { + /** + * The stage of the MongoRoleDefinitionGetResults 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 MongoRoleDefinitionGetResults 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(MongoRoleDefinitionType type); + } + + /** + * The stage of the MongoRoleDefinitionGetResults update allowing to specify databaseName. + */ + interface WithDatabaseName { + /** + * Specifies the databaseName property: The database name for which access is being granted for this Role + * Definition.. + * + * @param databaseName The database name for which access is being granted for this Role Definition. + * @return the next definition stage. + */ + Update withDatabaseName(String databaseName); + } + + /** + * The stage of the MongoRoleDefinitionGetResults update allowing to specify privileges. + */ + interface WithPrivileges { + /** + * Specifies the privileges property: A set of privileges contained by the Role Definition. This will allow + * application of this Role Definition on the entire database account or any underlying Database / + * Collection. Scopes higher than Database are not enforceable as privilege.. + * + * @param privileges A set of privileges contained by the Role Definition. This will allow application of + * this Role Definition on the entire database account or any underlying Database / Collection. Scopes + * higher than Database are not enforceable as privilege. + * @return the next definition stage. + */ + Update withPrivileges(List privileges); + } + + /** + * The stage of the MongoRoleDefinitionGetResults update allowing to specify roles. + */ + interface WithRoles { + /** + * Specifies the roles property: The set of roles inherited by this Role Definition.. + * + * @param roles The set of roles inherited by this Role Definition. + * @return the next definition stage. + */ + Update withRoles(List roles); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + MongoRoleDefinitionGetResults refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + MongoRoleDefinitionGetResults refresh(Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoRoleDefinitionListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoRoleDefinitionListResult.java new file mode 100644 index 0000000000000..bd827e25ce5e7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoRoleDefinitionListResult.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.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MongoRoleDefinitionGetResultsInner; +import java.io.IOException; +import java.util.List; + +/** + * The relevant Mongo Role Definitions. + */ +@Immutable +public final class MongoRoleDefinitionListResult implements JsonSerializable { + /* + * List of Mongo Role Definitions and their properties. + */ + private List value; + + /** + * Creates an instance of MongoRoleDefinitionListResult class. + */ + public MongoRoleDefinitionListResult() { + } + + /** + * Get the value property: List of Mongo 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MongoRoleDefinitionListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MongoRoleDefinitionListResult if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the MongoRoleDefinitionListResult. + */ + public static MongoRoleDefinitionListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MongoRoleDefinitionListResult deserializedMongoRoleDefinitionListResult + = new MongoRoleDefinitionListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> MongoRoleDefinitionGetResultsInner.fromJson(reader1)); + deserializedMongoRoleDefinitionListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedMongoRoleDefinitionListResult; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoRoleDefinitionType.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoRoleDefinitionType.java new file mode 100644 index 0000000000000..9b0ea7059caf7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoRoleDefinitionType.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; + +/** + * Indicates whether the Role Definition was built-in or user created. + */ +public enum MongoRoleDefinitionType { + /** + * Enum value BuiltInRole. + */ + BUILT_IN_ROLE("BuiltInRole"), + + /** + * Enum value CustomRole. + */ + CUSTOM_ROLE("CustomRole"); + + /** + * The actual serialized value for a MongoRoleDefinitionType instance. + */ + private final String value; + + MongoRoleDefinitionType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a MongoRoleDefinitionType instance. + * + * @param value the serialized value to parse. + * @return the parsed MongoRoleDefinitionType object, or null if unable to parse. + */ + public static MongoRoleDefinitionType fromString(String value) { + if (value == null) { + return null; + } + MongoRoleDefinitionType[] items = MongoRoleDefinitionType.values(); + for (MongoRoleDefinitionType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @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/MongoUserDefinitionCreateUpdateParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoUserDefinitionCreateUpdateParameters.java new file mode 100644 index 0000000000000..d2238afba2904 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoUserDefinitionCreateUpdateParameters.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MongoUserDefinitionResource; +import java.io.IOException; +import java.util.List; + +/** + * Parameters to create and update an Azure Cosmos DB Mongo User Definition. + */ +@Fluent +public final class MongoUserDefinitionCreateUpdateParameters + implements JsonSerializable { + /* + * Properties to create and update an Azure Cosmos DB Mongo User Definition. + */ + private MongoUserDefinitionResource innerProperties; + + /** + * Creates an instance of MongoUserDefinitionCreateUpdateParameters class. + */ + public MongoUserDefinitionCreateUpdateParameters() { + } + + /** + * Get the innerProperties property: Properties to create and update an Azure Cosmos DB Mongo User Definition. + * + * @return the innerProperties value. + */ + private MongoUserDefinitionResource innerProperties() { + return this.innerProperties; + } + + /** + * Get the username property: The user name for User Definition. + * + * @return the username value. + */ + public String username() { + return this.innerProperties() == null ? null : this.innerProperties().username(); + } + + /** + * Set the username property: The user name for User Definition. + * + * @param username the username value to set. + * @return the MongoUserDefinitionCreateUpdateParameters object itself. + */ + public MongoUserDefinitionCreateUpdateParameters withUsername(String username) { + if (this.innerProperties() == null) { + this.innerProperties = new MongoUserDefinitionResource(); + } + this.innerProperties().withUsername(username); + return this; + } + + /** + * Get the password property: The password for User Definition. Response does not contain user password. + * + * @return the password value. + */ + public String password() { + return this.innerProperties() == null ? null : this.innerProperties().password(); + } + + /** + * Set the password property: The password for User Definition. Response does not contain user password. + * + * @param password the password value to set. + * @return the MongoUserDefinitionCreateUpdateParameters object itself. + */ + public MongoUserDefinitionCreateUpdateParameters withPassword(String password) { + if (this.innerProperties() == null) { + this.innerProperties = new MongoUserDefinitionResource(); + } + this.innerProperties().withPassword(password); + return this; + } + + /** + * Get the databaseName property: The database name for which access is being granted for this User Definition. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.innerProperties() == null ? null : this.innerProperties().databaseName(); + } + + /** + * Set the databaseName property: The database name for which access is being granted for this User Definition. + * + * @param databaseName the databaseName value to set. + * @return the MongoUserDefinitionCreateUpdateParameters object itself. + */ + public MongoUserDefinitionCreateUpdateParameters withDatabaseName(String databaseName) { + if (this.innerProperties() == null) { + this.innerProperties = new MongoUserDefinitionResource(); + } + this.innerProperties().withDatabaseName(databaseName); + return this; + } + + /** + * Get the customData property: A custom definition for the USer Definition. + * + * @return the customData value. + */ + public String customData() { + return this.innerProperties() == null ? null : this.innerProperties().customData(); + } + + /** + * Set the customData property: A custom definition for the USer Definition. + * + * @param customData the customData value to set. + * @return the MongoUserDefinitionCreateUpdateParameters object itself. + */ + public MongoUserDefinitionCreateUpdateParameters withCustomData(String customData) { + if (this.innerProperties() == null) { + this.innerProperties = new MongoUserDefinitionResource(); + } + this.innerProperties().withCustomData(customData); + return this; + } + + /** + * Get the roles property: The set of roles inherited by the User Definition. + * + * @return the roles value. + */ + public List roles() { + return this.innerProperties() == null ? null : this.innerProperties().roles(); + } + + /** + * Set the roles property: The set of roles inherited by the User Definition. + * + * @param roles the roles value to set. + * @return the MongoUserDefinitionCreateUpdateParameters object itself. + */ + public MongoUserDefinitionCreateUpdateParameters withRoles(List roles) { + if (this.innerProperties() == null) { + this.innerProperties = new MongoUserDefinitionResource(); + } + this.innerProperties().withRoles(roles); + return this; + } + + /** + * Get the mechanisms property: The Mongo Auth mechanism. For now, we only support auth mechanism SCRAM-SHA-256. + * + * @return the mechanisms value. + */ + public String mechanisms() { + return this.innerProperties() == null ? null : this.innerProperties().mechanisms(); + } + + /** + * Set the mechanisms property: The Mongo Auth mechanism. For now, we only support auth mechanism SCRAM-SHA-256. + * + * @param mechanisms the mechanisms value to set. + * @return the MongoUserDefinitionCreateUpdateParameters object itself. + */ + public MongoUserDefinitionCreateUpdateParameters withMechanisms(String mechanisms) { + if (this.innerProperties() == null) { + this.innerProperties = new MongoUserDefinitionResource(); + } + this.innerProperties().withMechanisms(mechanisms); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MongoUserDefinitionCreateUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MongoUserDefinitionCreateUpdateParameters if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the MongoUserDefinitionCreateUpdateParameters. + */ + public static MongoUserDefinitionCreateUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MongoUserDefinitionCreateUpdateParameters deserializedMongoUserDefinitionCreateUpdateParameters + = new MongoUserDefinitionCreateUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedMongoUserDefinitionCreateUpdateParameters.innerProperties + = MongoUserDefinitionResource.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMongoUserDefinitionCreateUpdateParameters; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoUserDefinitionGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoUserDefinitionGetResults.java new file mode 100644 index 0000000000000..c6a44a3012ecb --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoUserDefinitionGetResults.java @@ -0,0 +1,357 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.MongoUserDefinitionGetResultsInner; +import java.util.List; + +/** + * An immutable client-side representation of MongoUserDefinitionGetResults. + */ +public interface MongoUserDefinitionGetResults { + /** + * 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 username property: The user name for User Definition. + * + * @return the username value. + */ + String username(); + + /** + * Gets the password property: The password for User Definition. Response does not contain user password. + * + * @return the password value. + */ + String password(); + + /** + * Gets the databaseName property: The database name for which access is being granted for this User Definition. + * + * @return the databaseName value. + */ + String databaseName(); + + /** + * Gets the customData property: A custom definition for the USer Definition. + * + * @return the customData value. + */ + String customData(); + + /** + * Gets the roles property: The set of roles inherited by the User Definition. + * + * @return the roles value. + */ + List roles(); + + /** + * Gets the mechanisms property: The Mongo Auth mechanism. For now, we only support auth mechanism SCRAM-SHA-256. + * + * @return the mechanisms value. + */ + String mechanisms(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.MongoUserDefinitionGetResultsInner + * object. + * + * @return the inner object. + */ + MongoUserDefinitionGetResultsInner innerModel(); + + /** + * The entirety of the MongoUserDefinitionGetResults definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The MongoUserDefinitionGetResults definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the MongoUserDefinitionGetResults definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the MongoUserDefinitionGetResults 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 MongoUserDefinitionGetResults 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.WithUsername, DefinitionStages.WithPassword, DefinitionStages.WithDatabaseName, + DefinitionStages.WithCustomData, DefinitionStages.WithRoles, DefinitionStages.WithMechanisms { + /** + * Executes the create request. + * + * @return the created resource. + */ + MongoUserDefinitionGetResults create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + MongoUserDefinitionGetResults create(Context context); + } + + /** + * The stage of the MongoUserDefinitionGetResults definition allowing to specify username. + */ + interface WithUsername { + /** + * Specifies the username property: The user name for User Definition.. + * + * @param username The user name for User Definition. + * @return the next definition stage. + */ + WithCreate withUsername(String username); + } + + /** + * The stage of the MongoUserDefinitionGetResults definition allowing to specify password. + */ + interface WithPassword { + /** + * Specifies the password property: The password for User Definition. Response does not contain user + * password.. + * + * @param password The password for User Definition. Response does not contain user password. + * @return the next definition stage. + */ + WithCreate withPassword(String password); + } + + /** + * The stage of the MongoUserDefinitionGetResults definition allowing to specify databaseName. + */ + interface WithDatabaseName { + /** + * Specifies the databaseName property: The database name for which access is being granted for this User + * Definition.. + * + * @param databaseName The database name for which access is being granted for this User Definition. + * @return the next definition stage. + */ + WithCreate withDatabaseName(String databaseName); + } + + /** + * The stage of the MongoUserDefinitionGetResults definition allowing to specify customData. + */ + interface WithCustomData { + /** + * Specifies the customData property: A custom definition for the USer Definition.. + * + * @param customData A custom definition for the USer Definition. + * @return the next definition stage. + */ + WithCreate withCustomData(String customData); + } + + /** + * The stage of the MongoUserDefinitionGetResults definition allowing to specify roles. + */ + interface WithRoles { + /** + * Specifies the roles property: The set of roles inherited by the User Definition.. + * + * @param roles The set of roles inherited by the User Definition. + * @return the next definition stage. + */ + WithCreate withRoles(List roles); + } + + /** + * The stage of the MongoUserDefinitionGetResults definition allowing to specify mechanisms. + */ + interface WithMechanisms { + /** + * Specifies the mechanisms property: The Mongo Auth mechanism. For now, we only support auth mechanism + * SCRAM-SHA-256.. + * + * @param mechanisms The Mongo Auth mechanism. For now, we only support auth mechanism SCRAM-SHA-256. + * @return the next definition stage. + */ + WithCreate withMechanisms(String mechanisms); + } + } + + /** + * Begins update for the MongoUserDefinitionGetResults resource. + * + * @return the stage of resource update. + */ + MongoUserDefinitionGetResults.Update update(); + + /** + * The template for MongoUserDefinitionGetResults update. + */ + interface Update extends UpdateStages.WithUsername, UpdateStages.WithPassword, UpdateStages.WithDatabaseName, + UpdateStages.WithCustomData, UpdateStages.WithRoles, UpdateStages.WithMechanisms { + /** + * Executes the update request. + * + * @return the updated resource. + */ + MongoUserDefinitionGetResults apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + MongoUserDefinitionGetResults apply(Context context); + } + + /** + * The MongoUserDefinitionGetResults update stages. + */ + interface UpdateStages { + /** + * The stage of the MongoUserDefinitionGetResults update allowing to specify username. + */ + interface WithUsername { + /** + * Specifies the username property: The user name for User Definition.. + * + * @param username The user name for User Definition. + * @return the next definition stage. + */ + Update withUsername(String username); + } + + /** + * The stage of the MongoUserDefinitionGetResults update allowing to specify password. + */ + interface WithPassword { + /** + * Specifies the password property: The password for User Definition. Response does not contain user + * password.. + * + * @param password The password for User Definition. Response does not contain user password. + * @return the next definition stage. + */ + Update withPassword(String password); + } + + /** + * The stage of the MongoUserDefinitionGetResults update allowing to specify databaseName. + */ + interface WithDatabaseName { + /** + * Specifies the databaseName property: The database name for which access is being granted for this User + * Definition.. + * + * @param databaseName The database name for which access is being granted for this User Definition. + * @return the next definition stage. + */ + Update withDatabaseName(String databaseName); + } + + /** + * The stage of the MongoUserDefinitionGetResults update allowing to specify customData. + */ + interface WithCustomData { + /** + * Specifies the customData property: A custom definition for the USer Definition.. + * + * @param customData A custom definition for the USer Definition. + * @return the next definition stage. + */ + Update withCustomData(String customData); + } + + /** + * The stage of the MongoUserDefinitionGetResults update allowing to specify roles. + */ + interface WithRoles { + /** + * Specifies the roles property: The set of roles inherited by the User Definition.. + * + * @param roles The set of roles inherited by the User Definition. + * @return the next definition stage. + */ + Update withRoles(List roles); + } + + /** + * The stage of the MongoUserDefinitionGetResults update allowing to specify mechanisms. + */ + interface WithMechanisms { + /** + * Specifies the mechanisms property: The Mongo Auth mechanism. For now, we only support auth mechanism + * SCRAM-SHA-256.. + * + * @param mechanisms The Mongo Auth mechanism. For now, we only support auth mechanism SCRAM-SHA-256. + * @return the next definition stage. + */ + Update withMechanisms(String mechanisms); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + MongoUserDefinitionGetResults refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + MongoUserDefinitionGetResults refresh(Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoUserDefinitionListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoUserDefinitionListResult.java new file mode 100644 index 0000000000000..68e973124dac9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoUserDefinitionListResult.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.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MongoUserDefinitionGetResultsInner; +import java.io.IOException; +import java.util.List; + +/** + * The relevant User Definition. + */ +@Immutable +public final class MongoUserDefinitionListResult implements JsonSerializable { + /* + * List of User Definition and their properties + */ + private List value; + + /** + * Creates an instance of MongoUserDefinitionListResult class. + */ + public MongoUserDefinitionListResult() { + } + + /** + * Get the value property: List of User Definition 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MongoUserDefinitionListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MongoUserDefinitionListResult if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the MongoUserDefinitionListResult. + */ + public static MongoUserDefinitionListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MongoUserDefinitionListResult deserializedMongoUserDefinitionListResult + = new MongoUserDefinitionListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> MongoUserDefinitionGetResultsInner.fromJson(reader1)); + deserializedMongoUserDefinitionListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedMongoUserDefinitionListResult; + }); + } +} 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..4848fd7065ae4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NetworkAclBypass.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; + +/** + * Indicates what services are allowed to bypass firewall checks. + */ +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. + */ + public static NetworkAclBypass fromString(String value) { + if (value == null) { + return null; + } + NetworkAclBypass[] items = NetworkAclBypass.values(); + for (NetworkAclBypass item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @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..c831e33467763 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NodeState.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.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The state of the node in Cassandra ring. + */ +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 a new instance of NodeState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public NodeState() { + } + + /** + * Creates or finds a NodeState from its string representation. + * + * @param name a name to look for. + * @return the corresponding NodeState. + */ + public static NodeState fromString(String name) { + return fromString(name, NodeState.class); + } + + /** + * Gets known NodeState values. + * + * @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/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..20c1505fa3b63 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspace.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * 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. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + Response listConnectionInfoWithResponse(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(); + + /** + * 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..439d6573d9352 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspaceConnectionInfoResult.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.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..f6970ee60bf63 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspaceCreateUpdateParameters.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.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Parameters to create a notebook workspace resource. + */ +@Immutable +public final class NotebookWorkspaceCreateUpdateParameters extends ArmProxyResource { + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of NotebookWorkspaceCreateUpdateParameters class. + */ + public NotebookWorkspaceCreateUpdateParameters() { + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NotebookWorkspaceCreateUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NotebookWorkspaceCreateUpdateParameters if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the NotebookWorkspaceCreateUpdateParameters. + */ + public static NotebookWorkspaceCreateUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NotebookWorkspaceCreateUpdateParameters deserializedNotebookWorkspaceCreateUpdateParameters + = new NotebookWorkspaceCreateUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedNotebookWorkspaceCreateUpdateParameters.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedNotebookWorkspaceCreateUpdateParameters.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedNotebookWorkspaceCreateUpdateParameters.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedNotebookWorkspaceCreateUpdateParameters; + }); + } +} 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..310c01edca13b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspaceListResult.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.NotebookWorkspaceInner; +import java.io.IOException; +import java.util.List; + +/** + * A list of notebook workspace resources. + */ +@Fluent +public final class NotebookWorkspaceListResult implements JsonSerializable { + /* + * Array of notebook workspace resources + */ + private List value; + + /** + * Creates an instance of NotebookWorkspaceListResult class. + */ + public NotebookWorkspaceListResult() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NotebookWorkspaceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NotebookWorkspaceListResult if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the NotebookWorkspaceListResult. + */ + public static NotebookWorkspaceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NotebookWorkspaceListResult deserializedNotebookWorkspaceListResult = new NotebookWorkspaceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> NotebookWorkspaceInner.fromJson(reader1)); + deserializedNotebookWorkspaceListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedNotebookWorkspaceListResult; + }); + } +} 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..29f1609fa599d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspaceName.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 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 a new instance of NotebookWorkspaceName value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public NotebookWorkspaceName() { + } + + /** + * Creates or finds a NotebookWorkspaceName from its string representation. + * + * @param name a name to look for. + * @return the corresponding NotebookWorkspaceName. + */ + public static NotebookWorkspaceName fromString(String name) { + return fromString(name, NotebookWorkspaceName.class); + } + + /** + * Gets known NotebookWorkspaceName values. + * + * @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..a998b7b2fa357 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspaces.java @@ -0,0 +1,229 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 as paginated response with + * {@link PagedIterable}. + */ + 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 as paginated response with + * {@link PagedIterable}. + */ + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String accountName, + NotebookWorkspaceName notebookWorkspaceName, 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); + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + Response listConnectionInfoWithResponse(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); + + /** + * 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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..5ebed0bfe9783 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Operation.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.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..33fd827d60278 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/OperationDisplay.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The object that represents the operation. + */ +@Fluent +public final class OperationDisplay implements JsonSerializable { + /* + * Service provider: Microsoft.ResourceProvider + */ + private String provider; + + /* + * Resource on which the operation is performed: Profile, endpoint, etc. + */ + private String resource; + + /* + * Operation type: Read, write, delete, etc. + */ + private String operation; + + /* + * Description of operation + */ + private String description; + + /** + * Creates an instance of OperationDisplay class. + */ + public OperationDisplay() { + } + + /** + * 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("Provider", this.provider); + jsonWriter.writeStringField("Resource", this.resource); + jsonWriter.writeStringField("Operation", this.operation); + jsonWriter.writeStringField("Description", this.description); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationDisplay from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationDisplay if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationDisplay. + */ + public static OperationDisplay fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationDisplay deserializedOperationDisplay = new OperationDisplay(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("Provider".equals(fieldName)) { + deserializedOperationDisplay.provider = reader.getString(); + } else if ("Resource".equals(fieldName)) { + deserializedOperationDisplay.resource = reader.getString(); + } else if ("Operation".equals(fieldName)) { + deserializedOperationDisplay.operation = reader.getString(); + } else if ("Description".equals(fieldName)) { + deserializedOperationDisplay.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationDisplay; + }); + } +} 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..638781aeb7e12 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/OperationListResult.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.OperationInner; +import java.io.IOException; +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 implements JsonSerializable { + /* + * List of operations supported by the Resource Provider. + */ + private List value; + + /* + * URL to get the next set of operation list results if there are any. + */ + private String nextLink; + + /** + * Creates an instance of OperationListResult class. + */ + public OperationListResult() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationListResult. + */ + public static OperationListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationListResult deserializedOperationListResult = new OperationListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> OperationInner.fromJson(reader1)); + deserializedOperationListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedOperationListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationListResult; + }); + } +} 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..9d913feca2b40 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/OperationType.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.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Enum to indicate the operation type of the event. + */ +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 Recreate for OperationType. + */ + public static final OperationType RECREATE = fromString("Recreate"); + + /** + * Static value SystemOperation for OperationType. + */ + public static final OperationType SYSTEM_OPERATION = fromString("SystemOperation"); + + /** + * Creates a new instance of OperationType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public OperationType() { + } + + /** + * Creates or finds a OperationType from its string representation. + * + * @param name a name to look for. + * @return the corresponding OperationType. + */ + public static OperationType fromString(String name) { + return fromString(name, OperationType.class); + } + + /** + * Gets known OperationType values. + * + * @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..8ec48b3b824b8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Operations.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.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 as paginated response with + * {@link PagedIterable}. + */ + 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 as paginated response with + * {@link PagedIterable}. + */ + 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..9e16a4fafb779 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/OptionsResource.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Cosmos DB options resource object. + */ +@Fluent +public class OptionsResource implements JsonSerializable { + /* + * Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when + * retrieving offer details. + */ + private Integer throughput; + + /* + * Specifies the Autoscale settings. + */ + private AutoscaleSettings autoscaleSettings; + + /** + * Creates an instance of OptionsResource class. + */ + public OptionsResource() { + } + + /** + * 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("throughput", this.throughput); + jsonWriter.writeJsonField("autoscaleSettings", this.autoscaleSettings); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OptionsResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OptionsResource if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OptionsResource. + */ + public static OptionsResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OptionsResource deserializedOptionsResource = new OptionsResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("throughput".equals(fieldName)) { + deserializedOptionsResource.throughput = reader.getNullable(JsonReader::getInt); + } else if ("autoscaleSettings".equals(fieldName)) { + deserializedOptionsResource.autoscaleSettings = AutoscaleSettings.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedOptionsResource; + }); + } +} 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..4266d0bb4590d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionKeyRangeIdRegions.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.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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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..89fe3764b818b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionKeyRangeIds.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.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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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..f71b31263c32a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionKind.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.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Indicates the kind of algorithm used for partitioning. For MultiHash, multiple partition keys (upto three maximum) + * are supported for container create. + */ +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 a new instance of PartitionKind value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PartitionKind() { + } + + /** + * Creates or finds a PartitionKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding PartitionKind. + */ + public static PartitionKind fromString(String name) { + return fromString(name, PartitionKind.class); + } + + /** + * Gets known PartitionKind values. + * + * @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..b00c11ce921e0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionMetric.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.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..5ab40e52948ab --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionMetricListResult.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionMetricInner; +import java.io.IOException; +import java.util.List; + +/** + * The response to a list partition metrics request. + */ +@Immutable +public final class PartitionMetricListResult implements JsonSerializable { + /* + * The list of partition-level metrics for the account. + */ + private List value; + + /** + * Creates an instance of PartitionMetricListResult class. + */ + public PartitionMetricListResult() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PartitionMetricListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PartitionMetricListResult if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the PartitionMetricListResult. + */ + public static PartitionMetricListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PartitionMetricListResult deserializedPartitionMetricListResult = new PartitionMetricListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> PartitionMetricInner.fromJson(reader1)); + deserializedPartitionMetricListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedPartitionMetricListResult; + }); + } +} 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..c0180eafd419b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionUsage.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.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..c986dc36f31a1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionUsagesResult.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionUsageInner; +import java.io.IOException; +import java.util.List; + +/** + * The response to a list partition level usage request. + */ +@Immutable +public final class PartitionUsagesResult implements JsonSerializable { + /* + * The list of partition-level usages for the database. A usage is a point in time metric + */ + private List value; + + /** + * Creates an instance of PartitionUsagesResult class. + */ + public PartitionUsagesResult() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PartitionUsagesResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PartitionUsagesResult if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the PartitionUsagesResult. + */ + public static PartitionUsagesResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PartitionUsagesResult deserializedPartitionUsagesResult = new PartitionUsagesResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> PartitionUsageInner.fromJson(reader1)); + deserializedPartitionUsagesResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedPartitionUsagesResult; + }); + } +} 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..484344d6a4394 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PercentileMetric.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.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..6998dd33bf868 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PercentileMetricListResult.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PercentileMetricInner; +import java.io.IOException; +import java.util.List; + +/** + * The response to a list percentile metrics request. + */ +@Immutable +public final class PercentileMetricListResult implements JsonSerializable { + /* + * The list of percentile metrics for the account. + */ + private List value; + + /** + * Creates an instance of PercentileMetricListResult class. + */ + public PercentileMetricListResult() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PercentileMetricListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PercentileMetricListResult if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the PercentileMetricListResult. + */ + public static PercentileMetricListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PercentileMetricListResult deserializedPercentileMetricListResult = new PercentileMetricListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> PercentileMetricInner.fromJson(reader1)); + deserializedPercentileMetricListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedPercentileMetricListResult; + }); + } +} 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..4a865ab6a483e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PercentileMetricValue.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.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * Represents percentile metrics values. + */ +@Immutable +public final class PercentileMetricValue extends MetricValue { + /* + * The 10th percentile value for the metric. + */ + private Double p10; + + /* + * The 25th percentile value for the metric. + */ + private Double p25; + + /* + * The 50th percentile value for the metric. + */ + private Double p50; + + /* + * The 75th percentile value for the metric. + */ + private Double p75; + + /* + * The 90th percentile value for the metric. + */ + private Double p90; + + /* + * The 95th percentile value for the metric. + */ + private Double p95; + + /* + * The 99th percentile value for the metric. + */ + private Double p99; + + /* + * The total value of the metric. + */ + private Double total; + + /* + * The metric timestamp (ISO-8601 format). + */ + private OffsetDateTime timestamp; + + /* + * The min value of the metric. + */ + private Double minimum; + + /* + * The max value of the metric. + */ + private Double maximum; + + /* + * The average value of the metric. + */ + private Double average; + + /* + * The number of values for the metric. + */ + private Integer count; + + /** + * Creates an instance of PercentileMetricValue class. + */ + public PercentileMetricValue() { + } + + /** + * 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; + } + + /** + * Get the total property: The total value of the metric. + * + * @return the total value. + */ + @Override + public Double total() { + return this.total; + } + + /** + * Get the timestamp property: The metric timestamp (ISO-8601 format). + * + * @return the timestamp value. + */ + @Override + public OffsetDateTime timestamp() { + return this.timestamp; + } + + /** + * Get the minimum property: The min value of the metric. + * + * @return the minimum value. + */ + @Override + public Double minimum() { + return this.minimum; + } + + /** + * Get the maximum property: The max value of the metric. + * + * @return the maximum value. + */ + @Override + public Double maximum() { + return this.maximum; + } + + /** + * Get the average property: The average value of the metric. + * + * @return the average value. + */ + @Override + public Double average() { + return this.average; + } + + /** + * Get the count property: The number of values for the metric. + * + * @return the count value. + */ + @Override + public Integer count() { + return this.count; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PercentileMetricValue from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PercentileMetricValue if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the PercentileMetricValue. + */ + public static PercentileMetricValue fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PercentileMetricValue deserializedPercentileMetricValue = new PercentileMetricValue(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("_count".equals(fieldName)) { + deserializedPercentileMetricValue.count = reader.getNullable(JsonReader::getInt); + } else if ("average".equals(fieldName)) { + deserializedPercentileMetricValue.average = reader.getNullable(JsonReader::getDouble); + } else if ("maximum".equals(fieldName)) { + deserializedPercentileMetricValue.maximum = reader.getNullable(JsonReader::getDouble); + } else if ("minimum".equals(fieldName)) { + deserializedPercentileMetricValue.minimum = reader.getNullable(JsonReader::getDouble); + } else if ("timestamp".equals(fieldName)) { + deserializedPercentileMetricValue.timestamp = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("total".equals(fieldName)) { + deserializedPercentileMetricValue.total = reader.getNullable(JsonReader::getDouble); + } else if ("P10".equals(fieldName)) { + deserializedPercentileMetricValue.p10 = reader.getNullable(JsonReader::getDouble); + } else if ("P25".equals(fieldName)) { + deserializedPercentileMetricValue.p25 = reader.getNullable(JsonReader::getDouble); + } else if ("P50".equals(fieldName)) { + deserializedPercentileMetricValue.p50 = reader.getNullable(JsonReader::getDouble); + } else if ("P75".equals(fieldName)) { + deserializedPercentileMetricValue.p75 = reader.getNullable(JsonReader::getDouble); + } else if ("P90".equals(fieldName)) { + deserializedPercentileMetricValue.p90 = reader.getNullable(JsonReader::getDouble); + } else if ("P95".equals(fieldName)) { + deserializedPercentileMetricValue.p95 = reader.getNullable(JsonReader::getDouble); + } else if ("P99".equals(fieldName)) { + deserializedPercentileMetricValue.p99 = reader.getNullable(JsonReader::getDouble); + } else { + reader.skipChildren(); + } + } + + return deserializedPercentileMetricValue; + }); + } +} 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..4a9132f53d59e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PercentileSourceTargets.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.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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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..8cafe7c3b76e1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PercentileTargets.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.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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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..dfbc68f3bb138 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Percentiles.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.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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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..aee22c31bcc4b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PeriodicModeBackupPolicy.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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The object representing periodic mode backup policy. + */ +@Fluent +public final class PeriodicModeBackupPolicy extends BackupPolicy { + /* + * Describes the mode of backups. + */ + private BackupPolicyType type = BackupPolicyType.PERIODIC; + + /* + * Configuration values for periodic mode backup + */ + private PeriodicModeProperties periodicModeProperties; + + /** + * Creates an instance of PeriodicModeBackupPolicy class. + */ + public PeriodicModeBackupPolicy() { + } + + /** + * Get the type property: Describes the mode of backups. + * + * @return the type value. + */ + @Override + public BackupPolicyType type() { + return this.type; + } + + /** + * 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() { + if (periodicModeProperties() != null) { + periodicModeProperties().validate(); + } + if (migrationState() != null) { + migrationState().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("migrationState", migrationState()); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeJsonField("periodicModeProperties", this.periodicModeProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PeriodicModeBackupPolicy from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PeriodicModeBackupPolicy if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the PeriodicModeBackupPolicy. + */ + public static PeriodicModeBackupPolicy fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PeriodicModeBackupPolicy deserializedPeriodicModeBackupPolicy = new PeriodicModeBackupPolicy(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("migrationState".equals(fieldName)) { + deserializedPeriodicModeBackupPolicy + .withMigrationState(BackupPolicyMigrationState.fromJson(reader)); + } else if ("type".equals(fieldName)) { + deserializedPeriodicModeBackupPolicy.type = BackupPolicyType.fromString(reader.getString()); + } else if ("periodicModeProperties".equals(fieldName)) { + deserializedPeriodicModeBackupPolicy.periodicModeProperties + = PeriodicModeProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPeriodicModeBackupPolicy; + }); + } +} 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..1496343eac1d6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PeriodicModeProperties.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Configuration values for periodic mode backup. + */ +@Fluent +public final class PeriodicModeProperties implements JsonSerializable { + /* + * An integer representing the interval in minutes between two backups + */ + private Integer backupIntervalInMinutes; + + /* + * An integer representing the time (in hours) that each backup is retained + */ + private Integer backupRetentionIntervalInHours; + + /* + * Enum to indicate type of backup residency + */ + private BackupStorageRedundancy backupStorageRedundancy; + + /** + * Creates an instance of PeriodicModeProperties class. + */ + public PeriodicModeProperties() { + } + + /** + * 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("backupIntervalInMinutes", this.backupIntervalInMinutes); + jsonWriter.writeNumberField("backupRetentionIntervalInHours", this.backupRetentionIntervalInHours); + jsonWriter.writeStringField("backupStorageRedundancy", + this.backupStorageRedundancy == null ? null : this.backupStorageRedundancy.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PeriodicModeProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PeriodicModeProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the PeriodicModeProperties. + */ + public static PeriodicModeProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PeriodicModeProperties deserializedPeriodicModeProperties = new PeriodicModeProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupIntervalInMinutes".equals(fieldName)) { + deserializedPeriodicModeProperties.backupIntervalInMinutes = reader.getNullable(JsonReader::getInt); + } else if ("backupRetentionIntervalInHours".equals(fieldName)) { + deserializedPeriodicModeProperties.backupRetentionIntervalInHours + = reader.getNullable(JsonReader::getInt); + } else if ("backupStorageRedundancy".equals(fieldName)) { + deserializedPeriodicModeProperties.backupStorageRedundancy + = BackupStorageRedundancy.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedPeriodicModeProperties; + }); + } +} 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..0367ea9c2fa1a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Permission.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The set of data plane operations permitted through this Role Definition. + */ +@Fluent +public final class Permission implements JsonSerializable { + /* + * An array of data actions that are allowed. + */ + private List dataActions; + + /* + * An array of data actions that are denied. + */ + private List notDataActions; + + /** + * Creates an instance of Permission class. + */ + public Permission() { + } + + /** + * 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("dataActions", this.dataActions, (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("notDataActions", this.notDataActions, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Permission from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Permission if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the Permission. + */ + public static Permission fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Permission deserializedPermission = new Permission(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("dataActions".equals(fieldName)) { + List dataActions = reader.readArray(reader1 -> reader1.getString()); + deserializedPermission.dataActions = dataActions; + } else if ("notDataActions".equals(fieldName)) { + List notDataActions = reader.readArray(reader1 -> reader1.getString()); + deserializedPermission.notDataActions = notDataActions; + } else { + reader.skipChildren(); + } + } + + return deserializedPermission; + }); + } +} 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..4d47bfbec0550 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrimaryAggregationType.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.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The primary aggregation type of the metric. + */ +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 a new instance of PrimaryAggregationType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PrimaryAggregationType() { + } + + /** + * Creates or finds a PrimaryAggregationType from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrimaryAggregationType. + */ + public static PrimaryAggregationType fromString(String name) { + return fromString(name, PrimaryAggregationType.class); + } + + /** + * Gets known PrimaryAggregationType values. + * + * @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..19b130bac764b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateEndpointConnection.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * 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..77679d2c78cda --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateEndpointConnectionListResult.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PrivateEndpointConnectionInner; +import java.io.IOException; +import java.util.List; + +/** + * A list of private endpoint connections. + */ +@Fluent +public final class PrivateEndpointConnectionListResult + implements JsonSerializable { + /* + * Array of private endpoint connections + */ + private List value; + + /** + * Creates an instance of PrivateEndpointConnectionListResult class. + */ + public PrivateEndpointConnectionListResult() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateEndpointConnectionListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateEndpointConnectionListResult if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the PrivateEndpointConnectionListResult. + */ + public static PrivateEndpointConnectionListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateEndpointConnectionListResult deserializedPrivateEndpointConnectionListResult + = new PrivateEndpointConnectionListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> PrivateEndpointConnectionInner.fromJson(reader1)); + deserializedPrivateEndpointConnectionListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateEndpointConnectionListResult; + }); + } +} 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..f74c8d3d407f7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateEndpointConnections.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String accountName, + String privateEndpointConnectionName, 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); + + /** + * 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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..9be3db09d4fe5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateEndpointProperty.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Private endpoint which the connection belongs to. + */ +@Fluent +public final class PrivateEndpointProperty implements JsonSerializable { + /* + * Resource id of the private endpoint. + */ + private String id; + + /** + * Creates an instance of PrivateEndpointProperty class. + */ + public PrivateEndpointProperty() { + } + + /** + * 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateEndpointProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateEndpointProperty if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the PrivateEndpointProperty. + */ + public static PrivateEndpointProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateEndpointProperty deserializedPrivateEndpointProperty = new PrivateEndpointProperty(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPrivateEndpointProperty.id = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateEndpointProperty; + }); + } +} 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..a3fc91c300579 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateLinkResource.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.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..61632deff54a7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateLinkResourceListResult.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PrivateLinkResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * A list of private link resources. + */ +@Fluent +public final class PrivateLinkResourceListResult implements JsonSerializable { + /* + * Array of private link resources + */ + private List value; + + /** + * Creates an instance of PrivateLinkResourceListResult class. + */ + public PrivateLinkResourceListResult() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateLinkResourceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateLinkResourceListResult if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the PrivateLinkResourceListResult. + */ + public static PrivateLinkResourceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateLinkResourceListResult deserializedPrivateLinkResourceListResult + = new PrivateLinkResourceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> PrivateLinkResourceInner.fromJson(reader1)); + deserializedPrivateLinkResourceListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateLinkResourceListResult; + }); + } +} 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..4a1417a5478ff --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateLinkResources.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.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 as paginated response with + * {@link PagedIterable}. + */ + 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 as paginated response with + * {@link PagedIterable}. + */ + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String accountName, String groupName, + 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); +} 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..0c16fbd8c7e98 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateLinkServiceConnectionStateProperty.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Connection State of the Private Endpoint Connection. + */ +@Fluent +public final class PrivateLinkServiceConnectionStateProperty + implements JsonSerializable { + /* + * The private link service connection status. + */ + private String status; + + /* + * The private link service connection description. + */ + private String description; + + /* + * Any action that is required beyond basic workflow (approve/ reject/ disconnect) + */ + private String actionsRequired; + + /** + * Creates an instance of PrivateLinkServiceConnectionStateProperty class. + */ + public PrivateLinkServiceConnectionStateProperty() { + } + + /** + * 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("status", this.status); + jsonWriter.writeStringField("description", this.description); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateLinkServiceConnectionStateProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateLinkServiceConnectionStateProperty if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the PrivateLinkServiceConnectionStateProperty. + */ + public static PrivateLinkServiceConnectionStateProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateLinkServiceConnectionStateProperty deserializedPrivateLinkServiceConnectionStateProperty + = new PrivateLinkServiceConnectionStateProperty(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("status".equals(fieldName)) { + deserializedPrivateLinkServiceConnectionStateProperty.status = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedPrivateLinkServiceConnectionStateProperty.description = reader.getString(); + } else if ("actionsRequired".equals(fieldName)) { + deserializedPrivateLinkServiceConnectionStateProperty.actionsRequired = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateLinkServiceConnectionStateProperty; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Privilege.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Privilege.java new file mode 100644 index 0000000000000..905344707667d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Privilege.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The set of data plane operations permitted through this Role Definition. + */ +@Fluent +public final class Privilege implements JsonSerializable { + /* + * An Azure Cosmos DB Mongo DB Resource. + */ + private PrivilegeResource resource; + + /* + * An array of actions that are allowed. + */ + private List actions; + + /** + * Creates an instance of Privilege class. + */ + public Privilege() { + } + + /** + * Get the resource property: An Azure Cosmos DB Mongo DB Resource. + * + * @return the resource value. + */ + public PrivilegeResource resource() { + return this.resource; + } + + /** + * Set the resource property: An Azure Cosmos DB Mongo DB Resource. + * + * @param resource the resource value to set. + * @return the Privilege object itself. + */ + public Privilege withResource(PrivilegeResource resource) { + this.resource = resource; + return this; + } + + /** + * Get the actions property: An array of actions that are allowed. + * + * @return the actions value. + */ + public List actions() { + return this.actions; + } + + /** + * Set the actions property: An array of actions that are allowed. + * + * @param actions the actions value to set. + * @return the Privilege object itself. + */ + public Privilege withActions(List actions) { + this.actions = actions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resource() != null) { + resource().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("resource", this.resource); + jsonWriter.writeArrayField("actions", this.actions, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Privilege from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Privilege if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the Privilege. + */ + public static Privilege fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Privilege deserializedPrivilege = new Privilege(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resource".equals(fieldName)) { + deserializedPrivilege.resource = PrivilegeResource.fromJson(reader); + } else if ("actions".equals(fieldName)) { + List actions = reader.readArray(reader1 -> reader1.getString()); + deserializedPrivilege.actions = actions; + } else { + reader.skipChildren(); + } + } + + return deserializedPrivilege; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivilegeResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivilegeResource.java new file mode 100644 index 0000000000000..e17d78990620d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivilegeResource.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * An Azure Cosmos DB Mongo DB Resource. + */ +@Fluent +public final class PrivilegeResource implements JsonSerializable { + /* + * The database name the role is applied. + */ + private String db; + + /* + * The collection name the role is applied. + */ + private String collection; + + /** + * Creates an instance of PrivilegeResource class. + */ + public PrivilegeResource() { + } + + /** + * Get the db property: The database name the role is applied. + * + * @return the db value. + */ + public String db() { + return this.db; + } + + /** + * Set the db property: The database name the role is applied. + * + * @param db the db value to set. + * @return the PrivilegeResource object itself. + */ + public PrivilegeResource withDb(String db) { + this.db = db; + return this; + } + + /** + * Get the collection property: The collection name the role is applied. + * + * @return the collection value. + */ + public String collection() { + return this.collection; + } + + /** + * Set the collection property: The collection name the role is applied. + * + * @param collection the collection value to set. + * @return the PrivilegeResource object itself. + */ + public PrivilegeResource withCollection(String collection) { + this.collection = collection; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("db", this.db); + jsonWriter.writeStringField("collection", this.collection); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivilegeResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivilegeResource if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the PrivilegeResource. + */ + public static PrivilegeResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivilegeResource deserializedPrivilegeResource = new PrivilegeResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("db".equals(fieldName)) { + deserializedPrivilegeResource.db = reader.getString(); + } else if ("collection".equals(fieldName)) { + deserializedPrivilegeResource.collection = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivilegeResource; + }); + } +} 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..62290149c41e8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PublicNetworkAccess.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.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Whether requests from Public Network are allowed. + */ +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"); + + /** + * Static value SecuredByPerimeter for PublicNetworkAccess. + */ + public static final PublicNetworkAccess SECURED_BY_PERIMETER = fromString("SecuredByPerimeter"); + + /** + * Creates a new instance of PublicNetworkAccess value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PublicNetworkAccess() { + } + + /** + * Creates or finds a PublicNetworkAccess from its string representation. + * + * @param name a name to look for. + * @return the corresponding PublicNetworkAccess. + */ + public static PublicNetworkAccess fromString(String name) { + return fromString(name, PublicNetworkAccess.class); + } + + /** + * Gets known PublicNetworkAccess values. + * + * @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..9b6dfc7a39249 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RegionForOnlineOffline.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Cosmos DB region to online or offline. + */ +@Fluent +public final class RegionForOnlineOffline implements JsonSerializable { + /* + * Cosmos DB region, with spaces between words and each word capitalized. + */ + private String region; + + /** + * Creates an instance of RegionForOnlineOffline class. + */ + public RegionForOnlineOffline() { + } + + /** + * 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.atError() + .log(new IllegalArgumentException("Missing required property region in model RegionForOnlineOffline")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RegionForOnlineOffline.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("region", this.region); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RegionForOnlineOffline from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RegionForOnlineOffline if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RegionForOnlineOffline. + */ + public static RegionForOnlineOffline fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RegionForOnlineOffline deserializedRegionForOnlineOffline = new RegionForOnlineOffline(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("region".equals(fieldName)) { + deserializedRegionForOnlineOffline.region = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRegionForOnlineOffline; + }); + } +} 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..557e83f123192 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RegionalServiceResource.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.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Resource for a regional service location. + */ +@Immutable +public class RegionalServiceResource implements JsonSerializable { + /* + * The regional service name. + */ + private String name; + + /* + * The location name. + */ + private String location; + + /* + * Describes the status of a service. + */ + private ServiceStatus status; + + /** + * Creates an instance of RegionalServiceResource class. + */ + public RegionalServiceResource() { + } + + /** + * Get the name property: The regional service name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The regional service name. + * + * @param name the name value to set. + * @return the RegionalServiceResource object itself. + */ + RegionalServiceResource withName(String name) { + this.name = name; + return this; + } + + /** + * Get the location property: The location name. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The location name. + * + * @param location the location value to set. + * @return the RegionalServiceResource object itself. + */ + RegionalServiceResource withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the status property: Describes the status of a service. + * + * @return the status value. + */ + public ServiceStatus status() { + return this.status; + } + + /** + * Set the status property: Describes the status of a service. + * + * @param status the status value to set. + * @return the RegionalServiceResource object itself. + */ + RegionalServiceResource withStatus(ServiceStatus status) { + this.status = status; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RegionalServiceResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RegionalServiceResource if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the RegionalServiceResource. + */ + public static RegionalServiceResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RegionalServiceResource deserializedRegionalServiceResource = new RegionalServiceResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedRegionalServiceResource.name = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedRegionalServiceResource.location = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedRegionalServiceResource.status = ServiceStatus.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedRegionalServiceResource; + }); + } +} 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..4142152b4fd78 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ResourceIdentityType.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; + +/** + * 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. + */ +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. + */ + public static ResourceIdentityType fromString(String value) { + if (value == null) { + return null; + } + ResourceIdentityType[] items = ResourceIdentityType.values(); + for (ResourceIdentityType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @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/ResourceRestoreParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ResourceRestoreParameters.java new file mode 100644 index 0000000000000..5996e265d91db --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ResourceRestoreParameters.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Parameters to indicate the information about the restore. + */ +@Fluent +public final class ResourceRestoreParameters extends RestoreParametersBase { + /** + * Creates an instance of ResourceRestoreParameters class. + */ + public ResourceRestoreParameters() { + } + + /** + * {@inheritDoc} + */ + @Override + public ResourceRestoreParameters withRestoreSource(String restoreSource) { + super.withRestoreSource(restoreSource); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ResourceRestoreParameters withRestoreTimestampInUtc(OffsetDateTime restoreTimestampInUtc) { + super.withRestoreTimestampInUtc(restoreTimestampInUtc); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ResourceRestoreParameters withRestoreWithTtlDisabled(Boolean restoreWithTtlDisabled) { + super.withRestoreWithTtlDisabled(restoreWithTtlDisabled); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("restoreSource", restoreSource()); + jsonWriter.writeStringField("restoreTimestampInUtc", + restoreTimestampInUtc() == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(restoreTimestampInUtc())); + jsonWriter.writeBooleanField("restoreWithTtlDisabled", restoreWithTtlDisabled()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResourceRestoreParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResourceRestoreParameters if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ResourceRestoreParameters. + */ + public static ResourceRestoreParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResourceRestoreParameters deserializedResourceRestoreParameters = new ResourceRestoreParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("restoreSource".equals(fieldName)) { + deserializedResourceRestoreParameters.withRestoreSource(reader.getString()); + } else if ("restoreTimestampInUtc".equals(fieldName)) { + deserializedResourceRestoreParameters.withRestoreTimestampInUtc(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("restoreWithTtlDisabled".equals(fieldName)) { + deserializedResourceRestoreParameters + .withRestoreWithTtlDisabled(reader.getNullable(JsonReader::getBoolean)); + } else { + reader.skipChildren(); + } + } + + return deserializedResourceRestoreParameters; + }); + } +} 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..7c3d0c89d2ee8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableDatabaseAccountGetResult.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights 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 oldestRestorableTime property: The least recent time at which the database account can be restored to + * (ISO-8601 format). + * + * @return the oldestRestorableTime value. + */ + OffsetDateTime oldestRestorableTime(); + + /** + * 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..858fa09f312f0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableDatabaseAccounts.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.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 as + * paginated response with {@link PagedIterable}. + */ + 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 as + * paginated response with {@link PagedIterable}. + */ + 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 as + * paginated response with {@link PagedIterable}. + */ + 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 as + * paginated response with {@link PagedIterable}. + */ + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 along with {@link Response}. + */ + Response getByLocationWithResponse(String location, String instanceId, + 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); +} 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..78c699e5f5878 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableDatabaseAccountsListResult.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableDatabaseAccountGetResultInner; +import java.io.IOException; +import java.util.List; + +/** + * The List operation response, that contains the restorable database accounts and their properties. + */ +@Immutable +public final class RestorableDatabaseAccountsListResult + implements JsonSerializable { + /* + * List of restorable database accounts and their properties. + */ + private List value; + + /** + * Creates an instance of RestorableDatabaseAccountsListResult class. + */ + public RestorableDatabaseAccountsListResult() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestorableDatabaseAccountsListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestorableDatabaseAccountsListResult if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RestorableDatabaseAccountsListResult. + */ + public static RestorableDatabaseAccountsListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestorableDatabaseAccountsListResult deserializedRestorableDatabaseAccountsListResult + = new RestorableDatabaseAccountsListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> RestorableDatabaseAccountGetResultInner.fromJson(reader1)); + deserializedRestorableDatabaseAccountsListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedRestorableDatabaseAccountsListResult; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableGremlinDatabaseGetResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableGremlinDatabaseGetResult.java new file mode 100644 index 0000000000000..664d5a766f4de --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableGremlinDatabaseGetResult.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.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableGremlinDatabaseGetResultInner; + +/** + * An immutable client-side representation of RestorableGremlinDatabaseGetResult. + */ +public interface RestorableGremlinDatabaseGetResult { + /** + * 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 Gremlin database event. + * + * @return the resource value. + */ + RestorableGremlinDatabasePropertiesResource resource(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableGremlinDatabaseGetResultInner + * object. + * + * @return the inner object. + */ + RestorableGremlinDatabaseGetResultInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableGremlinDatabasePropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableGremlinDatabasePropertiesResource.java new file mode 100644 index 0000000000000..8e44092433afa --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableGremlinDatabasePropertiesResource.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The resource of an Azure Cosmos DB Gremlin database event. + */ +@Immutable +public final class RestorableGremlinDatabasePropertiesResource + implements JsonSerializable { + /* + * A system generated property. A unique identifier. + */ + private String rid; + + /* + * The operation type of this database event. + */ + private OperationType operationType; + + /* + * A state of this database to identify if this database is restorable in same account. + */ + private String canUndelete; + + /* + * The reason why this database can not be restored in same account. + */ + private String canUndeleteReason; + + /* + * The time when this database event happened. + */ + private String eventTimestamp; + + /* + * The name of this Gremlin database. + */ + private String ownerId; + + /* + * The resource ID of this Gremlin database. + */ + private String ownerResourceId; + + /** + * Creates an instance of RestorableGremlinDatabasePropertiesResource class. + */ + public RestorableGremlinDatabasePropertiesResource() { + } + + /** + * 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 canUndelete property: A state of this database to identify if this database is restorable in same + * account. + * + * @return the canUndelete value. + */ + public String canUndelete() { + return this.canUndelete; + } + + /** + * Get the canUndeleteReason property: The reason why this database can not be restored in same account. + * + * @return the canUndeleteReason value. + */ + public String canUndeleteReason() { + return this.canUndeleteReason; + } + + /** + * 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 Gremlin database. + * + * @return the ownerId value. + */ + public String ownerId() { + return this.ownerId; + } + + /** + * Get the ownerResourceId property: The resource ID of this Gremlin 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestorableGremlinDatabasePropertiesResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestorableGremlinDatabasePropertiesResource if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RestorableGremlinDatabasePropertiesResource. + */ + public static RestorableGremlinDatabasePropertiesResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestorableGremlinDatabasePropertiesResource deserializedRestorableGremlinDatabasePropertiesResource + = new RestorableGremlinDatabasePropertiesResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("_rid".equals(fieldName)) { + deserializedRestorableGremlinDatabasePropertiesResource.rid = reader.getString(); + } else if ("operationType".equals(fieldName)) { + deserializedRestorableGremlinDatabasePropertiesResource.operationType + = OperationType.fromString(reader.getString()); + } else if ("canUndelete".equals(fieldName)) { + deserializedRestorableGremlinDatabasePropertiesResource.canUndelete = reader.getString(); + } else if ("canUndeleteReason".equals(fieldName)) { + deserializedRestorableGremlinDatabasePropertiesResource.canUndeleteReason = reader.getString(); + } else if ("eventTimestamp".equals(fieldName)) { + deserializedRestorableGremlinDatabasePropertiesResource.eventTimestamp = reader.getString(); + } else if ("ownerId".equals(fieldName)) { + deserializedRestorableGremlinDatabasePropertiesResource.ownerId = reader.getString(); + } else if ("ownerResourceId".equals(fieldName)) { + deserializedRestorableGremlinDatabasePropertiesResource.ownerResourceId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRestorableGremlinDatabasePropertiesResource; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableGremlinDatabases.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableGremlinDatabases.java new file mode 100644 index 0000000000000..63c56922ac8e7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableGremlinDatabases.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.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * Resource collection API of RestorableGremlinDatabases. + */ +public interface RestorableGremlinDatabases { + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB Gremlin 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 Gremlin database events and their properties as paginated + * response with {@link PagedIterable}. + */ + PagedIterable list(String location, String instanceId); + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB Gremlin 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 Gremlin database events and their properties as paginated + * response with {@link PagedIterable}. + */ + 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/RestorableGremlinDatabasesListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableGremlinDatabasesListResult.java new file mode 100644 index 0000000000000..46472fd37fe1d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableGremlinDatabasesListResult.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableGremlinDatabaseGetResultInner; +import java.io.IOException; +import java.util.List; + +/** + * The List operation response, that contains the Gremlin database events and their properties. + */ +@Immutable +public final class RestorableGremlinDatabasesListResult + implements JsonSerializable { + /* + * List of Gremlin database events and their properties. + */ + private List value; + + /** + * Creates an instance of RestorableGremlinDatabasesListResult class. + */ + public RestorableGremlinDatabasesListResult() { + } + + /** + * Get the value property: List of Gremlin 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestorableGremlinDatabasesListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestorableGremlinDatabasesListResult if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RestorableGremlinDatabasesListResult. + */ + public static RestorableGremlinDatabasesListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestorableGremlinDatabasesListResult deserializedRestorableGremlinDatabasesListResult + = new RestorableGremlinDatabasesListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> RestorableGremlinDatabaseGetResultInner.fromJson(reader1)); + deserializedRestorableGremlinDatabasesListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedRestorableGremlinDatabasesListResult; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableGremlinGraphGetResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableGremlinGraphGetResult.java new file mode 100644 index 0000000000000..d64b9abaa10af --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableGremlinGraphGetResult.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.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableGremlinGraphGetResultInner; + +/** + * An immutable client-side representation of RestorableGremlinGraphGetResult. + */ +public interface RestorableGremlinGraphGetResult { + /** + * 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 Gremlin graph event. + * + * @return the resource value. + */ + RestorableGremlinGraphPropertiesResource resource(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableGremlinGraphGetResultInner + * object. + * + * @return the inner object. + */ + RestorableGremlinGraphGetResultInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableGremlinGraphPropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableGremlinGraphPropertiesResource.java new file mode 100644 index 0000000000000..3274bca342d8d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableGremlinGraphPropertiesResource.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The resource of an Azure Cosmos DB Gremlin graph event. + */ +@Immutable +public final class RestorableGremlinGraphPropertiesResource + implements JsonSerializable { + /* + * A system generated property. A unique identifier. + */ + private String rid; + + /* + * The operation type of this graph event. + */ + private OperationType operationType; + + /* + * A state of this graph to identify if this graph is restorable in same account. + */ + private String canUndelete; + + /* + * The reason why this graph can not be restored in same account. + */ + private String canUndeleteReason; + + /* + * The time when this graph event happened. + */ + private String eventTimestamp; + + /* + * The name of this Gremlin graph. + */ + private String ownerId; + + /* + * The resource ID of this Gremlin graph. + */ + private String ownerResourceId; + + /** + * Creates an instance of RestorableGremlinGraphPropertiesResource class. + */ + public RestorableGremlinGraphPropertiesResource() { + } + + /** + * 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 graph event. + * + * @return the operationType value. + */ + public OperationType operationType() { + return this.operationType; + } + + /** + * Get the canUndelete property: A state of this graph to identify if this graph is restorable in same account. + * + * @return the canUndelete value. + */ + public String canUndelete() { + return this.canUndelete; + } + + /** + * Get the canUndeleteReason property: The reason why this graph can not be restored in same account. + * + * @return the canUndeleteReason value. + */ + public String canUndeleteReason() { + return this.canUndeleteReason; + } + + /** + * Get the eventTimestamp property: The time when this graph event happened. + * + * @return the eventTimestamp value. + */ + public String eventTimestamp() { + return this.eventTimestamp; + } + + /** + * Get the ownerId property: The name of this Gremlin graph. + * + * @return the ownerId value. + */ + public String ownerId() { + return this.ownerId; + } + + /** + * Get the ownerResourceId property: The resource ID of this Gremlin graph. + * + * @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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestorableGremlinGraphPropertiesResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestorableGremlinGraphPropertiesResource if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RestorableGremlinGraphPropertiesResource. + */ + public static RestorableGremlinGraphPropertiesResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestorableGremlinGraphPropertiesResource deserializedRestorableGremlinGraphPropertiesResource + = new RestorableGremlinGraphPropertiesResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("_rid".equals(fieldName)) { + deserializedRestorableGremlinGraphPropertiesResource.rid = reader.getString(); + } else if ("operationType".equals(fieldName)) { + deserializedRestorableGremlinGraphPropertiesResource.operationType + = OperationType.fromString(reader.getString()); + } else if ("canUndelete".equals(fieldName)) { + deserializedRestorableGremlinGraphPropertiesResource.canUndelete = reader.getString(); + } else if ("canUndeleteReason".equals(fieldName)) { + deserializedRestorableGremlinGraphPropertiesResource.canUndeleteReason = reader.getString(); + } else if ("eventTimestamp".equals(fieldName)) { + deserializedRestorableGremlinGraphPropertiesResource.eventTimestamp = reader.getString(); + } else if ("ownerId".equals(fieldName)) { + deserializedRestorableGremlinGraphPropertiesResource.ownerId = reader.getString(); + } else if ("ownerResourceId".equals(fieldName)) { + deserializedRestorableGremlinGraphPropertiesResource.ownerResourceId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRestorableGremlinGraphPropertiesResource; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableGremlinGraphs.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableGremlinGraphs.java new file mode 100644 index 0000000000000..696febb7a99dc --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableGremlinGraphs.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.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * Resource collection API of RestorableGremlinGraphs. + */ +public interface RestorableGremlinGraphs { + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB Gremlin graphs 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 Gremlin graph events and their properties as paginated + * response with {@link PagedIterable}. + */ + PagedIterable list(String location, String instanceId); + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB Gremlin graphs 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 restorableGremlinDatabaseRid The resource ID of the Gremlin database. + * @param startTime Restorable Gremlin graphs event feed start time. + * @param endTime Restorable Gremlin graphs event feed end time. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 graph events and their properties as paginated + * response with {@link PagedIterable}. + */ + PagedIterable list(String location, String instanceId, + String restorableGremlinDatabaseRid, String startTime, String endTime, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableGremlinGraphsListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableGremlinGraphsListResult.java new file mode 100644 index 0000000000000..d5bbe8bba483a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableGremlinGraphsListResult.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.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableGremlinGraphGetResultInner; +import java.io.IOException; +import java.util.List; + +/** + * The List operation response, that contains the Gremlin graph events and their properties. + */ +@Immutable +public final class RestorableGremlinGraphsListResult implements JsonSerializable { + /* + * List of Gremlin graph events and their properties. + */ + private List value; + + /** + * Creates an instance of RestorableGremlinGraphsListResult class. + */ + public RestorableGremlinGraphsListResult() { + } + + /** + * Get the value property: List of Gremlin graph 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestorableGremlinGraphsListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestorableGremlinGraphsListResult if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RestorableGremlinGraphsListResult. + */ + public static RestorableGremlinGraphsListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestorableGremlinGraphsListResult deserializedRestorableGremlinGraphsListResult + = new RestorableGremlinGraphsListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> RestorableGremlinGraphGetResultInner.fromJson(reader1)); + deserializedRestorableGremlinGraphsListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedRestorableGremlinGraphsListResult; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableGremlinResources.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableGremlinResources.java new file mode 100644 index 0000000000000..f90f99e30055d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableGremlinResources.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.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * Resource collection API of RestorableGremlinResources. + */ +public interface RestorableGremlinResources { + /** + * Return a list of gremlin database and graphs 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 Gremlin resources as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(String location, String instanceId); + + /** + * Return a list of gremlin database and graphs 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 Gremlin resources as paginated response with + * {@link PagedIterable}. + */ + 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/RestorableGremlinResourcesGetResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableGremlinResourcesGetResult.java new file mode 100644 index 0000000000000..61f4cd24e2fdf --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableGremlinResourcesGetResult.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.resourcemanager.cosmos.generated.fluent.models.RestorableGremlinResourcesGetResultInner; +import java.util.List; + +/** + * An immutable client-side representation of RestorableGremlinResourcesGetResult. + */ +public interface RestorableGremlinResourcesGetResult { + /** + * 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 databaseName property: The name of the gremlin database available for restore. + * + * @return the databaseName value. + */ + String databaseName(); + + /** + * Gets the graphNames property: The names of the graphs available for restore. + * + * @return the graphNames value. + */ + List graphNames(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableGremlinResourcesGetResultInner + * object. + * + * @return the inner object. + */ + RestorableGremlinResourcesGetResultInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableGremlinResourcesListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableGremlinResourcesListResult.java new file mode 100644 index 0000000000000..6a3b658c9dbdc --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableGremlinResourcesListResult.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableGremlinResourcesGetResultInner; +import java.io.IOException; +import java.util.List; + +/** + * The List operation response, that contains the restorable Gremlin resources. + */ +@Immutable +public final class RestorableGremlinResourcesListResult + implements JsonSerializable { + /* + * List of restorable Gremlin resources, including the gremlin database and graph names. + */ + private List value; + + /** + * Creates an instance of RestorableGremlinResourcesListResult class. + */ + public RestorableGremlinResourcesListResult() { + } + + /** + * Get the value property: List of restorable Gremlin resources, including the gremlin database and graph 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestorableGremlinResourcesListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestorableGremlinResourcesListResult if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RestorableGremlinResourcesListResult. + */ + public static RestorableGremlinResourcesListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestorableGremlinResourcesListResult deserializedRestorableGremlinResourcesListResult + = new RestorableGremlinResourcesListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> RestorableGremlinResourcesGetResultInner.fromJson(reader1)); + deserializedRestorableGremlinResourcesListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedRestorableGremlinResourcesListResult; + }); + } +} 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..4b0b6b099e6c0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableLocationResource.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.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * Properties of the regional restorable account. + */ +@Immutable +public final class RestorableLocationResource implements JsonSerializable { + /* + * The location of the regional restorable account. + */ + private String locationName; + + /* + * The instance id of the regional restorable account. + */ + private String regionalDatabaseAccountInstanceId; + + /* + * The creation time of the regional restorable database account (ISO-8601 format). + */ + private OffsetDateTime creationTime; + + /* + * The time at which the regional restorable database account has been deleted (ISO-8601 format). + */ + private OffsetDateTime deletionTime; + + /** + * Creates an instance of RestorableLocationResource class. + */ + public RestorableLocationResource() { + } + + /** + * 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestorableLocationResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestorableLocationResource if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RestorableLocationResource. + */ + public static RestorableLocationResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestorableLocationResource deserializedRestorableLocationResource = new RestorableLocationResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("locationName".equals(fieldName)) { + deserializedRestorableLocationResource.locationName = reader.getString(); + } else if ("regionalDatabaseAccountInstanceId".equals(fieldName)) { + deserializedRestorableLocationResource.regionalDatabaseAccountInstanceId = reader.getString(); + } else if ("creationTime".equals(fieldName)) { + deserializedRestorableLocationResource.creationTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("deletionTime".equals(fieldName)) { + deserializedRestorableLocationResource.deletionTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedRestorableLocationResource; + }); + } +} 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..0be05fa23da34 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbCollectionGetResult.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.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..24edd7a31eb86 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbCollectionPropertiesResource.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The resource of an Azure Cosmos DB MongoDB collection event. + */ +@Immutable +public final class RestorableMongodbCollectionPropertiesResource + implements JsonSerializable { + /* + * A system generated property. A unique identifier. + */ + private String rid; + + /* + * The operation type of this collection event. + */ + private OperationType operationType; + + /* + * A state of this collection to identify if this container is restorable in same account. + */ + private String canUndelete; + + /* + * The reason why this collection can not be restored in same account. + */ + private String canUndeleteReason; + + /* + * The time when this collection event happened. + */ + private String eventTimestamp; + + /* + * The name of this MongoDB collection. + */ + private String ownerId; + + /* + * The resource ID of this MongoDB collection. + */ + private String ownerResourceId; + + /** + * Creates an instance of RestorableMongodbCollectionPropertiesResource class. + */ + public RestorableMongodbCollectionPropertiesResource() { + } + + /** + * 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 canUndelete property: A state of this collection to identify if this container is restorable in same + * account. + * + * @return the canUndelete value. + */ + public String canUndelete() { + return this.canUndelete; + } + + /** + * Get the canUndeleteReason property: The reason why this collection can not be restored in same account. + * + * @return the canUndeleteReason value. + */ + public String canUndeleteReason() { + return this.canUndeleteReason; + } + + /** + * 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestorableMongodbCollectionPropertiesResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestorableMongodbCollectionPropertiesResource if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RestorableMongodbCollectionPropertiesResource. + */ + public static RestorableMongodbCollectionPropertiesResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestorableMongodbCollectionPropertiesResource deserializedRestorableMongodbCollectionPropertiesResource + = new RestorableMongodbCollectionPropertiesResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("_rid".equals(fieldName)) { + deserializedRestorableMongodbCollectionPropertiesResource.rid = reader.getString(); + } else if ("operationType".equals(fieldName)) { + deserializedRestorableMongodbCollectionPropertiesResource.operationType + = OperationType.fromString(reader.getString()); + } else if ("canUndelete".equals(fieldName)) { + deserializedRestorableMongodbCollectionPropertiesResource.canUndelete = reader.getString(); + } else if ("canUndeleteReason".equals(fieldName)) { + deserializedRestorableMongodbCollectionPropertiesResource.canUndeleteReason = reader.getString(); + } else if ("eventTimestamp".equals(fieldName)) { + deserializedRestorableMongodbCollectionPropertiesResource.eventTimestamp = reader.getString(); + } else if ("ownerId".equals(fieldName)) { + deserializedRestorableMongodbCollectionPropertiesResource.ownerId = reader.getString(); + } else if ("ownerResourceId".equals(fieldName)) { + deserializedRestorableMongodbCollectionPropertiesResource.ownerResourceId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRestorableMongodbCollectionPropertiesResource; + }); + } +} 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..51a3ec7e75dc0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbCollections.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.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 as + * paginated response with {@link PagedIterable}. + */ + 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 startTime Restorable MongoDB collections event feed start time. + * @param endTime Restorable MongoDB collections event feed end time. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 as + * paginated response with {@link PagedIterable}. + */ + PagedIterable list(String location, String instanceId, + String restorableMongodbDatabaseRid, String startTime, String endTime, 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..f914ede426060 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbCollectionsListResult.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableMongodbCollectionGetResultInner; +import java.io.IOException; +import java.util.List; + +/** + * The List operation response, that contains the MongoDB collection events and their properties. + */ +@Immutable +public final class RestorableMongodbCollectionsListResult + implements JsonSerializable { + /* + * List of MongoDB collection events and their properties. + */ + private List value; + + /** + * Creates an instance of RestorableMongodbCollectionsListResult class. + */ + public RestorableMongodbCollectionsListResult() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestorableMongodbCollectionsListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestorableMongodbCollectionsListResult if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RestorableMongodbCollectionsListResult. + */ + public static RestorableMongodbCollectionsListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestorableMongodbCollectionsListResult deserializedRestorableMongodbCollectionsListResult + = new RestorableMongodbCollectionsListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> RestorableMongodbCollectionGetResultInner.fromJson(reader1)); + deserializedRestorableMongodbCollectionsListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedRestorableMongodbCollectionsListResult; + }); + } +} 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..f9b13dcebf6e0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbDatabaseGetResult.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.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..788d9173796a0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbDatabasePropertiesResource.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The resource of an Azure Cosmos DB MongoDB database event. + */ +@Immutable +public final class RestorableMongodbDatabasePropertiesResource + implements JsonSerializable { + /* + * A system generated property. A unique identifier. + */ + private String rid; + + /* + * The operation type of this database event. + */ + private OperationType operationType; + + /* + * A state of this database to identify if this database is restorable in same account. + */ + private String canUndelete; + + /* + * The reason why this database can not be restored in same account. + */ + private String canUndeleteReason; + + /* + * The time when this database event happened. + */ + private String eventTimestamp; + + /* + * The name of this MongoDB database. + */ + private String ownerId; + + /* + * The resource ID of this MongoDB database. + */ + private String ownerResourceId; + + /** + * Creates an instance of RestorableMongodbDatabasePropertiesResource class. + */ + public RestorableMongodbDatabasePropertiesResource() { + } + + /** + * 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 canUndelete property: A state of this database to identify if this database is restorable in same + * account. + * + * @return the canUndelete value. + */ + public String canUndelete() { + return this.canUndelete; + } + + /** + * Get the canUndeleteReason property: The reason why this database can not be restored in same account. + * + * @return the canUndeleteReason value. + */ + public String canUndeleteReason() { + return this.canUndeleteReason; + } + + /** + * 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestorableMongodbDatabasePropertiesResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestorableMongodbDatabasePropertiesResource if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RestorableMongodbDatabasePropertiesResource. + */ + public static RestorableMongodbDatabasePropertiesResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestorableMongodbDatabasePropertiesResource deserializedRestorableMongodbDatabasePropertiesResource + = new RestorableMongodbDatabasePropertiesResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("_rid".equals(fieldName)) { + deserializedRestorableMongodbDatabasePropertiesResource.rid = reader.getString(); + } else if ("operationType".equals(fieldName)) { + deserializedRestorableMongodbDatabasePropertiesResource.operationType + = OperationType.fromString(reader.getString()); + } else if ("canUndelete".equals(fieldName)) { + deserializedRestorableMongodbDatabasePropertiesResource.canUndelete = reader.getString(); + } else if ("canUndeleteReason".equals(fieldName)) { + deserializedRestorableMongodbDatabasePropertiesResource.canUndeleteReason = reader.getString(); + } else if ("eventTimestamp".equals(fieldName)) { + deserializedRestorableMongodbDatabasePropertiesResource.eventTimestamp = reader.getString(); + } else if ("ownerId".equals(fieldName)) { + deserializedRestorableMongodbDatabasePropertiesResource.ownerId = reader.getString(); + } else if ("ownerResourceId".equals(fieldName)) { + deserializedRestorableMongodbDatabasePropertiesResource.ownerResourceId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRestorableMongodbDatabasePropertiesResource; + }); + } +} 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..829e794b693db --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbDatabases.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.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 as paginated + * response with {@link PagedIterable}. + */ + 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 as paginated + * response with {@link PagedIterable}. + */ + 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..ff0a22330bd0a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbDatabasesListResult.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableMongodbDatabaseGetResultInner; +import java.io.IOException; +import java.util.List; + +/** + * The List operation response, that contains the MongoDB database events and their properties. + */ +@Immutable +public final class RestorableMongodbDatabasesListResult + implements JsonSerializable { + /* + * List of MongoDB database events and their properties. + */ + private List value; + + /** + * Creates an instance of RestorableMongodbDatabasesListResult class. + */ + public RestorableMongodbDatabasesListResult() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestorableMongodbDatabasesListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestorableMongodbDatabasesListResult if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RestorableMongodbDatabasesListResult. + */ + public static RestorableMongodbDatabasesListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestorableMongodbDatabasesListResult deserializedRestorableMongodbDatabasesListResult + = new RestorableMongodbDatabasesListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> RestorableMongodbDatabaseGetResultInner.fromJson(reader1)); + deserializedRestorableMongodbDatabasesListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedRestorableMongodbDatabasesListResult; + }); + } +} 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..c2bd8f1cea9ea --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbResources.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.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 as paginated response with + * {@link PagedIterable}. + */ + 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 as paginated response with + * {@link PagedIterable}. + */ + 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/RestorableMongodbResourcesGetResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbResourcesGetResult.java new file mode 100644 index 0000000000000..2f92401d220da --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbResourcesGetResult.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.resourcemanager.cosmos.generated.fluent.models.RestorableMongodbResourcesGetResultInner; +import java.util.List; + +/** + * An immutable client-side representation of RestorableMongodbResourcesGetResult. + */ +public interface RestorableMongodbResourcesGetResult { + /** + * 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 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.RestorableMongodbResourcesGetResultInner + * object. + * + * @return the inner object. + */ + RestorableMongodbResourcesGetResultInner innerModel(); +} 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..768d6af8dfabd --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbResourcesListResult.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableMongodbResourcesGetResultInner; +import java.io.IOException; +import java.util.List; + +/** + * The List operation response, that contains the restorable MongoDB resources. + */ +@Immutable +public final class RestorableMongodbResourcesListResult + implements JsonSerializable { + /* + * List of restorable MongoDB resources, including the database and collection names. + */ + private List value; + + /** + * Creates an instance of RestorableMongodbResourcesListResult class. + */ + public RestorableMongodbResourcesListResult() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestorableMongodbResourcesListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestorableMongodbResourcesListResult if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RestorableMongodbResourcesListResult. + */ + public static RestorableMongodbResourcesListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestorableMongodbResourcesListResult deserializedRestorableMongodbResourcesListResult + = new RestorableMongodbResourcesListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> RestorableMongodbResourcesGetResultInner.fromJson(reader1)); + deserializedRestorableMongodbResourcesListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedRestorableMongodbResourcesListResult; + }); + } +} 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..f6c910cb24b3c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainerGetResult.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.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..2fb91f8d4a1ba --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainerPropertiesResource.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The resource of an Azure Cosmos DB SQL container event. + */ +@Fluent +public final class RestorableSqlContainerPropertiesResource + implements JsonSerializable { + /* + * A system generated property. A unique identifier. + */ + private String rid; + + /* + * The operation type of this container event. + */ + private OperationType operationType; + + /* + * A state of this container to identify if this container is restorable in same account. + */ + private String canUndelete; + + /* + * The reason why this container can not be restored in same account. + */ + private String canUndeleteReason; + + /* + * The when this container event happened. + */ + private String eventTimestamp; + + /* + * The name of this SQL container. + */ + private String ownerId; + + /* + * The resource ID of this SQL container. + */ + private String ownerResourceId; + + /* + * Cosmos DB SQL container resource object + */ + private RestorableSqlContainerPropertiesResourceContainer container; + + /** + * Creates an instance of RestorableSqlContainerPropertiesResource class. + */ + public RestorableSqlContainerPropertiesResource() { + } + + /** + * 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 canUndelete property: A state of this container to identify if this container is restorable in same + * account. + * + * @return the canUndelete value. + */ + public String canUndelete() { + return this.canUndelete; + } + + /** + * Get the canUndeleteReason property: The reason why this container can not be restored in same account. + * + * @return the canUndeleteReason value. + */ + public String canUndeleteReason() { + return this.canUndeleteReason; + } + + /** + * 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("container", this.container); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestorableSqlContainerPropertiesResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestorableSqlContainerPropertiesResource if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RestorableSqlContainerPropertiesResource. + */ + public static RestorableSqlContainerPropertiesResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestorableSqlContainerPropertiesResource deserializedRestorableSqlContainerPropertiesResource + = new RestorableSqlContainerPropertiesResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("_rid".equals(fieldName)) { + deserializedRestorableSqlContainerPropertiesResource.rid = reader.getString(); + } else if ("operationType".equals(fieldName)) { + deserializedRestorableSqlContainerPropertiesResource.operationType + = OperationType.fromString(reader.getString()); + } else if ("canUndelete".equals(fieldName)) { + deserializedRestorableSqlContainerPropertiesResource.canUndelete = reader.getString(); + } else if ("canUndeleteReason".equals(fieldName)) { + deserializedRestorableSqlContainerPropertiesResource.canUndeleteReason = reader.getString(); + } else if ("eventTimestamp".equals(fieldName)) { + deserializedRestorableSqlContainerPropertiesResource.eventTimestamp = reader.getString(); + } else if ("ownerId".equals(fieldName)) { + deserializedRestorableSqlContainerPropertiesResource.ownerId = reader.getString(); + } else if ("ownerResourceId".equals(fieldName)) { + deserializedRestorableSqlContainerPropertiesResource.ownerResourceId = reader.getString(); + } else if ("container".equals(fieldName)) { + deserializedRestorableSqlContainerPropertiesResource.container + = RestorableSqlContainerPropertiesResourceContainer.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedRestorableSqlContainerPropertiesResource; + }); + } +} 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..6c70516765150 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainerPropertiesResourceContainer.java @@ -0,0 +1,313 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Cosmos DB SQL container resource object. + */ +@Fluent +public final class RestorableSqlContainerPropertiesResourceContainer extends SqlContainerResource { + /* + * A system generated property that specifies the addressable path of the container resource. + */ + private String self; + + /* + * A system generated property. A unique identifier. + */ + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of the resource. + */ + private Float ts; + + /* + * A system generated property representing the resource etag required for optimistic concurrency control. + */ + private String etag; + + /** + * Creates an instance of RestorableSqlContainerPropertiesResourceContainer class. + */ + public RestorableSqlContainerPropertiesResourceContainer() { + } + + /** + * 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 + withClientEncryptionPolicy(ClientEncryptionPolicy clientEncryptionPolicy) { + super.withClientEncryptionPolicy(clientEncryptionPolicy); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public RestorableSqlContainerPropertiesResourceContainer withAnalyticalStorageTtl(Long analyticalStorageTtl) { + super.withAnalyticalStorageTtl(analyticalStorageTtl); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public RestorableSqlContainerPropertiesResourceContainer + withRestoreParameters(ResourceRestoreParameters restoreParameters) { + super.withRestoreParameters(restoreParameters); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public RestorableSqlContainerPropertiesResourceContainer withCreateMode(CreateMode createMode) { + super.withCreateMode(createMode); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public RestorableSqlContainerPropertiesResourceContainer + withComputedProperties(List computedProperties) { + super.withComputedProperties(computedProperties); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (id() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property id in model RestorableSqlContainerPropertiesResourceContainer")); + } + if (indexingPolicy() != null) { + indexingPolicy().validate(); + } + if (partitionKey() != null) { + partitionKey().validate(); + } + if (uniqueKeyPolicy() != null) { + uniqueKeyPolicy().validate(); + } + if (conflictResolutionPolicy() != null) { + conflictResolutionPolicy().validate(); + } + if (clientEncryptionPolicy() != null) { + clientEncryptionPolicy().validate(); + } + if (restoreParameters() != null) { + restoreParameters().validate(); + } + if (computedProperties() != null) { + computedProperties().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER + = new ClientLogger(RestorableSqlContainerPropertiesResourceContainer.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", id()); + jsonWriter.writeJsonField("indexingPolicy", indexingPolicy()); + jsonWriter.writeJsonField("partitionKey", partitionKey()); + jsonWriter.writeNumberField("defaultTtl", defaultTtl()); + jsonWriter.writeJsonField("uniqueKeyPolicy", uniqueKeyPolicy()); + jsonWriter.writeJsonField("conflictResolutionPolicy", conflictResolutionPolicy()); + jsonWriter.writeJsonField("clientEncryptionPolicy", clientEncryptionPolicy()); + jsonWriter.writeNumberField("analyticalStorageTtl", analyticalStorageTtl()); + jsonWriter.writeJsonField("restoreParameters", restoreParameters()); + jsonWriter.writeStringField("createMode", createMode() == null ? null : createMode().toString()); + jsonWriter.writeArrayField("computedProperties", computedProperties(), + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestorableSqlContainerPropertiesResourceContainer from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestorableSqlContainerPropertiesResourceContainer if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RestorableSqlContainerPropertiesResourceContainer. + */ + public static RestorableSqlContainerPropertiesResourceContainer fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestorableSqlContainerPropertiesResourceContainer deserializedRestorableSqlContainerPropertiesResourceContainer + = new RestorableSqlContainerPropertiesResourceContainer(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedRestorableSqlContainerPropertiesResourceContainer.withId(reader.getString()); + } else if ("indexingPolicy".equals(fieldName)) { + deserializedRestorableSqlContainerPropertiesResourceContainer + .withIndexingPolicy(IndexingPolicy.fromJson(reader)); + } else if ("partitionKey".equals(fieldName)) { + deserializedRestorableSqlContainerPropertiesResourceContainer + .withPartitionKey(ContainerPartitionKey.fromJson(reader)); + } else if ("defaultTtl".equals(fieldName)) { + deserializedRestorableSqlContainerPropertiesResourceContainer + .withDefaultTtl(reader.getNullable(JsonReader::getInt)); + } else if ("uniqueKeyPolicy".equals(fieldName)) { + deserializedRestorableSqlContainerPropertiesResourceContainer + .withUniqueKeyPolicy(UniqueKeyPolicy.fromJson(reader)); + } else if ("conflictResolutionPolicy".equals(fieldName)) { + deserializedRestorableSqlContainerPropertiesResourceContainer + .withConflictResolutionPolicy(ConflictResolutionPolicy.fromJson(reader)); + } else if ("clientEncryptionPolicy".equals(fieldName)) { + deserializedRestorableSqlContainerPropertiesResourceContainer + .withClientEncryptionPolicy(ClientEncryptionPolicy.fromJson(reader)); + } else if ("analyticalStorageTtl".equals(fieldName)) { + deserializedRestorableSqlContainerPropertiesResourceContainer + .withAnalyticalStorageTtl(reader.getNullable(JsonReader::getLong)); + } else if ("restoreParameters".equals(fieldName)) { + deserializedRestorableSqlContainerPropertiesResourceContainer + .withRestoreParameters(ResourceRestoreParameters.fromJson(reader)); + } else if ("createMode".equals(fieldName)) { + deserializedRestorableSqlContainerPropertiesResourceContainer + .withCreateMode(CreateMode.fromString(reader.getString())); + } else if ("computedProperties".equals(fieldName)) { + List computedProperties + = reader.readArray(reader1 -> ComputedProperty.fromJson(reader1)); + deserializedRestorableSqlContainerPropertiesResourceContainer + .withComputedProperties(computedProperties); + } else if ("_self".equals(fieldName)) { + deserializedRestorableSqlContainerPropertiesResourceContainer.self = reader.getString(); + } else if ("_rid".equals(fieldName)) { + deserializedRestorableSqlContainerPropertiesResourceContainer.rid = reader.getString(); + } else if ("_ts".equals(fieldName)) { + deserializedRestorableSqlContainerPropertiesResourceContainer.ts + = reader.getNullable(JsonReader::getFloat); + } else if ("_etag".equals(fieldName)) { + deserializedRestorableSqlContainerPropertiesResourceContainer.etag = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRestorableSqlContainerPropertiesResourceContainer; + }); + } +} 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..164b49c9c769f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainers.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.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 as paginated + * response with {@link PagedIterable}. + */ + 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 Restorable Sql containers event feed start time. + * @param endTime Restorable Sql containers event feed end time. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 as paginated + * response with {@link PagedIterable}. + */ + 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..4c725e3f79165 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainersListResult.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.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableSqlContainerGetResultInner; +import java.io.IOException; +import java.util.List; + +/** + * The List operation response, that contains the SQL container events and their properties. + */ +@Immutable +public final class RestorableSqlContainersListResult implements JsonSerializable { + /* + * List of SQL container events and their properties. + */ + private List value; + + /** + * Creates an instance of RestorableSqlContainersListResult class. + */ + public RestorableSqlContainersListResult() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestorableSqlContainersListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestorableSqlContainersListResult if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RestorableSqlContainersListResult. + */ + public static RestorableSqlContainersListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestorableSqlContainersListResult deserializedRestorableSqlContainersListResult + = new RestorableSqlContainersListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> RestorableSqlContainerGetResultInner.fromJson(reader1)); + deserializedRestorableSqlContainersListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedRestorableSqlContainersListResult; + }); + } +} 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..5778169b34a6e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabaseGetResult.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.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..8d0691cfd54de --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabasePropertiesResource.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The resource of an Azure Cosmos DB SQL database event. + */ +@Fluent +public final class RestorableSqlDatabasePropertiesResource + implements JsonSerializable { + /* + * A system generated property. A unique identifier. + */ + private String rid; + + /* + * The operation type of this database event. + */ + private OperationType operationType; + + /* + * A state of this database to identify if this database is restorable in same account. + */ + private String canUndelete; + + /* + * The reason why this database can not be restored in same account. + */ + private String canUndeleteReason; + + /* + * The time when this database event happened. + */ + private String eventTimestamp; + + /* + * The name of the SQL database. + */ + private String ownerId; + + /* + * The resource ID of the SQL database. + */ + private String ownerResourceId; + + /* + * Cosmos DB SQL database resource object + */ + private RestorableSqlDatabasePropertiesResourceDatabase database; + + /** + * Creates an instance of RestorableSqlDatabasePropertiesResource class. + */ + public RestorableSqlDatabasePropertiesResource() { + } + + /** + * 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 canUndelete property: A state of this database to identify if this database is restorable in same + * account. + * + * @return the canUndelete value. + */ + public String canUndelete() { + return this.canUndelete; + } + + /** + * Get the canUndeleteReason property: The reason why this database can not be restored in same account. + * + * @return the canUndeleteReason value. + */ + public String canUndeleteReason() { + return this.canUndeleteReason; + } + + /** + * 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("database", this.database); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestorableSqlDatabasePropertiesResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestorableSqlDatabasePropertiesResource if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RestorableSqlDatabasePropertiesResource. + */ + public static RestorableSqlDatabasePropertiesResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestorableSqlDatabasePropertiesResource deserializedRestorableSqlDatabasePropertiesResource + = new RestorableSqlDatabasePropertiesResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("_rid".equals(fieldName)) { + deserializedRestorableSqlDatabasePropertiesResource.rid = reader.getString(); + } else if ("operationType".equals(fieldName)) { + deserializedRestorableSqlDatabasePropertiesResource.operationType + = OperationType.fromString(reader.getString()); + } else if ("canUndelete".equals(fieldName)) { + deserializedRestorableSqlDatabasePropertiesResource.canUndelete = reader.getString(); + } else if ("canUndeleteReason".equals(fieldName)) { + deserializedRestorableSqlDatabasePropertiesResource.canUndeleteReason = reader.getString(); + } else if ("eventTimestamp".equals(fieldName)) { + deserializedRestorableSqlDatabasePropertiesResource.eventTimestamp = reader.getString(); + } else if ("ownerId".equals(fieldName)) { + deserializedRestorableSqlDatabasePropertiesResource.ownerId = reader.getString(); + } else if ("ownerResourceId".equals(fieldName)) { + deserializedRestorableSqlDatabasePropertiesResource.ownerResourceId = reader.getString(); + } else if ("database".equals(fieldName)) { + deserializedRestorableSqlDatabasePropertiesResource.database + = RestorableSqlDatabasePropertiesResourceDatabase.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedRestorableSqlDatabasePropertiesResource; + }); + } +} 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..23e24c424589f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabasePropertiesResourceDatabase.java @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Cosmos DB SQL database resource object. + */ +@Fluent +public final class RestorableSqlDatabasePropertiesResourceDatabase extends SqlDatabaseResource { + /* + * A system generated property that specified the addressable path of the collections resource. + */ + private String colls; + + /* + * A system generated property that specifies the addressable path of the users resource. + */ + private String users; + + /* + * A system generated property that specifies the addressable path of the database resource. + */ + private String self; + + /* + * A system generated property. A unique identifier. + */ + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of the resource. + */ + private Float ts; + + /* + * A system generated property representing the resource etag required for optimistic concurrency control. + */ + private String etag; + + /** + * Creates an instance of RestorableSqlDatabasePropertiesResourceDatabase class. + */ + public RestorableSqlDatabasePropertiesResourceDatabase() { + } + + /** + * 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; + } + + /** + * {@inheritDoc} + */ + @Override + public RestorableSqlDatabasePropertiesResourceDatabase + withRestoreParameters(ResourceRestoreParameters restoreParameters) { + super.withRestoreParameters(restoreParameters); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public RestorableSqlDatabasePropertiesResourceDatabase withCreateMode(CreateMode createMode) { + super.withCreateMode(createMode); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (id() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property id in model RestorableSqlDatabasePropertiesResourceDatabase")); + } + if (restoreParameters() != null) { + restoreParameters().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RestorableSqlDatabasePropertiesResourceDatabase.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", id()); + jsonWriter.writeJsonField("restoreParameters", restoreParameters()); + jsonWriter.writeStringField("createMode", createMode() == null ? null : createMode().toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestorableSqlDatabasePropertiesResourceDatabase from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestorableSqlDatabasePropertiesResourceDatabase if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RestorableSqlDatabasePropertiesResourceDatabase. + */ + public static RestorableSqlDatabasePropertiesResourceDatabase fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestorableSqlDatabasePropertiesResourceDatabase deserializedRestorableSqlDatabasePropertiesResourceDatabase + = new RestorableSqlDatabasePropertiesResourceDatabase(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedRestorableSqlDatabasePropertiesResourceDatabase.withId(reader.getString()); + } else if ("restoreParameters".equals(fieldName)) { + deserializedRestorableSqlDatabasePropertiesResourceDatabase + .withRestoreParameters(ResourceRestoreParameters.fromJson(reader)); + } else if ("createMode".equals(fieldName)) { + deserializedRestorableSqlDatabasePropertiesResourceDatabase + .withCreateMode(CreateMode.fromString(reader.getString())); + } else if ("_colls".equals(fieldName)) { + deserializedRestorableSqlDatabasePropertiesResourceDatabase.colls = reader.getString(); + } else if ("_users".equals(fieldName)) { + deserializedRestorableSqlDatabasePropertiesResourceDatabase.users = reader.getString(); + } else if ("_self".equals(fieldName)) { + deserializedRestorableSqlDatabasePropertiesResourceDatabase.self = reader.getString(); + } else if ("_rid".equals(fieldName)) { + deserializedRestorableSqlDatabasePropertiesResourceDatabase.rid = reader.getString(); + } else if ("_ts".equals(fieldName)) { + deserializedRestorableSqlDatabasePropertiesResourceDatabase.ts + = reader.getNullable(JsonReader::getFloat); + } else if ("_etag".equals(fieldName)) { + deserializedRestorableSqlDatabasePropertiesResourceDatabase.etag = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRestorableSqlDatabasePropertiesResourceDatabase; + }); + } +} 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..ac082cfad59f9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabases.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.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 as paginated + * response with {@link PagedIterable}. + */ + 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 as paginated + * response with {@link PagedIterable}. + */ + 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..48f473e72a86f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabasesListResult.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.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableSqlDatabaseGetResultInner; +import java.io.IOException; +import java.util.List; + +/** + * The List operation response, that contains the SQL database events and their properties. + */ +@Immutable +public final class RestorableSqlDatabasesListResult implements JsonSerializable { + /* + * List of SQL database events and their properties. + */ + private List value; + + /** + * Creates an instance of RestorableSqlDatabasesListResult class. + */ + public RestorableSqlDatabasesListResult() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestorableSqlDatabasesListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestorableSqlDatabasesListResult if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RestorableSqlDatabasesListResult. + */ + public static RestorableSqlDatabasesListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestorableSqlDatabasesListResult deserializedRestorableSqlDatabasesListResult + = new RestorableSqlDatabasesListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> RestorableSqlDatabaseGetResultInner.fromJson(reader1)); + deserializedRestorableSqlDatabasesListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedRestorableSqlDatabasesListResult; + }); + } +} 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..8a588cf9c3e8a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlResources.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.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 as paginated response with + * {@link PagedIterable}. + */ + 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 as paginated response with + * {@link PagedIterable}. + */ + 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/RestorableSqlResourcesGetResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlResourcesGetResult.java new file mode 100644 index 0000000000000..fc7835b58c1e7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlResourcesGetResult.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.resourcemanager.cosmos.generated.fluent.models.RestorableSqlResourcesGetResultInner; +import java.util.List; + +/** + * An immutable client-side representation of RestorableSqlResourcesGetResult. + */ +public interface RestorableSqlResourcesGetResult { + /** + * 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 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.RestorableSqlResourcesGetResultInner + * object. + * + * @return the inner object. + */ + RestorableSqlResourcesGetResultInner innerModel(); +} 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..f7543fa388b80 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlResourcesListResult.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.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableSqlResourcesGetResultInner; +import java.io.IOException; +import java.util.List; + +/** + * The List operation response, that contains the restorable SQL resources. + */ +@Immutable +public final class RestorableSqlResourcesListResult implements JsonSerializable { + /* + * List of restorable SQL resources, including the database and collection names. + */ + private List value; + + /** + * Creates an instance of RestorableSqlResourcesListResult class. + */ + public RestorableSqlResourcesListResult() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestorableSqlResourcesListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestorableSqlResourcesListResult if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RestorableSqlResourcesListResult. + */ + public static RestorableSqlResourcesListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestorableSqlResourcesListResult deserializedRestorableSqlResourcesListResult + = new RestorableSqlResourcesListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> RestorableSqlResourcesGetResultInner.fromJson(reader1)); + deserializedRestorableSqlResourcesListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedRestorableSqlResourcesListResult; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableTableGetResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableTableGetResult.java new file mode 100644 index 0000000000000..2b0ce1e202ff3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableTableGetResult.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.azure.resourcemanager.cosmos.generated.fluent.models.RestorableTableGetResultInner; + +/** + * An immutable client-side representation of RestorableTableGetResult. + */ +public interface RestorableTableGetResult { + /** + * 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 Table event. + * + * @return the resource value. + */ + RestorableTablePropertiesResource resource(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableTableGetResultInner object. + * + * @return the inner object. + */ + RestorableTableGetResultInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableTablePropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableTablePropertiesResource.java new file mode 100644 index 0000000000000..8de08b37dc48a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableTablePropertiesResource.java @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The resource of an Azure Cosmos DB Table event. + */ +@Immutable +public final class RestorableTablePropertiesResource implements JsonSerializable { + /* + * A system generated property. A unique identifier. + */ + private String rid; + + /* + * The operation type of this table event. + */ + private OperationType operationType; + + /* + * A state of this table to identify if this table is restorable in same account. + */ + private String canUndelete; + + /* + * The reason why this table can not be restored in same account. + */ + private String canUndeleteReason; + + /* + * The time when this table event happened. + */ + private String eventTimestamp; + + /* + * The name of this Table. + */ + private String ownerId; + + /* + * The resource ID of this Table. + */ + private String ownerResourceId; + + /** + * Creates an instance of RestorableTablePropertiesResource class. + */ + public RestorableTablePropertiesResource() { + } + + /** + * 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 table event. + * + * @return the operationType value. + */ + public OperationType operationType() { + return this.operationType; + } + + /** + * Get the canUndelete property: A state of this table to identify if this table is restorable in same account. + * + * @return the canUndelete value. + */ + public String canUndelete() { + return this.canUndelete; + } + + /** + * Get the canUndeleteReason property: The reason why this table can not be restored in same account. + * + * @return the canUndeleteReason value. + */ + public String canUndeleteReason() { + return this.canUndeleteReason; + } + + /** + * Get the eventTimestamp property: The time when this table event happened. + * + * @return the eventTimestamp value. + */ + public String eventTimestamp() { + return this.eventTimestamp; + } + + /** + * Get the ownerId property: The name of this Table. + * + * @return the ownerId value. + */ + public String ownerId() { + return this.ownerId; + } + + /** + * Get the ownerResourceId property: The resource ID of this Table. + * + * @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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestorableTablePropertiesResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestorableTablePropertiesResource if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RestorableTablePropertiesResource. + */ + public static RestorableTablePropertiesResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestorableTablePropertiesResource deserializedRestorableTablePropertiesResource + = new RestorableTablePropertiesResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("_rid".equals(fieldName)) { + deserializedRestorableTablePropertiesResource.rid = reader.getString(); + } else if ("operationType".equals(fieldName)) { + deserializedRestorableTablePropertiesResource.operationType + = OperationType.fromString(reader.getString()); + } else if ("canUndelete".equals(fieldName)) { + deserializedRestorableTablePropertiesResource.canUndelete = reader.getString(); + } else if ("canUndeleteReason".equals(fieldName)) { + deserializedRestorableTablePropertiesResource.canUndeleteReason = reader.getString(); + } else if ("eventTimestamp".equals(fieldName)) { + deserializedRestorableTablePropertiesResource.eventTimestamp = reader.getString(); + } else if ("ownerId".equals(fieldName)) { + deserializedRestorableTablePropertiesResource.ownerId = reader.getString(); + } else if ("ownerResourceId".equals(fieldName)) { + deserializedRestorableTablePropertiesResource.ownerResourceId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRestorableTablePropertiesResource; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableTableResources.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableTableResources.java new file mode 100644 index 0000000000000..4036d406a8684 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableTableResources.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 RestorableTableResources. + */ +public interface RestorableTableResources { + /** + * Return a list of tables 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 list of restorable table names as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String location, String instanceId); + + /** + * Return a list of tables 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 list of restorable table names as paginated response with {@link PagedIterable}. + */ + 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/RestorableTableResourcesGetResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableTableResourcesGetResult.java new file mode 100644 index 0000000000000..5de6d43046078 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableTableResourcesGetResult.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.resourcemanager.cosmos.generated.fluent.models.RestorableTableResourcesGetResultInner; + +/** + * An immutable client-side representation of RestorableTableResourcesGetResult. + */ +public interface RestorableTableResourcesGetResult { + /** + * 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 Table. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of Azure resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableTableResourcesGetResultInner + * object. + * + * @return the inner object. + */ + RestorableTableResourcesGetResultInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableTableResourcesListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableTableResourcesListResult.java new file mode 100644 index 0000000000000..eebf12c5515e3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableTableResourcesListResult.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.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableTableResourcesGetResultInner; +import java.io.IOException; +import java.util.List; + +/** + * List of restorable table names. + */ +@Immutable +public final class RestorableTableResourcesListResult implements JsonSerializable { + /* + * List of restorable table names. + */ + private List value; + + /** + * Creates an instance of RestorableTableResourcesListResult class. + */ + public RestorableTableResourcesListResult() { + } + + /** + * Get the value property: List of restorable table 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestorableTableResourcesListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestorableTableResourcesListResult if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RestorableTableResourcesListResult. + */ + public static RestorableTableResourcesListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestorableTableResourcesListResult deserializedRestorableTableResourcesListResult + = new RestorableTableResourcesListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> RestorableTableResourcesGetResultInner.fromJson(reader1)); + deserializedRestorableTableResourcesListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedRestorableTableResourcesListResult; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableTables.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableTables.java new file mode 100644 index 0000000000000..184f980d7e000 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableTables.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.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * Resource collection API of RestorableTables. + */ +public interface RestorableTables { + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB Tables. This helps in scenario where table + * 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 Table events and their properties as paginated response + * with {@link PagedIterable}. + */ + PagedIterable list(String location, String instanceId); + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB Tables. This helps in scenario where table + * 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 startTime Restorable Tables event feed start time. + * @param endTime Restorable Tables event feed end time. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 events and their properties as paginated response + * with {@link PagedIterable}. + */ + PagedIterable list(String location, String instanceId, String startTime, String endTime, + Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableTablesListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableTablesListResult.java new file mode 100644 index 0000000000000..cbedeaed02027 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableTablesListResult.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableTableGetResultInner; +import java.io.IOException; +import java.util.List; + +/** + * The List operation response, that contains the Table events and their properties. + */ +@Immutable +public final class RestorableTablesListResult implements JsonSerializable { + /* + * List of Table events and their properties. + */ + private List value; + + /** + * Creates an instance of RestorableTablesListResult class. + */ + public RestorableTablesListResult() { + } + + /** + * Get the value property: List of Table 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestorableTablesListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestorableTablesListResult if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RestorableTablesListResult. + */ + public static RestorableTablesListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestorableTablesListResult deserializedRestorableTablesListResult = new RestorableTablesListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> RestorableTableGetResultInner.fromJson(reader1)); + deserializedRestorableTablesListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedRestorableTablesListResult; + }); + } +} 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..4cc1dd2604e33 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestoreMode.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 java.util.Collection; + +/** + * Describes the mode of the restore. + */ +public final class RestoreMode extends ExpandableStringEnum { + /** + * Static value PointInTime for RestoreMode. + */ + public static final RestoreMode POINT_IN_TIME = fromString("PointInTime"); + + /** + * Creates a new instance of RestoreMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public RestoreMode() { + } + + /** + * Creates or finds a RestoreMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding RestoreMode. + */ + public static RestoreMode fromString(String name) { + return fromString(name, RestoreMode.class); + } + + /** + * Gets known RestoreMode values. + * + * @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..b03049fde5f57 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestoreParameters.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; + +/** + * Parameters to indicate the information about the restore. + */ +@Fluent +public final class RestoreParameters extends RestoreParametersBase { + /* + * Describes the mode of the restore. + */ + private RestoreMode restoreMode; + + /* + * List of specific databases available for restore. + */ + private List databasesToRestore; + + /* + * List of specific gremlin databases available for restore. + */ + private List gremlinDatabasesToRestore; + + /* + * List of specific tables available for restore. + */ + private List tablesToRestore; + + /** + * Creates an instance of RestoreParameters class. + */ + public RestoreParameters() { + } + + /** + * 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 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; + } + + /** + * Get the gremlinDatabasesToRestore property: List of specific gremlin databases available for restore. + * + * @return the gremlinDatabasesToRestore value. + */ + public List gremlinDatabasesToRestore() { + return this.gremlinDatabasesToRestore; + } + + /** + * Set the gremlinDatabasesToRestore property: List of specific gremlin databases available for restore. + * + * @param gremlinDatabasesToRestore the gremlinDatabasesToRestore value to set. + * @return the RestoreParameters object itself. + */ + public RestoreParameters + withGremlinDatabasesToRestore(List gremlinDatabasesToRestore) { + this.gremlinDatabasesToRestore = gremlinDatabasesToRestore; + return this; + } + + /** + * Get the tablesToRestore property: List of specific tables available for restore. + * + * @return the tablesToRestore value. + */ + public List tablesToRestore() { + return this.tablesToRestore; + } + + /** + * Set the tablesToRestore property: List of specific tables available for restore. + * + * @param tablesToRestore the tablesToRestore value to set. + * @return the RestoreParameters object itself. + */ + public RestoreParameters withTablesToRestore(List tablesToRestore) { + this.tablesToRestore = tablesToRestore; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public RestoreParameters withRestoreSource(String restoreSource) { + super.withRestoreSource(restoreSource); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public RestoreParameters withRestoreTimestampInUtc(OffsetDateTime restoreTimestampInUtc) { + super.withRestoreTimestampInUtc(restoreTimestampInUtc); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public RestoreParameters withRestoreWithTtlDisabled(Boolean restoreWithTtlDisabled) { + super.withRestoreWithTtlDisabled(restoreWithTtlDisabled); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (databasesToRestore() != null) { + databasesToRestore().forEach(e -> e.validate()); + } + if (gremlinDatabasesToRestore() != null) { + gremlinDatabasesToRestore().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("restoreSource", restoreSource()); + jsonWriter.writeStringField("restoreTimestampInUtc", + restoreTimestampInUtc() == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(restoreTimestampInUtc())); + jsonWriter.writeBooleanField("restoreWithTtlDisabled", restoreWithTtlDisabled()); + jsonWriter.writeStringField("restoreMode", this.restoreMode == null ? null : this.restoreMode.toString()); + jsonWriter.writeArrayField("databasesToRestore", this.databasesToRestore, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("gremlinDatabasesToRestore", this.gremlinDatabasesToRestore, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("tablesToRestore", this.tablesToRestore, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestoreParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestoreParameters if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the RestoreParameters. + */ + public static RestoreParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestoreParameters deserializedRestoreParameters = new RestoreParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("restoreSource".equals(fieldName)) { + deserializedRestoreParameters.withRestoreSource(reader.getString()); + } else if ("restoreTimestampInUtc".equals(fieldName)) { + deserializedRestoreParameters.withRestoreTimestampInUtc(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("restoreWithTtlDisabled".equals(fieldName)) { + deserializedRestoreParameters + .withRestoreWithTtlDisabled(reader.getNullable(JsonReader::getBoolean)); + } else if ("restoreMode".equals(fieldName)) { + deserializedRestoreParameters.restoreMode = RestoreMode.fromString(reader.getString()); + } else if ("databasesToRestore".equals(fieldName)) { + List databasesToRestore + = reader.readArray(reader1 -> DatabaseRestoreResource.fromJson(reader1)); + deserializedRestoreParameters.databasesToRestore = databasesToRestore; + } else if ("gremlinDatabasesToRestore".equals(fieldName)) { + List gremlinDatabasesToRestore + = reader.readArray(reader1 -> GremlinDatabaseRestoreResource.fromJson(reader1)); + deserializedRestoreParameters.gremlinDatabasesToRestore = gremlinDatabasesToRestore; + } else if ("tablesToRestore".equals(fieldName)) { + List tablesToRestore = reader.readArray(reader1 -> reader1.getString()); + deserializedRestoreParameters.tablesToRestore = tablesToRestore; + } else { + reader.skipChildren(); + } + } + + return deserializedRestoreParameters; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestoreParametersBase.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestoreParametersBase.java new file mode 100644 index 0000000000000..737d63bace75d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestoreParametersBase.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Parameters to indicate the information about the restore. + */ +@Fluent +public class RestoreParametersBase implements JsonSerializable { + /* + * 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} + */ + private String restoreSource; + + /* + * Time to which the account has to be restored (ISO-8601 format). + */ + private OffsetDateTime restoreTimestampInUtc; + + /* + * Specifies whether the restored account will have Time-To-Live disabled upon the successful restore. + */ + private Boolean restoreWithTtlDisabled; + + /** + * Creates an instance of RestoreParametersBase class. + */ + public RestoreParametersBase() { + } + + /** + * 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 RestoreParametersBase object itself. + */ + public RestoreParametersBase 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 RestoreParametersBase object itself. + */ + public RestoreParametersBase withRestoreTimestampInUtc(OffsetDateTime restoreTimestampInUtc) { + this.restoreTimestampInUtc = restoreTimestampInUtc; + return this; + } + + /** + * Get the restoreWithTtlDisabled property: Specifies whether the restored account will have Time-To-Live disabled + * upon the successful restore. + * + * @return the restoreWithTtlDisabled value. + */ + public Boolean restoreWithTtlDisabled() { + return this.restoreWithTtlDisabled; + } + + /** + * Set the restoreWithTtlDisabled property: Specifies whether the restored account will have Time-To-Live disabled + * upon the successful restore. + * + * @param restoreWithTtlDisabled the restoreWithTtlDisabled value to set. + * @return the RestoreParametersBase object itself. + */ + public RestoreParametersBase withRestoreWithTtlDisabled(Boolean restoreWithTtlDisabled) { + this.restoreWithTtlDisabled = restoreWithTtlDisabled; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("restoreSource", this.restoreSource); + jsonWriter.writeStringField("restoreTimestampInUtc", + this.restoreTimestampInUtc == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.restoreTimestampInUtc)); + jsonWriter.writeBooleanField("restoreWithTtlDisabled", this.restoreWithTtlDisabled); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestoreParametersBase from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestoreParametersBase if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the RestoreParametersBase. + */ + public static RestoreParametersBase fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestoreParametersBase deserializedRestoreParametersBase = new RestoreParametersBase(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("restoreSource".equals(fieldName)) { + deserializedRestoreParametersBase.restoreSource = reader.getString(); + } else if ("restoreTimestampInUtc".equals(fieldName)) { + deserializedRestoreParametersBase.restoreTimestampInUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("restoreWithTtlDisabled".equals(fieldName)) { + deserializedRestoreParametersBase.restoreWithTtlDisabled + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedRestoreParametersBase; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Role.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Role.java new file mode 100644 index 0000000000000..47c29613bd7fd --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Role.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The set of roles permitted through this Role Definition. + */ +@Fluent +public final class Role implements JsonSerializable { + /* + * The database name the role is applied. + */ + private String db; + + /* + * The role name. + */ + private String role; + + /** + * Creates an instance of Role class. + */ + public Role() { + } + + /** + * Get the db property: The database name the role is applied. + * + * @return the db value. + */ + public String db() { + return this.db; + } + + /** + * Set the db property: The database name the role is applied. + * + * @param db the db value to set. + * @return the Role object itself. + */ + public Role withDb(String db) { + this.db = db; + return this; + } + + /** + * Get the role property: The role name. + * + * @return the role value. + */ + public String role() { + return this.role; + } + + /** + * Set the role property: The role name. + * + * @param role the role value to set. + * @return the Role object itself. + */ + public Role withRole(String role) { + this.role = role; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("db", this.db); + jsonWriter.writeStringField("role", this.role); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Role from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Role if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IOException If an error occurs while reading the Role. + */ + public static Role fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Role deserializedRole = new Role(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("db".equals(fieldName)) { + deserializedRole.db = reader.getString(); + } else if ("role".equals(fieldName)) { + deserializedRole.role = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRole; + }); + } +} 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..fdb7767597dcf --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RoleDefinitionType.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; + +/** + * Indicates whether the Role Definition was built-in or user created. + */ +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. + */ + public static RoleDefinitionType fromString(String value) { + if (value == null) { + return null; + } + RoleDefinitionType[] items = RoleDefinitionType.values(); + for (RoleDefinitionType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @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..23e2e8cd2d0fb --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SeedNode.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The SeedNode model. + */ +@Fluent +public final class SeedNode implements JsonSerializable { + /* + * IP address of this seed node. + */ + private String ipAddress; + + /** + * Creates an instance of SeedNode class. + */ + public SeedNode() { + } + + /** + * 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("ipAddress", this.ipAddress); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SeedNode from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SeedNode if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the SeedNode. + */ + public static SeedNode fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SeedNode deserializedSeedNode = new SeedNode(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("ipAddress".equals(fieldName)) { + deserializedSeedNode.ipAddress = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSeedNode; + }); + } +} 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..32e9d0a5235e3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServerVersion.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.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Describes the version of the MongoDB account. + */ +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"); + + /** + * Static value 4.2 for ServerVersion. + */ + public static final ServerVersion FOUR_TWO = fromString("4.2"); + + /** + * Static value 5.0 for ServerVersion. + */ + public static final ServerVersion FIVE_ZERO = fromString("5.0"); + + /** + * Static value 6.0 for ServerVersion. + */ + public static final ServerVersion SIX_ZERO = fromString("6.0"); + + /** + * Static value 7.0 for ServerVersion. + */ + public static final ServerVersion SEVEN_ZERO = fromString("7.0"); + + /** + * Creates a new instance of ServerVersion value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ServerVersion() { + } + + /** + * Creates or finds a ServerVersion from its string representation. + * + * @param name a name to look for. + * @return the corresponding ServerVersion. + */ + public static ServerVersion fromString(String name) { + return fromString(name, ServerVersion.class); + } + + /** + * Gets known ServerVersion values. + * + * @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..534624fba427a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServiceResource.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.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.WithProperties { + /** + * 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 properties. + */ + interface WithProperties { + /** + * Specifies the properties property: Properties in ServiceResourceCreateUpdateParameters.. + * + * @param properties Properties in ServiceResourceCreateUpdateParameters. + * @return the next definition stage. + */ + WithCreate withProperties(ServiceResourceCreateUpdateProperties properties); + } + } + + /** + * 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..d956cb76d8948 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServiceResourceCreateUpdateParameters.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.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Parameters for Create or Update request for ServiceResource. + */ +@Fluent +public final class ServiceResourceCreateUpdateParameters + implements JsonSerializable { + /* + * Properties in ServiceResourceCreateUpdateParameters. + */ + private ServiceResourceCreateUpdateProperties properties; + + /** + * Creates an instance of ServiceResourceCreateUpdateParameters class. + */ + public ServiceResourceCreateUpdateParameters() { + } + + /** + * Get the properties property: Properties in ServiceResourceCreateUpdateParameters. + * + * @return the properties value. + */ + public ServiceResourceCreateUpdateProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Properties in ServiceResourceCreateUpdateParameters. + * + * @param properties the properties value to set. + * @return the ServiceResourceCreateUpdateParameters object itself. + */ + public ServiceResourceCreateUpdateParameters withProperties(ServiceResourceCreateUpdateProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServiceResourceCreateUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServiceResourceCreateUpdateParameters if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ServiceResourceCreateUpdateParameters. + */ + public static ServiceResourceCreateUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServiceResourceCreateUpdateParameters deserializedServiceResourceCreateUpdateParameters + = new ServiceResourceCreateUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedServiceResourceCreateUpdateParameters.properties + = ServiceResourceCreateUpdateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedServiceResourceCreateUpdateParameters; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServiceResourceCreateUpdateProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServiceResourceCreateUpdateProperties.java new file mode 100644 index 0000000000000..66ba165afb8c3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServiceResourceCreateUpdateProperties.java @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Properties in ServiceResourceCreateUpdateParameters. + */ +@Fluent +public class ServiceResourceCreateUpdateProperties implements JsonSerializable { + /* + * ServiceType for the service. + */ + private ServiceType serviceType = ServiceType.fromString("ServiceResourceCreateUpdateProperties"); + + /* + * Instance type for the service. + */ + private ServiceSize instanceSize; + + /* + * Instance count for the service. + */ + private Integer instanceCount; + + /** + * Creates an instance of ServiceResourceCreateUpdateProperties class. + */ + public ServiceResourceCreateUpdateProperties() { + } + + /** + * Get the serviceType property: ServiceType for the service. + * + * @return the serviceType value. + */ + public ServiceType serviceType() { + return this.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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("serviceType", this.serviceType == null ? null : this.serviceType.toString()); + jsonWriter.writeStringField("instanceSize", this.instanceSize == null ? null : this.instanceSize.toString()); + jsonWriter.writeNumberField("instanceCount", this.instanceCount); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServiceResourceCreateUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServiceResourceCreateUpdateProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ServiceResourceCreateUpdateProperties. + */ + public static ServiceResourceCreateUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("serviceType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("DataTransfer".equals(discriminatorValue)) { + return DataTransferServiceResourceCreateUpdateProperties.fromJson(readerToUse.reset()); + } else if ("SqlDedicatedGateway".equals(discriminatorValue)) { + return SqlDedicatedGatewayServiceResourceCreateUpdateProperties.fromJson(readerToUse.reset()); + } else if ("GraphAPICompute".equals(discriminatorValue)) { + return GraphApiComputeServiceResourceCreateUpdateProperties.fromJson(readerToUse.reset()); + } else if ("MaterializedViewsBuilder".equals(discriminatorValue)) { + return MaterializedViewsBuilderServiceResourceCreateUpdateProperties.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static ServiceResourceCreateUpdateProperties fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServiceResourceCreateUpdateProperties deserializedServiceResourceCreateUpdateProperties + = new ServiceResourceCreateUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("serviceType".equals(fieldName)) { + deserializedServiceResourceCreateUpdateProperties.serviceType + = ServiceType.fromString(reader.getString()); + } else if ("instanceSize".equals(fieldName)) { + deserializedServiceResourceCreateUpdateProperties.instanceSize + = ServiceSize.fromString(reader.getString()); + } else if ("instanceCount".equals(fieldName)) { + deserializedServiceResourceCreateUpdateProperties.instanceCount + = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedServiceResourceCreateUpdateProperties; + }); + } +} 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..730640e67e072 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServiceResourceListResult.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ServiceResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * The List operation response, that contains the Service Resource and their properties. + */ +@Immutable +public final class ServiceResourceListResult implements JsonSerializable { + /* + * List of Service Resource and their properties. + */ + private List value; + + /** + * Creates an instance of ServiceResourceListResult class. + */ + public ServiceResourceListResult() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServiceResourceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServiceResourceListResult if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ServiceResourceListResult. + */ + public static ServiceResourceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServiceResourceListResult deserializedServiceResourceListResult = new ServiceResourceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> ServiceResourceInner.fromJson(reader1)); + deserializedServiceResourceListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedServiceResourceListResult; + }); + } +} 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..ae7e9b64fc91a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServiceResourceProperties.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * Services response resource. + */ +@Fluent +public class ServiceResourceProperties implements JsonSerializable { + /* + * ServiceType for the service. + */ + private ServiceType serviceType = ServiceType.fromString("ServiceResourceProperties"); + + /* + * Time of the last state change (ISO-8601 format). + */ + private OffsetDateTime creationTime; + + /* + * Instance type for the service. + */ + private ServiceSize instanceSize; + + /* + * Instance count for the service. + */ + private Integer instanceCount; + + /* + * Describes the status of a service. + */ + private ServiceStatus status; + + /* + * Services response resource. + */ + private Map additionalProperties; + + /** + * Creates an instance of ServiceResourceProperties class. + */ + public ServiceResourceProperties() { + } + + /** + * Get the serviceType property: ServiceType for the service. + * + * @return the serviceType value. + */ + public ServiceType serviceType() { + return this.serviceType; + } + + /** + * Get the creationTime property: Time of the last state change (ISO-8601 format). + * + * @return the creationTime value. + */ + public OffsetDateTime creationTime() { + return this.creationTime; + } + + /** + * Set the creationTime property: Time of the last state change (ISO-8601 format). + * + * @param creationTime the creationTime value to set. + * @return the ServiceResourceProperties object itself. + */ + ServiceResourceProperties withCreationTime(OffsetDateTime creationTime) { + this.creationTime = creationTime; + return this; + } + + /** + * 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; + } + + /** + * Set the status property: Describes the status of a service. + * + * @param status the status value to set. + * @return the ServiceResourceProperties object itself. + */ + ServiceResourceProperties withStatus(ServiceStatus status) { + this.status = status; + return this; + } + + /** + * Get the additionalProperties property: Services response resource. + * + * @return the additionalProperties value. + */ + 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("serviceType", this.serviceType == null ? null : this.serviceType.toString()); + jsonWriter.writeStringField("instanceSize", this.instanceSize == null ? null : this.instanceSize.toString()); + jsonWriter.writeNumberField("instanceCount", this.instanceCount); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServiceResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServiceResourceProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ServiceResourceProperties. + */ + public static ServiceResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("serviceType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("DataTransfer".equals(discriminatorValue)) { + return DataTransferServiceResourceProperties.fromJson(readerToUse.reset()); + } else if ("SqlDedicatedGateway".equals(discriminatorValue)) { + return SqlDedicatedGatewayServiceResourceProperties.fromJson(readerToUse.reset()); + } else if ("GraphAPICompute".equals(discriminatorValue)) { + return GraphApiComputeServiceResourceProperties.fromJson(readerToUse.reset()); + } else if ("MaterializedViewsBuilder".equals(discriminatorValue)) { + return MaterializedViewsBuilderServiceResourceProperties.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static ServiceResourceProperties fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServiceResourceProperties deserializedServiceResourceProperties = new ServiceResourceProperties(); + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("serviceType".equals(fieldName)) { + deserializedServiceResourceProperties.serviceType = ServiceType.fromString(reader.getString()); + } else if ("creationTime".equals(fieldName)) { + deserializedServiceResourceProperties.creationTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("instanceSize".equals(fieldName)) { + deserializedServiceResourceProperties.instanceSize = ServiceSize.fromString(reader.getString()); + } else if ("instanceCount".equals(fieldName)) { + deserializedServiceResourceProperties.instanceCount = reader.getNullable(JsonReader::getInt); + } else if ("status".equals(fieldName)) { + deserializedServiceResourceProperties.status = ServiceStatus.fromString(reader.getString()); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.readUntyped()); + } + } + deserializedServiceResourceProperties.additionalProperties = additionalProperties; + + return deserializedServiceResourceProperties; + }); + } +} 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..8dec7304a8c32 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServiceSize.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.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Instance type for the service. + */ +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 a new instance of ServiceSize value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ServiceSize() { + } + + /** + * Creates or finds a ServiceSize from its string representation. + * + * @param name a name to look for. + * @return the corresponding ServiceSize. + */ + public static ServiceSize fromString(String name) { + return fromString(name, ServiceSize.class); + } + + /** + * Gets known ServiceSize values. + * + * @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..7246fb5a4b916 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServiceStatus.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.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Describes the status of a service. + */ +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 a new instance of ServiceStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ServiceStatus() { + } + + /** + * Creates or finds a ServiceStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding ServiceStatus. + */ + public static ServiceStatus fromString(String name) { + return fromString(name, ServiceStatus.class); + } + + /** + * Gets known ServiceStatus values. + * + * @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..8e08633335db5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServiceType.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.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * ServiceType for the service. + */ +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"); + + /** + * Static value MaterializedViewsBuilder for ServiceType. + */ + public static final ServiceType MATERIALIZED_VIEWS_BUILDER = fromString("MaterializedViewsBuilder"); + + /** + * Creates a new instance of ServiceType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ServiceType() { + } + + /** + * Creates or finds a ServiceType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ServiceType. + */ + public static ServiceType fromString(String name) { + return fromString(name, ServiceType.class); + } + + /** + * Gets known ServiceType values. + * + * @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..0dff6ae8128c9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Services.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.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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String accountName, String serviceName, + 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); + + /** + * 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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..9ceeef2556b2b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SpatialSpec.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The SpatialSpec model. + */ +@Fluent +public final class SpatialSpec implements JsonSerializable { + /* + * The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard + * (/path/*) + */ + private String path; + + /* + * List of path's spatial type + */ + private List types; + + /** + * Creates an instance of SpatialSpec class. + */ + public SpatialSpec() { + } + + /** + * 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("path", this.path); + jsonWriter.writeArrayField("types", this.types, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SpatialSpec from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SpatialSpec if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the SpatialSpec. + */ + public static SpatialSpec fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SpatialSpec deserializedSpatialSpec = new SpatialSpec(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("path".equals(fieldName)) { + deserializedSpatialSpec.path = reader.getString(); + } else if ("types".equals(fieldName)) { + List types = reader.readArray(reader1 -> SpatialType.fromString(reader1.getString())); + deserializedSpatialSpec.types = types; + } else { + reader.skipChildren(); + } + } + + return deserializedSpatialSpec; + }); + } +} 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..1bcd0e0dc7a17 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SpatialType.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.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Indicates the spatial type of index. + */ +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 a new instance of SpatialType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SpatialType() { + } + + /** + * Creates or finds a SpatialType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SpatialType. + */ + public static SpatialType fromString(String name) { + return fromString(name, SpatialType.class); + } + + /** + * Gets known SpatialType values. + * + * @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..30d8b03701e93 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerCreateUpdateParameters.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlContainerCreateUpdateProperties; +import java.io.IOException; +import java.util.Map; + +/** + * Parameters to create and update Cosmos DB container. + */ +@Fluent +public final class SqlContainerCreateUpdateParameters extends ArmResourceProperties { + /* + * Properties to create and update Azure Cosmos DB container. + */ + private SqlContainerCreateUpdateProperties innerProperties = new SqlContainerCreateUpdateProperties(); + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of SqlContainerCreateUpdateParameters class. + */ + public SqlContainerCreateUpdateParameters() { + } + + /** + * Get the innerProperties property: Properties to create and update Azure Cosmos DB container. + * + * @return the innerProperties value. + */ + private SqlContainerCreateUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@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() { + if (innerProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property innerProperties in model SqlContainerCreateUpdateParameters")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlContainerCreateUpdateParameters.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlContainerCreateUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlContainerCreateUpdateParameters if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlContainerCreateUpdateParameters. + */ + public static SqlContainerCreateUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlContainerCreateUpdateParameters deserializedSqlContainerCreateUpdateParameters + = new SqlContainerCreateUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSqlContainerCreateUpdateParameters.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSqlContainerCreateUpdateParameters.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSqlContainerCreateUpdateParameters.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedSqlContainerCreateUpdateParameters.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedSqlContainerCreateUpdateParameters.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedSqlContainerCreateUpdateParameters.innerProperties + = SqlContainerCreateUpdateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlContainerCreateUpdateParameters; + }); + } +} 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..b16fd5dfe4176 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerGetPropertiesOptions.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The SqlContainerGetPropertiesOptions model. + */ +@Fluent +public final class SqlContainerGetPropertiesOptions extends OptionsResource { + /** + * Creates an instance of SqlContainerGetPropertiesOptions class. + */ + public SqlContainerGetPropertiesOptions() { + } + + /** + * {@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() { + if (autoscaleSettings() != null) { + autoscaleSettings().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("throughput", throughput()); + jsonWriter.writeJsonField("autoscaleSettings", autoscaleSettings()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlContainerGetPropertiesOptions from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlContainerGetPropertiesOptions if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlContainerGetPropertiesOptions. + */ + public static SqlContainerGetPropertiesOptions fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlContainerGetPropertiesOptions deserializedSqlContainerGetPropertiesOptions + = new SqlContainerGetPropertiesOptions(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("throughput".equals(fieldName)) { + deserializedSqlContainerGetPropertiesOptions.withThroughput(reader.getNullable(JsonReader::getInt)); + } else if ("autoscaleSettings".equals(fieldName)) { + deserializedSqlContainerGetPropertiesOptions + .withAutoscaleSettings(AutoscaleSettings.fromJson(reader)); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlContainerGetPropertiesOptions; + }); + } +} 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..1495e84e897b8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerGetPropertiesResource.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The SqlContainerGetPropertiesResource model. + */ +@Fluent +public final class SqlContainerGetPropertiesResource extends SqlContainerResource { + /* + * A system generated property. A unique identifier. + */ + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of the resource. + */ + private Float ts; + + /* + * A system generated property representing the resource etag required for optimistic concurrency control. + */ + private String etag; + + /** + * Creates an instance of SqlContainerGetPropertiesResource class. + */ + public SqlContainerGetPropertiesResource() { + } + + /** + * 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 withClientEncryptionPolicy(ClientEncryptionPolicy clientEncryptionPolicy) { + super.withClientEncryptionPolicy(clientEncryptionPolicy); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public SqlContainerGetPropertiesResource withAnalyticalStorageTtl(Long analyticalStorageTtl) { + super.withAnalyticalStorageTtl(analyticalStorageTtl); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public SqlContainerGetPropertiesResource withRestoreParameters(ResourceRestoreParameters restoreParameters) { + super.withRestoreParameters(restoreParameters); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public SqlContainerGetPropertiesResource withCreateMode(CreateMode createMode) { + super.withCreateMode(createMode); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public SqlContainerGetPropertiesResource withComputedProperties(List computedProperties) { + super.withComputedProperties(computedProperties); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (id() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property id in model SqlContainerGetPropertiesResource")); + } + if (indexingPolicy() != null) { + indexingPolicy().validate(); + } + if (partitionKey() != null) { + partitionKey().validate(); + } + if (uniqueKeyPolicy() != null) { + uniqueKeyPolicy().validate(); + } + if (conflictResolutionPolicy() != null) { + conflictResolutionPolicy().validate(); + } + if (clientEncryptionPolicy() != null) { + clientEncryptionPolicy().validate(); + } + if (restoreParameters() != null) { + restoreParameters().validate(); + } + if (computedProperties() != null) { + computedProperties().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlContainerGetPropertiesResource.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", id()); + jsonWriter.writeJsonField("indexingPolicy", indexingPolicy()); + jsonWriter.writeJsonField("partitionKey", partitionKey()); + jsonWriter.writeNumberField("defaultTtl", defaultTtl()); + jsonWriter.writeJsonField("uniqueKeyPolicy", uniqueKeyPolicy()); + jsonWriter.writeJsonField("conflictResolutionPolicy", conflictResolutionPolicy()); + jsonWriter.writeJsonField("clientEncryptionPolicy", clientEncryptionPolicy()); + jsonWriter.writeNumberField("analyticalStorageTtl", analyticalStorageTtl()); + jsonWriter.writeJsonField("restoreParameters", restoreParameters()); + jsonWriter.writeStringField("createMode", createMode() == null ? null : createMode().toString()); + jsonWriter.writeArrayField("computedProperties", computedProperties(), + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlContainerGetPropertiesResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlContainerGetPropertiesResource if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlContainerGetPropertiesResource. + */ + public static SqlContainerGetPropertiesResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlContainerGetPropertiesResource deserializedSqlContainerGetPropertiesResource + = new SqlContainerGetPropertiesResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSqlContainerGetPropertiesResource.withId(reader.getString()); + } else if ("indexingPolicy".equals(fieldName)) { + deserializedSqlContainerGetPropertiesResource.withIndexingPolicy(IndexingPolicy.fromJson(reader)); + } else if ("partitionKey".equals(fieldName)) { + deserializedSqlContainerGetPropertiesResource + .withPartitionKey(ContainerPartitionKey.fromJson(reader)); + } else if ("defaultTtl".equals(fieldName)) { + deserializedSqlContainerGetPropertiesResource + .withDefaultTtl(reader.getNullable(JsonReader::getInt)); + } else if ("uniqueKeyPolicy".equals(fieldName)) { + deserializedSqlContainerGetPropertiesResource.withUniqueKeyPolicy(UniqueKeyPolicy.fromJson(reader)); + } else if ("conflictResolutionPolicy".equals(fieldName)) { + deserializedSqlContainerGetPropertiesResource + .withConflictResolutionPolicy(ConflictResolutionPolicy.fromJson(reader)); + } else if ("clientEncryptionPolicy".equals(fieldName)) { + deserializedSqlContainerGetPropertiesResource + .withClientEncryptionPolicy(ClientEncryptionPolicy.fromJson(reader)); + } else if ("analyticalStorageTtl".equals(fieldName)) { + deserializedSqlContainerGetPropertiesResource + .withAnalyticalStorageTtl(reader.getNullable(JsonReader::getLong)); + } else if ("restoreParameters".equals(fieldName)) { + deserializedSqlContainerGetPropertiesResource + .withRestoreParameters(ResourceRestoreParameters.fromJson(reader)); + } else if ("createMode".equals(fieldName)) { + deserializedSqlContainerGetPropertiesResource + .withCreateMode(CreateMode.fromString(reader.getString())); + } else if ("computedProperties".equals(fieldName)) { + List computedProperties + = reader.readArray(reader1 -> ComputedProperty.fromJson(reader1)); + deserializedSqlContainerGetPropertiesResource.withComputedProperties(computedProperties); + } else if ("_rid".equals(fieldName)) { + deserializedSqlContainerGetPropertiesResource.rid = reader.getString(); + } else if ("_ts".equals(fieldName)) { + deserializedSqlContainerGetPropertiesResource.ts = reader.getNullable(JsonReader::getFloat); + } else if ("_etag".equals(fieldName)) { + deserializedSqlContainerGetPropertiesResource.etag = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlContainerGetPropertiesResource; + }); + } +} 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..fbb23301f8a2e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerGetResults.java @@ -0,0 +1,319 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 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 name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * 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.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 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.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 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..f309037f7d046 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerListResult.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlContainerGetResultsInner; +import java.io.IOException; +import java.util.List; + +/** + * The List operation response, that contains the containers and their properties. + */ +@Immutable +public final class SqlContainerListResult implements JsonSerializable { + /* + * List of containers and their properties. + */ + private List value; + + /** + * Creates an instance of SqlContainerListResult class. + */ + public SqlContainerListResult() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlContainerListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlContainerListResult if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlContainerListResult. + */ + public static SqlContainerListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlContainerListResult deserializedSqlContainerListResult = new SqlContainerListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> SqlContainerGetResultsInner.fromJson(reader1)); + deserializedSqlContainerListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedSqlContainerListResult; + }); + } +} 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..ce6228e66c81f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerResource.java @@ -0,0 +1,415 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Cosmos DB SQL container resource object. + */ +@Fluent +public class SqlContainerResource implements JsonSerializable { + /* + * Name of the Cosmos DB SQL container + */ + private String id; + + /* + * The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the + * container + */ + private IndexingPolicy indexingPolicy; + + /* + * The configuration of the partition key to be used for partitioning data into multiple partitions + */ + private ContainerPartitionKey partitionKey; + + /* + * Default time to live + */ + private Integer defaultTtl; + + /* + * The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the + * Azure Cosmos DB service. + */ + private UniqueKeyPolicy uniqueKeyPolicy; + + /* + * The conflict resolution policy for the container. + */ + private ConflictResolutionPolicy conflictResolutionPolicy; + + /* + * The client encryption policy for the container. + */ + private ClientEncryptionPolicy clientEncryptionPolicy; + + /* + * Analytical TTL. + */ + private Long analyticalStorageTtl; + + /* + * Parameters to indicate the information about the restore + */ + private ResourceRestoreParameters restoreParameters; + + /* + * Enum to indicate the mode of resource creation. + */ + private CreateMode createMode; + + /* + * List of computed properties + */ + private List computedProperties; + + /** + * Creates an instance of SqlContainerResource class. + */ + public SqlContainerResource() { + } + + /** + * 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 clientEncryptionPolicy property: The client encryption policy for the container. + * + * @return the clientEncryptionPolicy value. + */ + public ClientEncryptionPolicy clientEncryptionPolicy() { + return this.clientEncryptionPolicy; + } + + /** + * Set the clientEncryptionPolicy property: The client encryption policy for the container. + * + * @param clientEncryptionPolicy the clientEncryptionPolicy value to set. + * @return the SqlContainerResource object itself. + */ + public SqlContainerResource withClientEncryptionPolicy(ClientEncryptionPolicy clientEncryptionPolicy) { + this.clientEncryptionPolicy = clientEncryptionPolicy; + 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; + } + + /** + * Get the restoreParameters property: Parameters to indicate the information about the restore. + * + * @return the restoreParameters value. + */ + public ResourceRestoreParameters 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 SqlContainerResource object itself. + */ + public SqlContainerResource withRestoreParameters(ResourceRestoreParameters restoreParameters) { + this.restoreParameters = restoreParameters; + return this; + } + + /** + * Get the createMode property: Enum to indicate the mode of resource creation. + * + * @return the createMode value. + */ + public CreateMode createMode() { + return this.createMode; + } + + /** + * Set the createMode property: Enum to indicate the mode of resource creation. + * + * @param createMode the createMode value to set. + * @return the SqlContainerResource object itself. + */ + public SqlContainerResource withCreateMode(CreateMode createMode) { + this.createMode = createMode; + return this; + } + + /** + * Get the computedProperties property: List of computed properties. + * + * @return the computedProperties value. + */ + public List computedProperties() { + return this.computedProperties; + } + + /** + * Set the computedProperties property: List of computed properties. + * + * @param computedProperties the computedProperties value to set. + * @return the SqlContainerResource object itself. + */ + public SqlContainerResource withComputedProperties(List computedProperties) { + this.computedProperties = computedProperties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw LOGGER.atError() + .log(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(); + } + if (clientEncryptionPolicy() != null) { + clientEncryptionPolicy().validate(); + } + if (restoreParameters() != null) { + restoreParameters().validate(); + } + if (computedProperties() != null) { + computedProperties().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlContainerResource.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeJsonField("indexingPolicy", this.indexingPolicy); + jsonWriter.writeJsonField("partitionKey", this.partitionKey); + jsonWriter.writeNumberField("defaultTtl", this.defaultTtl); + jsonWriter.writeJsonField("uniqueKeyPolicy", this.uniqueKeyPolicy); + jsonWriter.writeJsonField("conflictResolutionPolicy", this.conflictResolutionPolicy); + jsonWriter.writeJsonField("clientEncryptionPolicy", this.clientEncryptionPolicy); + jsonWriter.writeNumberField("analyticalStorageTtl", this.analyticalStorageTtl); + jsonWriter.writeJsonField("restoreParameters", this.restoreParameters); + jsonWriter.writeStringField("createMode", this.createMode == null ? null : this.createMode.toString()); + jsonWriter.writeArrayField("computedProperties", this.computedProperties, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlContainerResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlContainerResource if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlContainerResource. + */ + public static SqlContainerResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlContainerResource deserializedSqlContainerResource = new SqlContainerResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSqlContainerResource.id = reader.getString(); + } else if ("indexingPolicy".equals(fieldName)) { + deserializedSqlContainerResource.indexingPolicy = IndexingPolicy.fromJson(reader); + } else if ("partitionKey".equals(fieldName)) { + deserializedSqlContainerResource.partitionKey = ContainerPartitionKey.fromJson(reader); + } else if ("defaultTtl".equals(fieldName)) { + deserializedSqlContainerResource.defaultTtl = reader.getNullable(JsonReader::getInt); + } else if ("uniqueKeyPolicy".equals(fieldName)) { + deserializedSqlContainerResource.uniqueKeyPolicy = UniqueKeyPolicy.fromJson(reader); + } else if ("conflictResolutionPolicy".equals(fieldName)) { + deserializedSqlContainerResource.conflictResolutionPolicy + = ConflictResolutionPolicy.fromJson(reader); + } else if ("clientEncryptionPolicy".equals(fieldName)) { + deserializedSqlContainerResource.clientEncryptionPolicy = ClientEncryptionPolicy.fromJson(reader); + } else if ("analyticalStorageTtl".equals(fieldName)) { + deserializedSqlContainerResource.analyticalStorageTtl = reader.getNullable(JsonReader::getLong); + } else if ("restoreParameters".equals(fieldName)) { + deserializedSqlContainerResource.restoreParameters = ResourceRestoreParameters.fromJson(reader); + } else if ("createMode".equals(fieldName)) { + deserializedSqlContainerResource.createMode = CreateMode.fromString(reader.getString()); + } else if ("computedProperties".equals(fieldName)) { + List computedProperties + = reader.readArray(reader1 -> ComputedProperty.fromJson(reader1)); + deserializedSqlContainerResource.computedProperties = computedProperties; + } else { + reader.skipChildren(); + } + } + + return deserializedSqlContainerResource; + }); + } +} 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..f7d90ca8e4013 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseCreateUpdateParameters.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlDatabaseCreateUpdateProperties; +import java.io.IOException; +import java.util.Map; + +/** + * Parameters to create and update Cosmos DB SQL database. + */ +@Fluent +public final class SqlDatabaseCreateUpdateParameters extends ArmResourceProperties { + /* + * Properties to create and update Azure Cosmos DB SQL database. + */ + private SqlDatabaseCreateUpdateProperties innerProperties = new SqlDatabaseCreateUpdateProperties(); + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of SqlDatabaseCreateUpdateParameters class. + */ + public SqlDatabaseCreateUpdateParameters() { + } + + /** + * Get the innerProperties property: Properties to create and update Azure Cosmos DB SQL database. + * + * @return the innerProperties value. + */ + private SqlDatabaseCreateUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@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() { + if (innerProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property innerProperties in model SqlDatabaseCreateUpdateParameters")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlDatabaseCreateUpdateParameters.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlDatabaseCreateUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlDatabaseCreateUpdateParameters if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlDatabaseCreateUpdateParameters. + */ + public static SqlDatabaseCreateUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlDatabaseCreateUpdateParameters deserializedSqlDatabaseCreateUpdateParameters + = new SqlDatabaseCreateUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSqlDatabaseCreateUpdateParameters.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSqlDatabaseCreateUpdateParameters.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSqlDatabaseCreateUpdateParameters.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedSqlDatabaseCreateUpdateParameters.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedSqlDatabaseCreateUpdateParameters.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedSqlDatabaseCreateUpdateParameters.innerProperties + = SqlDatabaseCreateUpdateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlDatabaseCreateUpdateParameters; + }); + } +} 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..4ae8018a2fefb --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseGetPropertiesOptions.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The SqlDatabaseGetPropertiesOptions model. + */ +@Fluent +public final class SqlDatabaseGetPropertiesOptions extends OptionsResource { + /** + * Creates an instance of SqlDatabaseGetPropertiesOptions class. + */ + public SqlDatabaseGetPropertiesOptions() { + } + + /** + * {@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() { + if (autoscaleSettings() != null) { + autoscaleSettings().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("throughput", throughput()); + jsonWriter.writeJsonField("autoscaleSettings", autoscaleSettings()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlDatabaseGetPropertiesOptions from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlDatabaseGetPropertiesOptions if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlDatabaseGetPropertiesOptions. + */ + public static SqlDatabaseGetPropertiesOptions fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlDatabaseGetPropertiesOptions deserializedSqlDatabaseGetPropertiesOptions + = new SqlDatabaseGetPropertiesOptions(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("throughput".equals(fieldName)) { + deserializedSqlDatabaseGetPropertiesOptions.withThroughput(reader.getNullable(JsonReader::getInt)); + } else if ("autoscaleSettings".equals(fieldName)) { + deserializedSqlDatabaseGetPropertiesOptions + .withAutoscaleSettings(AutoscaleSettings.fromJson(reader)); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlDatabaseGetPropertiesOptions; + }); + } +} 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..dc53604cc4347 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseGetPropertiesResource.java @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The SqlDatabaseGetPropertiesResource model. + */ +@Fluent +public final class SqlDatabaseGetPropertiesResource extends SqlDatabaseResource { + /* + * A system generated property that specified the addressable path of the collections resource. + */ + private String colls; + + /* + * A system generated property that specifies the addressable path of the users resource. + */ + private String users; + + /* + * A system generated property. A unique identifier. + */ + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of the resource. + */ + private Float ts; + + /* + * A system generated property representing the resource etag required for optimistic concurrency control. + */ + private String etag; + + /** + * Creates an instance of SqlDatabaseGetPropertiesResource class. + */ + public SqlDatabaseGetPropertiesResource() { + } + + /** + * 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; + } + + /** + * {@inheritDoc} + */ + @Override + public SqlDatabaseGetPropertiesResource withRestoreParameters(ResourceRestoreParameters restoreParameters) { + super.withRestoreParameters(restoreParameters); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public SqlDatabaseGetPropertiesResource withCreateMode(CreateMode createMode) { + super.withCreateMode(createMode); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (id() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property id in model SqlDatabaseGetPropertiesResource")); + } + if (restoreParameters() != null) { + restoreParameters().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlDatabaseGetPropertiesResource.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", id()); + jsonWriter.writeJsonField("restoreParameters", restoreParameters()); + jsonWriter.writeStringField("createMode", createMode() == null ? null : createMode().toString()); + jsonWriter.writeStringField("_colls", this.colls); + jsonWriter.writeStringField("_users", this.users); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlDatabaseGetPropertiesResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlDatabaseGetPropertiesResource if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlDatabaseGetPropertiesResource. + */ + public static SqlDatabaseGetPropertiesResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlDatabaseGetPropertiesResource deserializedSqlDatabaseGetPropertiesResource + = new SqlDatabaseGetPropertiesResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSqlDatabaseGetPropertiesResource.withId(reader.getString()); + } else if ("restoreParameters".equals(fieldName)) { + deserializedSqlDatabaseGetPropertiesResource + .withRestoreParameters(ResourceRestoreParameters.fromJson(reader)); + } else if ("createMode".equals(fieldName)) { + deserializedSqlDatabaseGetPropertiesResource + .withCreateMode(CreateMode.fromString(reader.getString())); + } else if ("_colls".equals(fieldName)) { + deserializedSqlDatabaseGetPropertiesResource.colls = reader.getString(); + } else if ("_users".equals(fieldName)) { + deserializedSqlDatabaseGetPropertiesResource.users = reader.getString(); + } else if ("_rid".equals(fieldName)) { + deserializedSqlDatabaseGetPropertiesResource.rid = reader.getString(); + } else if ("_ts".equals(fieldName)) { + deserializedSqlDatabaseGetPropertiesResource.ts = reader.getNullable(JsonReader::getFloat); + } else if ("_etag".equals(fieldName)) { + deserializedSqlDatabaseGetPropertiesResource.etag = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlDatabaseGetPropertiesResource; + }); + } +} 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..94b43d995b522 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseGetResults.java @@ -0,0 +1,295 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 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 name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * 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.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 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.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 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..094501be13a00 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseListResult.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlDatabaseGetResultsInner; +import java.io.IOException; +import java.util.List; + +/** + * The List operation response, that contains the SQL databases and their properties. + */ +@Immutable +public final class SqlDatabaseListResult implements JsonSerializable { + /* + * List of SQL databases and their properties. + */ + private List value; + + /** + * Creates an instance of SqlDatabaseListResult class. + */ + public SqlDatabaseListResult() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlDatabaseListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlDatabaseListResult if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlDatabaseListResult. + */ + public static SqlDatabaseListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlDatabaseListResult deserializedSqlDatabaseListResult = new SqlDatabaseListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> SqlDatabaseGetResultsInner.fromJson(reader1)); + deserializedSqlDatabaseListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedSqlDatabaseListResult; + }); + } +} 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..315573b920808 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseResource.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Cosmos DB SQL database resource object. + */ +@Fluent +public class SqlDatabaseResource implements JsonSerializable { + /* + * Name of the Cosmos DB SQL database + */ + private String id; + + /* + * Parameters to indicate the information about the restore + */ + private ResourceRestoreParameters restoreParameters; + + /* + * Enum to indicate the mode of resource creation. + */ + private CreateMode createMode; + + /** + * Creates an instance of SqlDatabaseResource class. + */ + public SqlDatabaseResource() { + } + + /** + * 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; + } + + /** + * Get the restoreParameters property: Parameters to indicate the information about the restore. + * + * @return the restoreParameters value. + */ + public ResourceRestoreParameters 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 SqlDatabaseResource object itself. + */ + public SqlDatabaseResource withRestoreParameters(ResourceRestoreParameters restoreParameters) { + this.restoreParameters = restoreParameters; + return this; + } + + /** + * Get the createMode property: Enum to indicate the mode of resource creation. + * + * @return the createMode value. + */ + public CreateMode createMode() { + return this.createMode; + } + + /** + * Set the createMode property: Enum to indicate the mode of resource creation. + * + * @param createMode the createMode value to set. + * @return the SqlDatabaseResource object itself. + */ + public SqlDatabaseResource withCreateMode(CreateMode createMode) { + this.createMode = createMode; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property id in model SqlDatabaseResource")); + } + if (restoreParameters() != null) { + restoreParameters().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlDatabaseResource.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeJsonField("restoreParameters", this.restoreParameters); + jsonWriter.writeStringField("createMode", this.createMode == null ? null : this.createMode.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlDatabaseResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlDatabaseResource if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlDatabaseResource. + */ + public static SqlDatabaseResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlDatabaseResource deserializedSqlDatabaseResource = new SqlDatabaseResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSqlDatabaseResource.id = reader.getString(); + } else if ("restoreParameters".equals(fieldName)) { + deserializedSqlDatabaseResource.restoreParameters = ResourceRestoreParameters.fromJson(reader); + } else if ("createMode".equals(fieldName)) { + deserializedSqlDatabaseResource.createMode = CreateMode.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlDatabaseResource; + }); + } +} 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..3c819f4479b8c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDedicatedGatewayRegionalServiceResource.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.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Resource for a regional service location. + */ +@Immutable +public final class SqlDedicatedGatewayRegionalServiceResource extends RegionalServiceResource { + /* + * The regional endpoint for SqlDedicatedGateway. + */ + private String sqlDedicatedGatewayEndpoint; + + /* + * Describes the status of a service. + */ + private ServiceStatus status; + + /* + * The location name. + */ + private String location; + + /* + * The regional service name. + */ + private String name; + + /** + * Creates an instance of SqlDedicatedGatewayRegionalServiceResource class. + */ + public SqlDedicatedGatewayRegionalServiceResource() { + } + + /** + * Get the sqlDedicatedGatewayEndpoint property: The regional endpoint for SqlDedicatedGateway. + * + * @return the sqlDedicatedGatewayEndpoint value. + */ + public String sqlDedicatedGatewayEndpoint() { + return this.sqlDedicatedGatewayEndpoint; + } + + /** + * Get the status property: Describes the status of a service. + * + * @return the status value. + */ + @Override + public ServiceStatus status() { + return this.status; + } + + /** + * Get the location property: The location name. + * + * @return the location value. + */ + @Override + public String location() { + return this.location; + } + + /** + * Get the name property: The regional service name. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlDedicatedGatewayRegionalServiceResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlDedicatedGatewayRegionalServiceResource if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlDedicatedGatewayRegionalServiceResource. + */ + public static SqlDedicatedGatewayRegionalServiceResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlDedicatedGatewayRegionalServiceResource deserializedSqlDedicatedGatewayRegionalServiceResource + = new SqlDedicatedGatewayRegionalServiceResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedSqlDedicatedGatewayRegionalServiceResource.name = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedSqlDedicatedGatewayRegionalServiceResource.location = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedSqlDedicatedGatewayRegionalServiceResource.status + = ServiceStatus.fromString(reader.getString()); + } else if ("sqlDedicatedGatewayEndpoint".equals(fieldName)) { + deserializedSqlDedicatedGatewayRegionalServiceResource.sqlDedicatedGatewayEndpoint + = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlDedicatedGatewayRegionalServiceResource; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDedicatedGatewayServiceResourceCreateUpdateProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDedicatedGatewayServiceResourceCreateUpdateProperties.java new file mode 100644 index 0000000000000..7d979f63d9c1c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDedicatedGatewayServiceResourceCreateUpdateProperties.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Properties for Create or Update request for SqlDedicatedGatewayServiceResource. + */ +@Fluent +public final class SqlDedicatedGatewayServiceResourceCreateUpdateProperties + extends ServiceResourceCreateUpdateProperties { + /* + * ServiceType for the service. + */ + private ServiceType serviceType = ServiceType.SQL_DEDICATED_GATEWAY; + + /* + * DedicatedGatewayType for the service. + */ + private DedicatedGatewayType dedicatedGatewayType; + + /** + * Creates an instance of SqlDedicatedGatewayServiceResourceCreateUpdateProperties class. + */ + public SqlDedicatedGatewayServiceResourceCreateUpdateProperties() { + } + + /** + * Get the serviceType property: ServiceType for the service. + * + * @return the serviceType value. + */ + @Override + public ServiceType serviceType() { + return this.serviceType; + } + + /** + * Get the dedicatedGatewayType property: DedicatedGatewayType for the service. + * + * @return the dedicatedGatewayType value. + */ + public DedicatedGatewayType dedicatedGatewayType() { + return this.dedicatedGatewayType; + } + + /** + * Set the dedicatedGatewayType property: DedicatedGatewayType for the service. + * + * @param dedicatedGatewayType the dedicatedGatewayType value to set. + * @return the SqlDedicatedGatewayServiceResourceCreateUpdateProperties object itself. + */ + public SqlDedicatedGatewayServiceResourceCreateUpdateProperties + withDedicatedGatewayType(DedicatedGatewayType dedicatedGatewayType) { + this.dedicatedGatewayType = dedicatedGatewayType; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public SqlDedicatedGatewayServiceResourceCreateUpdateProperties withInstanceSize(ServiceSize instanceSize) { + super.withInstanceSize(instanceSize); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public SqlDedicatedGatewayServiceResourceCreateUpdateProperties withInstanceCount(Integer instanceCount) { + super.withInstanceCount(instanceCount); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("instanceSize", instanceSize() == null ? null : instanceSize().toString()); + jsonWriter.writeNumberField("instanceCount", instanceCount()); + jsonWriter.writeStringField("serviceType", this.serviceType == null ? null : this.serviceType.toString()); + jsonWriter.writeStringField("dedicatedGatewayType", + this.dedicatedGatewayType == null ? null : this.dedicatedGatewayType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlDedicatedGatewayServiceResourceCreateUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlDedicatedGatewayServiceResourceCreateUpdateProperties if the JsonReader was pointing to + * an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the + * SqlDedicatedGatewayServiceResourceCreateUpdateProperties. + */ + public static SqlDedicatedGatewayServiceResourceCreateUpdateProperties fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + SqlDedicatedGatewayServiceResourceCreateUpdateProperties deserializedSqlDedicatedGatewayServiceResourceCreateUpdateProperties + = new SqlDedicatedGatewayServiceResourceCreateUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("instanceSize".equals(fieldName)) { + deserializedSqlDedicatedGatewayServiceResourceCreateUpdateProperties + .withInstanceSize(ServiceSize.fromString(reader.getString())); + } else if ("instanceCount".equals(fieldName)) { + deserializedSqlDedicatedGatewayServiceResourceCreateUpdateProperties + .withInstanceCount(reader.getNullable(JsonReader::getInt)); + } else if ("serviceType".equals(fieldName)) { + deserializedSqlDedicatedGatewayServiceResourceCreateUpdateProperties.serviceType + = ServiceType.fromString(reader.getString()); + } else if ("dedicatedGatewayType".equals(fieldName)) { + deserializedSqlDedicatedGatewayServiceResourceCreateUpdateProperties.dedicatedGatewayType + = DedicatedGatewayType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlDedicatedGatewayServiceResourceCreateUpdateProperties; + }); + } +} 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..6ae8dd38f8b8b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDedicatedGatewayServiceResourceProperties.java @@ -0,0 +1,245 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** + * Properties for SqlDedicatedGatewayServiceResource. + */ +@Fluent +public final class SqlDedicatedGatewayServiceResourceProperties extends ServiceResourceProperties { + /* + * ServiceType for the service. + */ + private ServiceType serviceType = ServiceType.SQL_DEDICATED_GATEWAY; + + /* + * SqlDedicatedGateway endpoint for the service. + */ + private String sqlDedicatedGatewayEndpoint; + + /* + * DedicatedGatewayType for the service. + */ + private DedicatedGatewayType dedicatedGatewayType; + + /* + * An array that contains all of the locations for the service. + */ + private List locations; + + /* + * Describes the status of a service. + */ + private ServiceStatus status; + + /* + * Time of the last state change (ISO-8601 format). + */ + private OffsetDateTime creationTime; + + /** + * Creates an instance of SqlDedicatedGatewayServiceResourceProperties class. + */ + public SqlDedicatedGatewayServiceResourceProperties() { + } + + /** + * Get the serviceType property: ServiceType for the service. + * + * @return the serviceType value. + */ + @Override + public ServiceType serviceType() { + return this.serviceType; + } + + /** + * 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 dedicatedGatewayType property: DedicatedGatewayType for the service. + * + * @return the dedicatedGatewayType value. + */ + public DedicatedGatewayType dedicatedGatewayType() { + return this.dedicatedGatewayType; + } + + /** + * Set the dedicatedGatewayType property: DedicatedGatewayType for the service. + * + * @param dedicatedGatewayType the dedicatedGatewayType value to set. + * @return the SqlDedicatedGatewayServiceResourceProperties object itself. + */ + public SqlDedicatedGatewayServiceResourceProperties + withDedicatedGatewayType(DedicatedGatewayType dedicatedGatewayType) { + this.dedicatedGatewayType = dedicatedGatewayType; + 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; + } + + /** + * Get the status property: Describes the status of a service. + * + * @return the status value. + */ + @Override + public ServiceStatus status() { + return this.status; + } + + /** + * Get the creationTime property: Time of the last state change (ISO-8601 format). + * + * @return the creationTime value. + */ + @Override + public OffsetDateTime creationTime() { + return this.creationTime; + } + + /** + * {@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() { + if (locations() != null) { + locations().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("instanceSize", instanceSize() == null ? null : instanceSize().toString()); + jsonWriter.writeNumberField("instanceCount", instanceCount()); + jsonWriter.writeStringField("serviceType", this.serviceType == null ? null : this.serviceType.toString()); + jsonWriter.writeStringField("sqlDedicatedGatewayEndpoint", this.sqlDedicatedGatewayEndpoint); + jsonWriter.writeStringField("dedicatedGatewayType", + this.dedicatedGatewayType == null ? null : this.dedicatedGatewayType.toString()); + if (additionalProperties() != null) { + for (Map.Entry additionalProperty : additionalProperties().entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlDedicatedGatewayServiceResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlDedicatedGatewayServiceResourceProperties if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlDedicatedGatewayServiceResourceProperties. + */ + public static SqlDedicatedGatewayServiceResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlDedicatedGatewayServiceResourceProperties deserializedSqlDedicatedGatewayServiceResourceProperties + = new SqlDedicatedGatewayServiceResourceProperties(); + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("creationTime".equals(fieldName)) { + deserializedSqlDedicatedGatewayServiceResourceProperties.creationTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("instanceSize".equals(fieldName)) { + deserializedSqlDedicatedGatewayServiceResourceProperties + .withInstanceSize(ServiceSize.fromString(reader.getString())); + } else if ("instanceCount".equals(fieldName)) { + deserializedSqlDedicatedGatewayServiceResourceProperties + .withInstanceCount(reader.getNullable(JsonReader::getInt)); + } else if ("status".equals(fieldName)) { + deserializedSqlDedicatedGatewayServiceResourceProperties.status + = ServiceStatus.fromString(reader.getString()); + } else if ("serviceType".equals(fieldName)) { + deserializedSqlDedicatedGatewayServiceResourceProperties.serviceType + = ServiceType.fromString(reader.getString()); + } else if ("sqlDedicatedGatewayEndpoint".equals(fieldName)) { + deserializedSqlDedicatedGatewayServiceResourceProperties.sqlDedicatedGatewayEndpoint + = reader.getString(); + } else if ("dedicatedGatewayType".equals(fieldName)) { + deserializedSqlDedicatedGatewayServiceResourceProperties.dedicatedGatewayType + = DedicatedGatewayType.fromString(reader.getString()); + } else if ("locations".equals(fieldName)) { + List locations + = reader.readArray(reader1 -> SqlDedicatedGatewayRegionalServiceResource.fromJson(reader1)); + deserializedSqlDedicatedGatewayServiceResourceProperties.locations = locations; + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.readUntyped()); + } + } + deserializedSqlDedicatedGatewayServiceResourceProperties.withAdditionalProperties(additionalProperties); + + return deserializedSqlDedicatedGatewayServiceResourceProperties; + }); + } +} 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..8e12379716657 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlResources.java @@ -0,0 +1,1384 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 as paginated response + * with {@link PagedIterable}. + */ + 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 as paginated response + * with {@link PagedIterable}. + */ + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with + * {@link Response}. + */ + Response getSqlDatabaseWithResponse(String resourceGroupName, String accountName, + String databaseName, 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); + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + Response getSqlDatabaseThroughputWithResponse(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); + + /** + * 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 as paginated response with + * {@link PagedIterable}. + */ + 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 as paginated response with + * {@link PagedIterable}. + */ + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + Response getSqlContainerWithResponse(String resourceGroupName, String accountName, + String databaseName, String containerName, 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); + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with + * {@link Response}. + */ + Response getSqlContainerThroughputWithResponse(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); + + /** + * 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 ClientEncryptionKeys under 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 List operation response, that contains the client encryption keys and their properties as paginated + * response with {@link PagedIterable}. + */ + PagedIterable listClientEncryptionKeys(String resourceGroupName, String accountName, + String databaseName); + + /** + * Lists the ClientEncryptionKeys under 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 List operation response, that contains the client encryption keys and their properties as paginated + * response with {@link PagedIterable}. + */ + PagedIterable listClientEncryptionKeys(String resourceGroupName, String accountName, + String databaseName, Context context); + + /** + * Gets the ClientEncryptionKey under 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 clientEncryptionKeyName Cosmos DB ClientEncryptionKey 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 ClientEncryptionKey under an existing Azure Cosmos DB SQL database along with {@link Response}. + */ + Response getClientEncryptionKeyWithResponse(String resourceGroupName, + String accountName, String databaseName, String clientEncryptionKeyName, Context context); + + /** + * Gets the ClientEncryptionKey under 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 clientEncryptionKeyName Cosmos DB ClientEncryptionKey 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 ClientEncryptionKey under an existing Azure Cosmos DB SQL database. + */ + ClientEncryptionKeyGetResults getClientEncryptionKey(String resourceGroupName, String accountName, + String databaseName, String clientEncryptionKeyName); + + /** + * 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 as paginated + * response with {@link PagedIterable}. + */ + 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 as paginated + * response with {@link PagedIterable}. + */ + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + Response getSqlStoredProcedureWithResponse(String resourceGroupName, + String accountName, String databaseName, String containerName, String storedProcedureName, 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); + + /** + * 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 as paginated + * response with {@link PagedIterable}. + */ + 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 as paginated + * response with {@link PagedIterable}. + */ + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with + * {@link Response}. + */ + Response getSqlUserDefinedFunctionWithResponse(String resourceGroupName, + String accountName, String databaseName, String containerName, String userDefinedFunctionName, 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); + + /** + * 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 as paginated response with + * {@link PagedIterable}. + */ + 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 as paginated response with + * {@link PagedIterable}. + */ + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + Response getSqlTriggerWithResponse(String resourceGroupName, String accountName, + String databaseName, String containerName, String triggerName, 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); + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the 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 along with {@link Response}. + */ + Response getSqlRoleDefinitionWithResponse(String roleDefinitionId, + String resourceGroupName, String accountName, 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); + + /** + * 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the 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 along with {@link Response}. + */ + Response getSqlRoleAssignmentWithResponse(String roleAssignmentId, + 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); + + /** + * 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with + * {@link Response}. + */ + 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 along with + * {@link Response}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + Response getSqlContainerByIdWithResponse(String id, Context context); + + /** + * Gets the ClientEncryptionKey under 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. + * @return the ClientEncryptionKey under an existing Azure Cosmos DB SQL database along with {@link Response}. + */ + ClientEncryptionKeyGetResults getClientEncryptionKeyById(String id); + + /** + * Gets the ClientEncryptionKey under 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. + * @return the ClientEncryptionKey under an existing Azure Cosmos DB SQL database along with {@link Response}. + */ + Response getClientEncryptionKeyByIdWithResponse(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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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 along with + * {@link Response}. + */ + 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 along with + * {@link Response}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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 ClientEncryptionKeyGetResults resource. + * + * @param name resource name. + * @return the first stage of the new ClientEncryptionKeyGetResults definition. + */ + ClientEncryptionKeyGetResults.DefinitionStages.Blank defineUpdateClientEncryptionKey(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..fbdbd233d88ec --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlRoleAssignmentCreateUpdateParameters.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlRoleAssignmentResource; +import java.io.IOException; + +/** + * Parameters to create and update an Azure Cosmos DB SQL Role Assignment. + */ +@Fluent +public final class SqlRoleAssignmentCreateUpdateParameters + implements JsonSerializable { + /* + * Properties to create and update an Azure Cosmos DB SQL Role Assignment. + */ + private SqlRoleAssignmentResource innerProperties; + + /** + * Creates an instance of SqlRoleAssignmentCreateUpdateParameters class. + */ + public SqlRoleAssignmentCreateUpdateParameters() { + } + + /** + * 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlRoleAssignmentCreateUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlRoleAssignmentCreateUpdateParameters if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlRoleAssignmentCreateUpdateParameters. + */ + public static SqlRoleAssignmentCreateUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlRoleAssignmentCreateUpdateParameters deserializedSqlRoleAssignmentCreateUpdateParameters + = new SqlRoleAssignmentCreateUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedSqlRoleAssignmentCreateUpdateParameters.innerProperties + = SqlRoleAssignmentResource.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlRoleAssignmentCreateUpdateParameters; + }); + } +} 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..5138bc7c39167 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlRoleAssignmentGetResults.java @@ -0,0 +1,261 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * 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..2ca65f15ba3d7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlRoleAssignmentListResult.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlRoleAssignmentGetResultsInner; +import java.io.IOException; +import java.util.List; + +/** + * The relevant Role Assignments. + */ +@Immutable +public final class SqlRoleAssignmentListResult implements JsonSerializable { + /* + * List of Role Assignments and their properties + */ + private List value; + + /** + * Creates an instance of SqlRoleAssignmentListResult class. + */ + public SqlRoleAssignmentListResult() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlRoleAssignmentListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlRoleAssignmentListResult if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlRoleAssignmentListResult. + */ + public static SqlRoleAssignmentListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlRoleAssignmentListResult deserializedSqlRoleAssignmentListResult = new SqlRoleAssignmentListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> SqlRoleAssignmentGetResultsInner.fromJson(reader1)); + deserializedSqlRoleAssignmentListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedSqlRoleAssignmentListResult; + }); + } +} 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..3db199c220920 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlRoleDefinitionCreateUpdateParameters.java @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlRoleDefinitionResource; +import java.io.IOException; +import java.util.List; + +/** + * Parameters to create and update an Azure Cosmos DB SQL Role Definition. + */ +@Fluent +public final class SqlRoleDefinitionCreateUpdateParameters + implements JsonSerializable { + /* + * Properties to create and update an Azure Cosmos DB SQL Role Definition. + */ + private SqlRoleDefinitionResource innerProperties; + + /** + * Creates an instance of SqlRoleDefinitionCreateUpdateParameters class. + */ + public SqlRoleDefinitionCreateUpdateParameters() { + } + + /** + * 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlRoleDefinitionCreateUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlRoleDefinitionCreateUpdateParameters if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlRoleDefinitionCreateUpdateParameters. + */ + public static SqlRoleDefinitionCreateUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlRoleDefinitionCreateUpdateParameters deserializedSqlRoleDefinitionCreateUpdateParameters + = new SqlRoleDefinitionCreateUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedSqlRoleDefinitionCreateUpdateParameters.innerProperties + = SqlRoleDefinitionResource.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlRoleDefinitionCreateUpdateParameters; + }); + } +} 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..4a99c5ef84107 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlRoleDefinitionGetResults.java @@ -0,0 +1,306 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * 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..af23d85abb8f1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlRoleDefinitionListResult.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlRoleDefinitionGetResultsInner; +import java.io.IOException; +import java.util.List; + +/** + * The relevant Role Definitions. + */ +@Immutable +public final class SqlRoleDefinitionListResult implements JsonSerializable { + /* + * List of Role Definitions and their properties. + */ + private List value; + + /** + * Creates an instance of SqlRoleDefinitionListResult class. + */ + public SqlRoleDefinitionListResult() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlRoleDefinitionListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlRoleDefinitionListResult if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlRoleDefinitionListResult. + */ + public static SqlRoleDefinitionListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlRoleDefinitionListResult deserializedSqlRoleDefinitionListResult = new SqlRoleDefinitionListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> SqlRoleDefinitionGetResultsInner.fromJson(reader1)); + deserializedSqlRoleDefinitionListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedSqlRoleDefinitionListResult; + }); + } +} 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..c1ead1632b50f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlStoredProcedureCreateUpdateParameters.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlStoredProcedureCreateUpdateProperties; +import java.io.IOException; +import java.util.Map; + +/** + * Parameters to create and update Cosmos DB storedProcedure. + */ +@Fluent +public final class SqlStoredProcedureCreateUpdateParameters extends ArmResourceProperties { + /* + * Properties to create and update Azure Cosmos DB storedProcedure. + */ + private SqlStoredProcedureCreateUpdateProperties innerProperties = new SqlStoredProcedureCreateUpdateProperties(); + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of SqlStoredProcedureCreateUpdateParameters class. + */ + public SqlStoredProcedureCreateUpdateParameters() { + } + + /** + * Get the innerProperties property: Properties to create and update Azure Cosmos DB storedProcedure. + * + * @return the innerProperties value. + */ + private SqlStoredProcedureCreateUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@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() { + if (innerProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property innerProperties in model SqlStoredProcedureCreateUpdateParameters")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlStoredProcedureCreateUpdateParameters.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlStoredProcedureCreateUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlStoredProcedureCreateUpdateParameters if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlStoredProcedureCreateUpdateParameters. + */ + public static SqlStoredProcedureCreateUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlStoredProcedureCreateUpdateParameters deserializedSqlStoredProcedureCreateUpdateParameters + = new SqlStoredProcedureCreateUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSqlStoredProcedureCreateUpdateParameters.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSqlStoredProcedureCreateUpdateParameters.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSqlStoredProcedureCreateUpdateParameters.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedSqlStoredProcedureCreateUpdateParameters.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedSqlStoredProcedureCreateUpdateParameters.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedSqlStoredProcedureCreateUpdateParameters.innerProperties + = SqlStoredProcedureCreateUpdateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlStoredProcedureCreateUpdateParameters; + }); + } +} 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..44837ac400990 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlStoredProcedureGetPropertiesResource.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The SqlStoredProcedureGetPropertiesResource model. + */ +@Fluent +public final class SqlStoredProcedureGetPropertiesResource extends SqlStoredProcedureResource { + /* + * A system generated property. A unique identifier. + */ + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of the resource. + */ + private Float ts; + + /* + * A system generated property representing the resource etag required for optimistic concurrency control. + */ + private String etag; + + /** + * Creates an instance of SqlStoredProcedureGetPropertiesResource class. + */ + public SqlStoredProcedureGetPropertiesResource() { + } + + /** + * 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() { + if (id() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property id in model SqlStoredProcedureGetPropertiesResource")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlStoredProcedureGetPropertiesResource.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", id()); + jsonWriter.writeStringField("body", body()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlStoredProcedureGetPropertiesResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlStoredProcedureGetPropertiesResource if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlStoredProcedureGetPropertiesResource. + */ + public static SqlStoredProcedureGetPropertiesResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlStoredProcedureGetPropertiesResource deserializedSqlStoredProcedureGetPropertiesResource + = new SqlStoredProcedureGetPropertiesResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSqlStoredProcedureGetPropertiesResource.withId(reader.getString()); + } else if ("body".equals(fieldName)) { + deserializedSqlStoredProcedureGetPropertiesResource.withBody(reader.getString()); + } else if ("_rid".equals(fieldName)) { + deserializedSqlStoredProcedureGetPropertiesResource.rid = reader.getString(); + } else if ("_ts".equals(fieldName)) { + deserializedSqlStoredProcedureGetPropertiesResource.ts = reader.getNullable(JsonReader::getFloat); + } else if ("_etag".equals(fieldName)) { + deserializedSqlStoredProcedureGetPropertiesResource.etag = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlStoredProcedureGetPropertiesResource; + }); + } +} 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..8d2f584a11ca6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlStoredProcedureGetResults.java @@ -0,0 +1,291 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 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 name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * 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.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 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.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 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..8882f7d580d3d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlStoredProcedureListResult.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlStoredProcedureGetResultsInner; +import java.io.IOException; +import java.util.List; + +/** + * The List operation response, that contains the storedProcedures and their properties. + */ +@Immutable +public final class SqlStoredProcedureListResult implements JsonSerializable { + /* + * List of storedProcedures and their properties. + */ + private List value; + + /** + * Creates an instance of SqlStoredProcedureListResult class. + */ + public SqlStoredProcedureListResult() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlStoredProcedureListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlStoredProcedureListResult if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlStoredProcedureListResult. + */ + public static SqlStoredProcedureListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlStoredProcedureListResult deserializedSqlStoredProcedureListResult = new SqlStoredProcedureListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> SqlStoredProcedureGetResultsInner.fromJson(reader1)); + deserializedSqlStoredProcedureListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedSqlStoredProcedureListResult; + }); + } +} 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..1eda6cd3846c7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlStoredProcedureResource.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.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Cosmos DB SQL storedProcedure resource object. + */ +@Fluent +public class SqlStoredProcedureResource implements JsonSerializable { + /* + * Name of the Cosmos DB SQL storedProcedure + */ + private String id; + + /* + * Body of the Stored Procedure + */ + private String body; + + /** + * Creates an instance of SqlStoredProcedureResource class. + */ + public SqlStoredProcedureResource() { + } + + /** + * 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.atError() + .log(new IllegalArgumentException("Missing required property id in model SqlStoredProcedureResource")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlStoredProcedureResource.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("body", this.body); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlStoredProcedureResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlStoredProcedureResource if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlStoredProcedureResource. + */ + public static SqlStoredProcedureResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlStoredProcedureResource deserializedSqlStoredProcedureResource = new SqlStoredProcedureResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSqlStoredProcedureResource.id = reader.getString(); + } else if ("body".equals(fieldName)) { + deserializedSqlStoredProcedureResource.body = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlStoredProcedureResource; + }); + } +} 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..b917462de5432 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlTriggerCreateUpdateParameters.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlTriggerCreateUpdateProperties; +import java.io.IOException; +import java.util.Map; + +/** + * Parameters to create and update Cosmos DB trigger. + */ +@Fluent +public final class SqlTriggerCreateUpdateParameters extends ArmResourceProperties { + /* + * Properties to create and update Azure Cosmos DB trigger. + */ + private SqlTriggerCreateUpdateProperties innerProperties = new SqlTriggerCreateUpdateProperties(); + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of SqlTriggerCreateUpdateParameters class. + */ + public SqlTriggerCreateUpdateParameters() { + } + + /** + * Get the innerProperties property: Properties to create and update Azure Cosmos DB trigger. + * + * @return the innerProperties value. + */ + private SqlTriggerCreateUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@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() { + if (innerProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property innerProperties in model SqlTriggerCreateUpdateParameters")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlTriggerCreateUpdateParameters.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlTriggerCreateUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlTriggerCreateUpdateParameters if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlTriggerCreateUpdateParameters. + */ + public static SqlTriggerCreateUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlTriggerCreateUpdateParameters deserializedSqlTriggerCreateUpdateParameters + = new SqlTriggerCreateUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSqlTriggerCreateUpdateParameters.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSqlTriggerCreateUpdateParameters.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSqlTriggerCreateUpdateParameters.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedSqlTriggerCreateUpdateParameters.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedSqlTriggerCreateUpdateParameters.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedSqlTriggerCreateUpdateParameters.innerProperties + = SqlTriggerCreateUpdateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlTriggerCreateUpdateParameters; + }); + } +} 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..10c382fc4611c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlTriggerGetPropertiesResource.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The SqlTriggerGetPropertiesResource model. + */ +@Fluent +public final class SqlTriggerGetPropertiesResource extends SqlTriggerResource { + /* + * A system generated property. A unique identifier. + */ + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of the resource. + */ + private Float ts; + + /* + * A system generated property representing the resource etag required for optimistic concurrency control. + */ + private String etag; + + /** + * Creates an instance of SqlTriggerGetPropertiesResource class. + */ + public SqlTriggerGetPropertiesResource() { + } + + /** + * 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() { + if (id() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property id in model SqlTriggerGetPropertiesResource")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlTriggerGetPropertiesResource.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", id()); + jsonWriter.writeStringField("body", body()); + jsonWriter.writeStringField("triggerType", triggerType() == null ? null : triggerType().toString()); + jsonWriter.writeStringField("triggerOperation", + triggerOperation() == null ? null : triggerOperation().toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlTriggerGetPropertiesResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlTriggerGetPropertiesResource if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlTriggerGetPropertiesResource. + */ + public static SqlTriggerGetPropertiesResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlTriggerGetPropertiesResource deserializedSqlTriggerGetPropertiesResource + = new SqlTriggerGetPropertiesResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSqlTriggerGetPropertiesResource.withId(reader.getString()); + } else if ("body".equals(fieldName)) { + deserializedSqlTriggerGetPropertiesResource.withBody(reader.getString()); + } else if ("triggerType".equals(fieldName)) { + deserializedSqlTriggerGetPropertiesResource + .withTriggerType(TriggerType.fromString(reader.getString())); + } else if ("triggerOperation".equals(fieldName)) { + deserializedSqlTriggerGetPropertiesResource + .withTriggerOperation(TriggerOperation.fromString(reader.getString())); + } else if ("_rid".equals(fieldName)) { + deserializedSqlTriggerGetPropertiesResource.rid = reader.getString(); + } else if ("_ts".equals(fieldName)) { + deserializedSqlTriggerGetPropertiesResource.ts = reader.getNullable(JsonReader::getFloat); + } else if ("_etag".equals(fieldName)) { + deserializedSqlTriggerGetPropertiesResource.etag = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlTriggerGetPropertiesResource; + }); + } +} 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..35094a92b38e6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlTriggerGetResults.java @@ -0,0 +1,291 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 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 name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * 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.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 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.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 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..391a39e5a21bd --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlTriggerListResult.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlTriggerGetResultsInner; +import java.io.IOException; +import java.util.List; + +/** + * The List operation response, that contains the triggers and their properties. + */ +@Immutable +public final class SqlTriggerListResult implements JsonSerializable { + /* + * List of triggers and their properties. + */ + private List value; + + /** + * Creates an instance of SqlTriggerListResult class. + */ + public SqlTriggerListResult() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlTriggerListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlTriggerListResult if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlTriggerListResult. + */ + public static SqlTriggerListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlTriggerListResult deserializedSqlTriggerListResult = new SqlTriggerListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> SqlTriggerGetResultsInner.fromJson(reader1)); + deserializedSqlTriggerListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedSqlTriggerListResult; + }); + } +} 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..852d1374383ea --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlTriggerResource.java @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Cosmos DB SQL trigger resource object. + */ +@Fluent +public class SqlTriggerResource implements JsonSerializable { + /* + * Name of the Cosmos DB SQL trigger + */ + private String id; + + /* + * Body of the Trigger + */ + private String body; + + /* + * Type of the Trigger + */ + private TriggerType triggerType; + + /* + * The operation the trigger is associated with + */ + private TriggerOperation triggerOperation; + + /** + * Creates an instance of SqlTriggerResource class. + */ + public SqlTriggerResource() { + } + + /** + * 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.atError() + .log(new IllegalArgumentException("Missing required property id in model SqlTriggerResource")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlTriggerResource.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("body", this.body); + jsonWriter.writeStringField("triggerType", this.triggerType == null ? null : this.triggerType.toString()); + jsonWriter.writeStringField("triggerOperation", + this.triggerOperation == null ? null : this.triggerOperation.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlTriggerResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlTriggerResource if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlTriggerResource. + */ + public static SqlTriggerResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlTriggerResource deserializedSqlTriggerResource = new SqlTriggerResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSqlTriggerResource.id = reader.getString(); + } else if ("body".equals(fieldName)) { + deserializedSqlTriggerResource.body = reader.getString(); + } else if ("triggerType".equals(fieldName)) { + deserializedSqlTriggerResource.triggerType = TriggerType.fromString(reader.getString()); + } else if ("triggerOperation".equals(fieldName)) { + deserializedSqlTriggerResource.triggerOperation = TriggerOperation.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlTriggerResource; + }); + } +} 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..2bf715bd72453 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlUserDefinedFunctionCreateUpdateParameters.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlUserDefinedFunctionCreateUpdateProperties; +import java.io.IOException; +import java.util.Map; + +/** + * Parameters to create and update Cosmos DB userDefinedFunction. + */ +@Fluent +public final class SqlUserDefinedFunctionCreateUpdateParameters extends ArmResourceProperties { + /* + * Properties to create and update Azure Cosmos DB userDefinedFunction. + */ + private SqlUserDefinedFunctionCreateUpdateProperties innerProperties + = new SqlUserDefinedFunctionCreateUpdateProperties(); + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of SqlUserDefinedFunctionCreateUpdateParameters class. + */ + public SqlUserDefinedFunctionCreateUpdateParameters() { + } + + /** + * Get the innerProperties property: Properties to create and update Azure Cosmos DB userDefinedFunction. + * + * @return the innerProperties value. + */ + private SqlUserDefinedFunctionCreateUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@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() { + if (innerProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property innerProperties in model SqlUserDefinedFunctionCreateUpdateParameters")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlUserDefinedFunctionCreateUpdateParameters.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlUserDefinedFunctionCreateUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlUserDefinedFunctionCreateUpdateParameters if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlUserDefinedFunctionCreateUpdateParameters. + */ + public static SqlUserDefinedFunctionCreateUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlUserDefinedFunctionCreateUpdateParameters deserializedSqlUserDefinedFunctionCreateUpdateParameters + = new SqlUserDefinedFunctionCreateUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSqlUserDefinedFunctionCreateUpdateParameters.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSqlUserDefinedFunctionCreateUpdateParameters.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSqlUserDefinedFunctionCreateUpdateParameters.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedSqlUserDefinedFunctionCreateUpdateParameters.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedSqlUserDefinedFunctionCreateUpdateParameters.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedSqlUserDefinedFunctionCreateUpdateParameters.innerProperties + = SqlUserDefinedFunctionCreateUpdateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlUserDefinedFunctionCreateUpdateParameters; + }); + } +} 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..dc230465b84c3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlUserDefinedFunctionGetPropertiesResource.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.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The SqlUserDefinedFunctionGetPropertiesResource model. + */ +@Fluent +public final class SqlUserDefinedFunctionGetPropertiesResource extends SqlUserDefinedFunctionResource { + /* + * A system generated property. A unique identifier. + */ + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of the resource. + */ + private Float ts; + + /* + * A system generated property representing the resource etag required for optimistic concurrency control. + */ + private String etag; + + /** + * Creates an instance of SqlUserDefinedFunctionGetPropertiesResource class. + */ + public SqlUserDefinedFunctionGetPropertiesResource() { + } + + /** + * 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() { + if (id() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property id in model SqlUserDefinedFunctionGetPropertiesResource")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlUserDefinedFunctionGetPropertiesResource.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", id()); + jsonWriter.writeStringField("body", body()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlUserDefinedFunctionGetPropertiesResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlUserDefinedFunctionGetPropertiesResource if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlUserDefinedFunctionGetPropertiesResource. + */ + public static SqlUserDefinedFunctionGetPropertiesResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlUserDefinedFunctionGetPropertiesResource deserializedSqlUserDefinedFunctionGetPropertiesResource + = new SqlUserDefinedFunctionGetPropertiesResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSqlUserDefinedFunctionGetPropertiesResource.withId(reader.getString()); + } else if ("body".equals(fieldName)) { + deserializedSqlUserDefinedFunctionGetPropertiesResource.withBody(reader.getString()); + } else if ("_rid".equals(fieldName)) { + deserializedSqlUserDefinedFunctionGetPropertiesResource.rid = reader.getString(); + } else if ("_ts".equals(fieldName)) { + deserializedSqlUserDefinedFunctionGetPropertiesResource.ts + = reader.getNullable(JsonReader::getFloat); + } else if ("_etag".equals(fieldName)) { + deserializedSqlUserDefinedFunctionGetPropertiesResource.etag = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlUserDefinedFunctionGetPropertiesResource; + }); + } +} 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..5aca42bbe3612 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlUserDefinedFunctionGetResults.java @@ -0,0 +1,292 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 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 name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * 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.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 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.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 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..ec417b56b870c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlUserDefinedFunctionListResult.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.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlUserDefinedFunctionGetResultsInner; +import java.io.IOException; +import java.util.List; + +/** + * The List operation response, that contains the userDefinedFunctions and their properties. + */ +@Immutable +public final class SqlUserDefinedFunctionListResult implements JsonSerializable { + /* + * List of userDefinedFunctions and their properties. + */ + private List value; + + /** + * Creates an instance of SqlUserDefinedFunctionListResult class. + */ + public SqlUserDefinedFunctionListResult() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlUserDefinedFunctionListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlUserDefinedFunctionListResult if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlUserDefinedFunctionListResult. + */ + public static SqlUserDefinedFunctionListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlUserDefinedFunctionListResult deserializedSqlUserDefinedFunctionListResult + = new SqlUserDefinedFunctionListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> SqlUserDefinedFunctionGetResultsInner.fromJson(reader1)); + deserializedSqlUserDefinedFunctionListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedSqlUserDefinedFunctionListResult; + }); + } +} 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..c587e3f5fad13 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlUserDefinedFunctionResource.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.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Cosmos DB SQL userDefinedFunction resource object. + */ +@Fluent +public class SqlUserDefinedFunctionResource implements JsonSerializable { + /* + * Name of the Cosmos DB SQL userDefinedFunction + */ + private String id; + + /* + * Body of the User Defined Function + */ + private String body; + + /** + * Creates an instance of SqlUserDefinedFunctionResource class. + */ + public SqlUserDefinedFunctionResource() { + } + + /** + * 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.atError() + .log(new IllegalArgumentException( + "Missing required property id in model SqlUserDefinedFunctionResource")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlUserDefinedFunctionResource.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("body", this.body); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlUserDefinedFunctionResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlUserDefinedFunctionResource if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlUserDefinedFunctionResource. + */ + public static SqlUserDefinedFunctionResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlUserDefinedFunctionResource deserializedSqlUserDefinedFunctionResource + = new SqlUserDefinedFunctionResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSqlUserDefinedFunctionResource.id = reader.getString(); + } else if ("body".equals(fieldName)) { + deserializedSqlUserDefinedFunctionResource.body = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlUserDefinedFunctionResource; + }); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Status.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Status.java new file mode 100644 index 0000000000000..591111d173428 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Status.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.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Enum to indicate current buildout status of the region. + */ +public final class Status extends ExpandableStringEnum { + /** + * Static value Uninitialized for Status. + */ + public static final Status UNINITIALIZED = fromString("Uninitialized"); + + /** + * Static value Initializing for Status. + */ + public static final Status INITIALIZING = fromString("Initializing"); + + /** + * Static value InternallyReady for Status. + */ + public static final Status INTERNALLY_READY = fromString("InternallyReady"); + + /** + * Static value Online for Status. + */ + public static final Status ONLINE = fromString("Online"); + + /** + * Static value Deleting for Status. + */ + public static final Status DELETING = fromString("Deleting"); + + /** + * Creates a new instance of Status value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Status() { + } + + /** + * Creates or finds a Status from its string representation. + * + * @param name a name to look for. + * @return the corresponding Status. + */ + public static Status fromString(String name) { + return fromString(name, Status.class); + } + + /** + * Gets known Status values. + * + * @return known Status values. + */ + public static Collection values() { + return values(Status.class); + } +} 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..965e2c0eaecca --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableCreateUpdateParameters.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.TableCreateUpdateProperties; +import java.io.IOException; +import java.util.Map; + +/** + * Parameters to create and update Cosmos DB Table. + */ +@Fluent +public final class TableCreateUpdateParameters extends ArmResourceProperties { + /* + * Properties to create and update Azure Cosmos DB Table. + */ + private TableCreateUpdateProperties innerProperties = new TableCreateUpdateProperties(); + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of TableCreateUpdateParameters class. + */ + public TableCreateUpdateParameters() { + } + + /** + * Get the innerProperties property: Properties to create and update Azure Cosmos DB Table. + * + * @return the innerProperties value. + */ + private TableCreateUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@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() { + if (innerProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property innerProperties in model TableCreateUpdateParameters")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(TableCreateUpdateParameters.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TableCreateUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TableCreateUpdateParameters if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TableCreateUpdateParameters. + */ + public static TableCreateUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TableCreateUpdateParameters deserializedTableCreateUpdateParameters = new TableCreateUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedTableCreateUpdateParameters.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedTableCreateUpdateParameters.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedTableCreateUpdateParameters.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedTableCreateUpdateParameters.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedTableCreateUpdateParameters.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedTableCreateUpdateParameters.innerProperties + = TableCreateUpdateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedTableCreateUpdateParameters; + }); + } +} 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..feffa6144a529 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableGetPropertiesOptions.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The TableGetPropertiesOptions model. + */ +@Fluent +public final class TableGetPropertiesOptions extends OptionsResource { + /** + * Creates an instance of TableGetPropertiesOptions class. + */ + public TableGetPropertiesOptions() { + } + + /** + * {@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() { + if (autoscaleSettings() != null) { + autoscaleSettings().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("throughput", throughput()); + jsonWriter.writeJsonField("autoscaleSettings", autoscaleSettings()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TableGetPropertiesOptions from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TableGetPropertiesOptions if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the TableGetPropertiesOptions. + */ + public static TableGetPropertiesOptions fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TableGetPropertiesOptions deserializedTableGetPropertiesOptions = new TableGetPropertiesOptions(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("throughput".equals(fieldName)) { + deserializedTableGetPropertiesOptions.withThroughput(reader.getNullable(JsonReader::getInt)); + } else if ("autoscaleSettings".equals(fieldName)) { + deserializedTableGetPropertiesOptions.withAutoscaleSettings(AutoscaleSettings.fromJson(reader)); + } else { + reader.skipChildren(); + } + } + + return deserializedTableGetPropertiesOptions; + }); + } +} 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..5893989f9d0ff --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableGetPropertiesResource.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The TableGetPropertiesResource model. + */ +@Fluent +public final class TableGetPropertiesResource extends TableResource { + /* + * A system generated property. A unique identifier. + */ + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of the resource. + */ + private Float ts; + + /* + * A system generated property representing the resource etag required for optimistic concurrency control. + */ + private String etag; + + /** + * Creates an instance of TableGetPropertiesResource class. + */ + public TableGetPropertiesResource() { + } + + /** + * 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; + } + + /** + * {@inheritDoc} + */ + @Override + public TableGetPropertiesResource withRestoreParameters(ResourceRestoreParameters restoreParameters) { + super.withRestoreParameters(restoreParameters); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public TableGetPropertiesResource withCreateMode(CreateMode createMode) { + super.withCreateMode(createMode); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (id() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property id in model TableGetPropertiesResource")); + } + if (restoreParameters() != null) { + restoreParameters().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(TableGetPropertiesResource.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", id()); + jsonWriter.writeJsonField("restoreParameters", restoreParameters()); + jsonWriter.writeStringField("createMode", createMode() == null ? null : createMode().toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TableGetPropertiesResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TableGetPropertiesResource if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TableGetPropertiesResource. + */ + public static TableGetPropertiesResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TableGetPropertiesResource deserializedTableGetPropertiesResource = new TableGetPropertiesResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedTableGetPropertiesResource.withId(reader.getString()); + } else if ("restoreParameters".equals(fieldName)) { + deserializedTableGetPropertiesResource + .withRestoreParameters(ResourceRestoreParameters.fromJson(reader)); + } else if ("createMode".equals(fieldName)) { + deserializedTableGetPropertiesResource.withCreateMode(CreateMode.fromString(reader.getString())); + } else if ("_rid".equals(fieldName)) { + deserializedTableGetPropertiesResource.rid = reader.getString(); + } else if ("_ts".equals(fieldName)) { + deserializedTableGetPropertiesResource.ts = reader.getNullable(JsonReader::getFloat); + } else if ("_etag".equals(fieldName)) { + deserializedTableGetPropertiesResource.etag = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTableGetPropertiesResource; + }); + } +} 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..c30422850a199 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableGetResults.java @@ -0,0 +1,318 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 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 name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * 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.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 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.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 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); + + /** + * Retrieves continuous backup information for a table. + * + * @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 table. + * + * @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/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..a9d2a67fe4a43 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableListResult.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.TableGetResultsInner; +import java.io.IOException; +import java.util.List; + +/** + * The List operation response, that contains the Table and their properties. + */ +@Immutable +public final class TableListResult implements JsonSerializable { + /* + * List of Table and their properties. + */ + private List value; + + /** + * Creates an instance of TableListResult class. + */ + public TableListResult() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TableListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TableListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the TableListResult. + */ + public static TableListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TableListResult deserializedTableListResult = new TableListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> TableGetResultsInner.fromJson(reader1)); + deserializedTableListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedTableListResult; + }); + } +} 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..4fc7b74140b49 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableResource.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Cosmos DB table resource object. + */ +@Fluent +public class TableResource implements JsonSerializable { + /* + * Name of the Cosmos DB table + */ + private String id; + + /* + * Parameters to indicate the information about the restore + */ + private ResourceRestoreParameters restoreParameters; + + /* + * Enum to indicate the mode of resource creation. + */ + private CreateMode createMode; + + /** + * Creates an instance of TableResource class. + */ + public TableResource() { + } + + /** + * 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; + } + + /** + * Get the restoreParameters property: Parameters to indicate the information about the restore. + * + * @return the restoreParameters value. + */ + public ResourceRestoreParameters 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 TableResource object itself. + */ + public TableResource withRestoreParameters(ResourceRestoreParameters restoreParameters) { + this.restoreParameters = restoreParameters; + return this; + } + + /** + * Get the createMode property: Enum to indicate the mode of resource creation. + * + * @return the createMode value. + */ + public CreateMode createMode() { + return this.createMode; + } + + /** + * Set the createMode property: Enum to indicate the mode of resource creation. + * + * @param createMode the createMode value to set. + * @return the TableResource object itself. + */ + public TableResource withCreateMode(CreateMode createMode) { + this.createMode = createMode; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property id in model TableResource")); + } + if (restoreParameters() != null) { + restoreParameters().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(TableResource.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeJsonField("restoreParameters", this.restoreParameters); + jsonWriter.writeStringField("createMode", this.createMode == null ? null : this.createMode.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TableResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TableResource if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TableResource. + */ + public static TableResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TableResource deserializedTableResource = new TableResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedTableResource.id = reader.getString(); + } else if ("restoreParameters".equals(fieldName)) { + deserializedTableResource.restoreParameters = ResourceRestoreParameters.fromJson(reader); + } else if ("createMode".equals(fieldName)) { + deserializedTableResource.createMode = CreateMode.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedTableResource; + }); + } +} 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..f9daead1f7a99 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableResources.java @@ -0,0 +1,299 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 as paginated response with + * {@link PagedIterable}. + */ + 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 as paginated response with + * {@link PagedIterable}. + */ + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 along with + * {@link Response}. + */ + Response getTableWithResponse(String resourceGroupName, String accountName, String tableName, + 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); + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 + * along with {@link Response}. + */ + Response getTableThroughputWithResponse(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); + + /** + * 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); + + /** + * Retrieves continuous backup information for a 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 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 tableName, ContinuousBackupRestoreLocation location); + + /** + * Retrieves continuous backup information for a 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 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 tableName, ContinuousBackupRestoreLocation location, 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 along with + * {@link Response}. + */ + 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 along with + * {@link Response}. + */ + 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..1cf3eef62f3e6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ThroughputPolicyResource.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Cosmos DB resource throughput policy. + */ +@Fluent +public final class ThroughputPolicyResource implements JsonSerializable { + /* + * Determines whether the ThroughputPolicy is active or not + */ + private Boolean isEnabled; + + /* + * Represents the percentage by which throughput can increase every time throughput policy kicks in. + */ + private Integer incrementPercent; + + /** + * Creates an instance of ThroughputPolicyResource class. + */ + public ThroughputPolicyResource() { + } + + /** + * 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("isEnabled", this.isEnabled); + jsonWriter.writeNumberField("incrementPercent", this.incrementPercent); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ThroughputPolicyResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ThroughputPolicyResource if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ThroughputPolicyResource. + */ + public static ThroughputPolicyResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ThroughputPolicyResource deserializedThroughputPolicyResource = new ThroughputPolicyResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("isEnabled".equals(fieldName)) { + deserializedThroughputPolicyResource.isEnabled = reader.getNullable(JsonReader::getBoolean); + } else if ("incrementPercent".equals(fieldName)) { + deserializedThroughputPolicyResource.incrementPercent = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedThroughputPolicyResource; + }); + } +} 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..4fd9bcdb1882d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ThroughputSettingsGetPropertiesResource.java @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ThroughputSettingsGetPropertiesResource model. + */ +@Fluent +public final class ThroughputSettingsGetPropertiesResource extends ThroughputSettingsResource { + /* + * A system generated property. A unique identifier. + */ + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of the resource. + */ + private Float ts; + + /* + * A system generated property representing the resource etag required for optimistic concurrency control. + */ + private String etag; + + /* + * The maximum throughput value or the maximum maxThroughput value (for autoscale) that can be specified + */ + private String softAllowedMaximumThroughput; + + /* + * The offer throughput value to instantly scale up without triggering splits + */ + private String instantMaximumThroughput; + + /* + * The throughput replace is pending + */ + private String offerReplacePending; + + /* + * The minimum throughput of the resource + */ + private String minimumThroughput; + + /** + * Creates an instance of ThroughputSettingsGetPropertiesResource class. + */ + public ThroughputSettingsGetPropertiesResource() { + } + + /** + * 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; + } + + /** + * Get the softAllowedMaximumThroughput property: The maximum throughput value or the maximum maxThroughput value + * (for autoscale) that can be specified. + * + * @return the softAllowedMaximumThroughput value. + */ + @Override + public String softAllowedMaximumThroughput() { + return this.softAllowedMaximumThroughput; + } + + /** + * Get the instantMaximumThroughput property: The offer throughput value to instantly scale up without triggering + * splits. + * + * @return the instantMaximumThroughput value. + */ + @Override + public String instantMaximumThroughput() { + return this.instantMaximumThroughput; + } + + /** + * Get the offerReplacePending property: The throughput replace is pending. + * + * @return the offerReplacePending value. + */ + @Override + public String offerReplacePending() { + return this.offerReplacePending; + } + + /** + * Get the minimumThroughput property: The minimum throughput of the resource. + * + * @return the minimumThroughput value. + */ + @Override + public String minimumThroughput() { + return this.minimumThroughput; + } + + /** + * {@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() { + if (autoscaleSettings() != null) { + autoscaleSettings().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("throughput", throughput()); + jsonWriter.writeJsonField("autoscaleSettings", autoscaleSettings()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ThroughputSettingsGetPropertiesResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ThroughputSettingsGetPropertiesResource if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ThroughputSettingsGetPropertiesResource. + */ + public static ThroughputSettingsGetPropertiesResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ThroughputSettingsGetPropertiesResource deserializedThroughputSettingsGetPropertiesResource + = new ThroughputSettingsGetPropertiesResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("throughput".equals(fieldName)) { + deserializedThroughputSettingsGetPropertiesResource + .withThroughput(reader.getNullable(JsonReader::getInt)); + } else if ("autoscaleSettings".equals(fieldName)) { + deserializedThroughputSettingsGetPropertiesResource + .withAutoscaleSettings(AutoscaleSettingsResource.fromJson(reader)); + } else if ("minimumThroughput".equals(fieldName)) { + deserializedThroughputSettingsGetPropertiesResource.minimumThroughput = reader.getString(); + } else if ("offerReplacePending".equals(fieldName)) { + deserializedThroughputSettingsGetPropertiesResource.offerReplacePending = reader.getString(); + } else if ("instantMaximumThroughput".equals(fieldName)) { + deserializedThroughputSettingsGetPropertiesResource.instantMaximumThroughput = reader.getString(); + } else if ("softAllowedMaximumThroughput".equals(fieldName)) { + deserializedThroughputSettingsGetPropertiesResource.softAllowedMaximumThroughput + = reader.getString(); + } else if ("_rid".equals(fieldName)) { + deserializedThroughputSettingsGetPropertiesResource.rid = reader.getString(); + } else if ("_ts".equals(fieldName)) { + deserializedThroughputSettingsGetPropertiesResource.ts = reader.getNullable(JsonReader::getFloat); + } else if ("_etag".equals(fieldName)) { + deserializedThroughputSettingsGetPropertiesResource.etag = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedThroughputSettingsGetPropertiesResource; + }); + } +} 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..6ed3a95f1431d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ThroughputSettingsGetResults.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.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 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..14a369fcd1cf5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ThroughputSettingsResource.java @@ -0,0 +1,243 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Cosmos DB resource throughput object. Either throughput is required or autoscaleSettings is required, but not both. + */ +@Fluent +public class ThroughputSettingsResource implements JsonSerializable { + /* + * Value of the Cosmos DB resource throughput. Either throughput is required or autoscaleSettings is required, but + * not both. + */ + private Integer throughput; + + /* + * Cosmos DB resource for autoscale settings. Either throughput is required or autoscaleSettings is required, but + * not both. + */ + private AutoscaleSettingsResource autoscaleSettings; + + /* + * The minimum throughput of the resource + */ + private String minimumThroughput; + + /* + * The throughput replace is pending + */ + private String offerReplacePending; + + /* + * The offer throughput value to instantly scale up without triggering splits + */ + private String instantMaximumThroughput; + + /* + * The maximum throughput value or the maximum maxThroughput value (for autoscale) that can be specified + */ + private String softAllowedMaximumThroughput; + + /** + * Creates an instance of ThroughputSettingsResource class. + */ + public ThroughputSettingsResource() { + } + + /** + * 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; + } + + /** + * Set the minimumThroughput property: The minimum throughput of the resource. + * + * @param minimumThroughput the minimumThroughput value to set. + * @return the ThroughputSettingsResource object itself. + */ + ThroughputSettingsResource withMinimumThroughput(String minimumThroughput) { + this.minimumThroughput = minimumThroughput; + return this; + } + + /** + * Get the offerReplacePending property: The throughput replace is pending. + * + * @return the offerReplacePending value. + */ + public String offerReplacePending() { + return this.offerReplacePending; + } + + /** + * Set the offerReplacePending property: The throughput replace is pending. + * + * @param offerReplacePending the offerReplacePending value to set. + * @return the ThroughputSettingsResource object itself. + */ + ThroughputSettingsResource withOfferReplacePending(String offerReplacePending) { + this.offerReplacePending = offerReplacePending; + return this; + } + + /** + * Get the instantMaximumThroughput property: The offer throughput value to instantly scale up without triggering + * splits. + * + * @return the instantMaximumThroughput value. + */ + public String instantMaximumThroughput() { + return this.instantMaximumThroughput; + } + + /** + * Set the instantMaximumThroughput property: The offer throughput value to instantly scale up without triggering + * splits. + * + * @param instantMaximumThroughput the instantMaximumThroughput value to set. + * @return the ThroughputSettingsResource object itself. + */ + ThroughputSettingsResource withInstantMaximumThroughput(String instantMaximumThroughput) { + this.instantMaximumThroughput = instantMaximumThroughput; + return this; + } + + /** + * Get the softAllowedMaximumThroughput property: The maximum throughput value or the maximum maxThroughput value + * (for autoscale) that can be specified. + * + * @return the softAllowedMaximumThroughput value. + */ + public String softAllowedMaximumThroughput() { + return this.softAllowedMaximumThroughput; + } + + /** + * Set the softAllowedMaximumThroughput property: The maximum throughput value or the maximum maxThroughput value + * (for autoscale) that can be specified. + * + * @param softAllowedMaximumThroughput the softAllowedMaximumThroughput value to set. + * @return the ThroughputSettingsResource object itself. + */ + ThroughputSettingsResource withSoftAllowedMaximumThroughput(String softAllowedMaximumThroughput) { + this.softAllowedMaximumThroughput = softAllowedMaximumThroughput; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (autoscaleSettings() != null) { + autoscaleSettings().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("throughput", this.throughput); + jsonWriter.writeJsonField("autoscaleSettings", this.autoscaleSettings); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ThroughputSettingsResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ThroughputSettingsResource if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ThroughputSettingsResource. + */ + public static ThroughputSettingsResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ThroughputSettingsResource deserializedThroughputSettingsResource = new ThroughputSettingsResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("throughput".equals(fieldName)) { + deserializedThroughputSettingsResource.throughput = reader.getNullable(JsonReader::getInt); + } else if ("autoscaleSettings".equals(fieldName)) { + deserializedThroughputSettingsResource.autoscaleSettings + = AutoscaleSettingsResource.fromJson(reader); + } else if ("minimumThroughput".equals(fieldName)) { + deserializedThroughputSettingsResource.minimumThroughput = reader.getString(); + } else if ("offerReplacePending".equals(fieldName)) { + deserializedThroughputSettingsResource.offerReplacePending = reader.getString(); + } else if ("instantMaximumThroughput".equals(fieldName)) { + deserializedThroughputSettingsResource.instantMaximumThroughput = reader.getString(); + } else if ("softAllowedMaximumThroughput".equals(fieldName)) { + deserializedThroughputSettingsResource.softAllowedMaximumThroughput = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedThroughputSettingsResource; + }); + } +} 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..b7f8d4aa13a98 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ThroughputSettingsUpdateParameters.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ThroughputSettingsUpdateProperties; +import java.io.IOException; +import java.util.Map; + +/** + * Parameters to update Cosmos DB resource throughput. + */ +@Fluent +public final class ThroughputSettingsUpdateParameters extends ArmResourceProperties { + /* + * Properties to update Azure Cosmos DB resource throughput. + */ + private ThroughputSettingsUpdateProperties innerProperties = new ThroughputSettingsUpdateProperties(); + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ThroughputSettingsUpdateParameters class. + */ + public ThroughputSettingsUpdateParameters() { + } + + /** + * Get the innerProperties property: Properties to update Azure Cosmos DB resource throughput. + * + * @return the innerProperties value. + */ + private ThroughputSettingsUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@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() { + if (innerProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property innerProperties in model ThroughputSettingsUpdateParameters")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ThroughputSettingsUpdateParameters.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ThroughputSettingsUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ThroughputSettingsUpdateParameters if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ThroughputSettingsUpdateParameters. + */ + public static ThroughputSettingsUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ThroughputSettingsUpdateParameters deserializedThroughputSettingsUpdateParameters + = new ThroughputSettingsUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedThroughputSettingsUpdateParameters.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedThroughputSettingsUpdateParameters.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedThroughputSettingsUpdateParameters.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedThroughputSettingsUpdateParameters.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedThroughputSettingsUpdateParameters.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedThroughputSettingsUpdateParameters.innerProperties + = ThroughputSettingsUpdateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedThroughputSettingsUpdateParameters; + }); + } +} 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..a034e632d1547 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TriggerOperation.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.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The operation the trigger is associated with. + */ +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 a new instance of TriggerOperation value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public TriggerOperation() { + } + + /** + * Creates or finds a TriggerOperation from its string representation. + * + * @param name a name to look for. + * @return the corresponding TriggerOperation. + */ + public static TriggerOperation fromString(String name) { + return fromString(name, TriggerOperation.class); + } + + /** + * Gets known TriggerOperation values. + * + * @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..e677a97ebbab4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TriggerType.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.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Type of the Trigger. + */ +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 a new instance of TriggerType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public TriggerType() { + } + + /** + * Creates or finds a TriggerType from its string representation. + * + * @param name a name to look for. + * @return the corresponding TriggerType. + */ + public static TriggerType fromString(String name) { + return fromString(name, TriggerType.class); + } + + /** + * Gets known TriggerType values. + * + * @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/Type.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Type.java new file mode 100644 index 0000000000000..b93d4b053cfbb --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Type.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.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Type of the connection string. + */ +public final class Type extends ExpandableStringEnum { + /** + * Static value Sql for Type. + */ + public static final Type SQL = fromString("Sql"); + + /** + * Static value Table for Type. + */ + public static final Type TABLE = fromString("Table"); + + /** + * Static value MongoDB for Type. + */ + public static final Type MONGO_DB = fromString("MongoDB"); + + /** + * Static value Cassandra for Type. + */ + public static final Type CASSANDRA = fromString("Cassandra"); + + /** + * Static value CassandraConnectorMetadata for Type. + */ + public static final Type CASSANDRA_CONNECTOR_METADATA = fromString("CassandraConnectorMetadata"); + + /** + * Static value Gremlin for Type. + */ + public static final Type GREMLIN = fromString("Gremlin"); + + /** + * Static value SqlDedicatedGateway for Type. + */ + public static final Type SQL_DEDICATED_GATEWAY = fromString("SqlDedicatedGateway"); + + /** + * Static value GremlinV2 for Type. + */ + public static final Type GREMLIN_V2 = fromString("GremlinV2"); + + /** + * Static value Undefined for Type. + */ + public static final Type UNDEFINED = fromString("Undefined"); + + /** + * Creates a new instance of Type value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Type() { + } + + /** + * Creates or finds a Type from its string representation. + * + * @param name a name to look for. + * @return the corresponding Type. + */ + public static Type fromString(String name) { + return fromString(name, Type.class); + } + + /** + * Gets known Type values. + * + * @return known Type values. + */ + public static Collection values() { + return values(Type.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..f6aecba629ab7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/UniqueKey.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +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 implements JsonSerializable { + /* + * List of paths must be unique for each document in the Azure Cosmos DB service + */ + private List paths; + + /** + * Creates an instance of UniqueKey class. + */ + public UniqueKey() { + } + + /** + * 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("paths", this.paths, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UniqueKey from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UniqueKey if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the UniqueKey. + */ + public static UniqueKey fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UniqueKey deserializedUniqueKey = new UniqueKey(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("paths".equals(fieldName)) { + List paths = reader.readArray(reader1 -> reader1.getString()); + deserializedUniqueKey.paths = paths; + } else { + reader.skipChildren(); + } + } + + return deserializedUniqueKey; + }); + } +} 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..a6c1faa5f0c30 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/UniqueKeyPolicy.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +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 implements JsonSerializable { + /* + * List of unique keys on that enforces uniqueness constraint on documents in the collection in the Azure Cosmos DB + * service. + */ + private List uniqueKeys; + + /** + * Creates an instance of UniqueKeyPolicy class. + */ + public UniqueKeyPolicy() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("uniqueKeys", this.uniqueKeys, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UniqueKeyPolicy from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UniqueKeyPolicy if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the UniqueKeyPolicy. + */ + public static UniqueKeyPolicy fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UniqueKeyPolicy deserializedUniqueKeyPolicy = new UniqueKeyPolicy(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("uniqueKeys".equals(fieldName)) { + List uniqueKeys = reader.readArray(reader1 -> UniqueKey.fromJson(reader1)); + deserializedUniqueKeyPolicy.uniqueKeys = uniqueKeys; + } else { + reader.skipChildren(); + } + } + + return deserializedUniqueKeyPolicy; + }); + } +} 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..9c9987aade92f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/UnitType.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.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The unit of the metric. + */ +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 a new instance of UnitType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public UnitType() { + } + + /** + * Creates or finds a UnitType from its string representation. + * + * @param name a name to look for. + * @return the corresponding UnitType. + */ + public static UnitType fromString(String name) { + return fromString(name, UnitType.class); + } + + /** + * Gets known UnitType values. + * + * @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..70ebb8a502773 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Usage.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.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..8d50248d78c44 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/UsagesResult.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.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.cosmos.generated.fluent.models.UsageInner; +import java.io.IOException; +import java.util.List; + +/** + * The response to a list usage request. + */ +@Immutable +public final class UsagesResult implements JsonSerializable { + /* + * The list of usages for the database. A usage is a point in time metric + */ + private List value; + + /** + * Creates an instance of UsagesResult class. + */ + public UsagesResult() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UsagesResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UsagesResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the UsagesResult. + */ + public static UsagesResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UsagesResult deserializedUsagesResult = new UsagesResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> UsageInner.fromJson(reader1)); + deserializedUsagesResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedUsagesResult; + }); + } +} 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..2f29c5a621da0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/VirtualNetworkRule.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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Virtual Network ACL Rule object. + */ +@Fluent +public final class VirtualNetworkRule implements JsonSerializable { + /* + * Resource ID of a subnet, for example: + * /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{ + * virtualNetworkName}/subnets/{subnetName}. + */ + private String id; + + /* + * Create firewall rule before the virtual network has vnet service endpoint enabled. + */ + private Boolean ignoreMissingVNetServiceEndpoint; + + /** + * Creates an instance of VirtualNetworkRule class. + */ + public VirtualNetworkRule() { + } + + /** + * 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeBooleanField("ignoreMissingVNetServiceEndpoint", this.ignoreMissingVNetServiceEndpoint); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualNetworkRule from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualNetworkRule if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the VirtualNetworkRule. + */ + public static VirtualNetworkRule fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualNetworkRule deserializedVirtualNetworkRule = new VirtualNetworkRule(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedVirtualNetworkRule.id = reader.getString(); + } else if ("ignoreMissingVNetServiceEndpoint".equals(fieldName)) { + deserializedVirtualNetworkRule.ignoreMissingVNetServiceEndpoint + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualNetworkRule; + }); + } +} 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..a32f6500a9ff7 --- /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..e92d77ece0b72 --- /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..5956f1e0ffffd --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/module-info.java @@ -0,0 +1,15 @@ +// 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; + opens com.azure.resourcemanager.cosmos.generated.models to com.azure.core; +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-cosmos-generated/proxy-config.json b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-cosmos-generated/proxy-config.json new file mode 100644 index 0000000000000..37de1c6df0e2e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-cosmos-generated/proxy-config.json @@ -0,0 +1 @@ +[["com.azure.resourcemanager.cosmos.generated.implementation.CassandraClustersClientImpl$CassandraClustersService"],["com.azure.resourcemanager.cosmos.generated.implementation.CassandraDataCentersClientImpl$CassandraDataCentersService"],["com.azure.resourcemanager.cosmos.generated.implementation.CassandraResourcesClientImpl$CassandraResourcesService"],["com.azure.resourcemanager.cosmos.generated.implementation.CollectionPartitionRegionsClientImpl$CollectionPartitionRegionsService"],["com.azure.resourcemanager.cosmos.generated.implementation.CollectionPartitionsClientImpl$CollectionPartitionsService"],["com.azure.resourcemanager.cosmos.generated.implementation.CollectionRegionsClientImpl$CollectionRegionsService"],["com.azure.resourcemanager.cosmos.generated.implementation.CollectionsClientImpl$CollectionsService"],["com.azure.resourcemanager.cosmos.generated.implementation.DatabaseAccountRegionsClientImpl$DatabaseAccountRegionsService"],["com.azure.resourcemanager.cosmos.generated.implementation.DatabaseAccountsClientImpl$DatabaseAccountsService"],["com.azure.resourcemanager.cosmos.generated.implementation.DatabasesClientImpl$DatabasesService"],["com.azure.resourcemanager.cosmos.generated.implementation.GremlinResourcesClientImpl$GremlinResourcesService"],["com.azure.resourcemanager.cosmos.generated.implementation.LocationsClientImpl$LocationsService"],["com.azure.resourcemanager.cosmos.generated.implementation.MongoDBResourcesClientImpl$MongoDBResourcesService"],["com.azure.resourcemanager.cosmos.generated.implementation.NotebookWorkspacesClientImpl$NotebookWorkspacesService"],["com.azure.resourcemanager.cosmos.generated.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.cosmos.generated.implementation.PartitionKeyRangeIdRegionsClientImpl$PartitionKeyRangeIdRegionsService"],["com.azure.resourcemanager.cosmos.generated.implementation.PartitionKeyRangeIdsClientImpl$PartitionKeyRangeIdsService"],["com.azure.resourcemanager.cosmos.generated.implementation.PercentileSourceTargetsClientImpl$PercentileSourceTargetsService"],["com.azure.resourcemanager.cosmos.generated.implementation.PercentileTargetsClientImpl$PercentileTargetsService"],["com.azure.resourcemanager.cosmos.generated.implementation.PercentilesClientImpl$PercentilesService"],["com.azure.resourcemanager.cosmos.generated.implementation.PrivateEndpointConnectionsClientImpl$PrivateEndpointConnectionsService"],["com.azure.resourcemanager.cosmos.generated.implementation.PrivateLinkResourcesClientImpl$PrivateLinkResourcesService"],["com.azure.resourcemanager.cosmos.generated.implementation.RestorableDatabaseAccountsClientImpl$RestorableDatabaseAccountsService"],["com.azure.resourcemanager.cosmos.generated.implementation.RestorableGremlinDatabasesClientImpl$RestorableGremlinDatabasesService"],["com.azure.resourcemanager.cosmos.generated.implementation.RestorableGremlinGraphsClientImpl$RestorableGremlinGraphsService"],["com.azure.resourcemanager.cosmos.generated.implementation.RestorableGremlinResourcesClientImpl$RestorableGremlinResourcesService"],["com.azure.resourcemanager.cosmos.generated.implementation.RestorableMongodbCollectionsClientImpl$RestorableMongodbCollectionsService"],["com.azure.resourcemanager.cosmos.generated.implementation.RestorableMongodbDatabasesClientImpl$RestorableMongodbDatabasesService"],["com.azure.resourcemanager.cosmos.generated.implementation.RestorableMongodbResourcesClientImpl$RestorableMongodbResourcesService"],["com.azure.resourcemanager.cosmos.generated.implementation.RestorableSqlContainersClientImpl$RestorableSqlContainersService"],["com.azure.resourcemanager.cosmos.generated.implementation.RestorableSqlDatabasesClientImpl$RestorableSqlDatabasesService"],["com.azure.resourcemanager.cosmos.generated.implementation.RestorableSqlResourcesClientImpl$RestorableSqlResourcesService"],["com.azure.resourcemanager.cosmos.generated.implementation.RestorableTableResourcesClientImpl$RestorableTableResourcesService"],["com.azure.resourcemanager.cosmos.generated.implementation.RestorableTablesClientImpl$RestorableTablesService"],["com.azure.resourcemanager.cosmos.generated.implementation.ServicesClientImpl$ServicesService"],["com.azure.resourcemanager.cosmos.generated.implementation.SqlResourcesClientImpl$SqlResourcesService"],["com.azure.resourcemanager.cosmos.generated.implementation.TableResourcesClientImpl$TableResourcesService"]] \ No newline at end of file diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-cosmos-generated/reflect-config.json b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-cosmos-generated/reflect-config.json new file mode 100644 index 0000000000000..0637a088a01e8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-cosmos-generated/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file 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..a61df4df29918 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersCreateUpdateSamples.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.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/stable/2024-11-15/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("fakeTokenPlaceholder") + .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"))) + .withHoursBetweenBackups(24)) + .create(); + } + + // Use "Map.of" if available + @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/CassandraClustersDeallocateSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersDeallocateSamples.java new file mode 100644 index 0000000000000..bbead861bcde2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersDeallocateSamples.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; + +/** + * Samples for CassandraClusters Deallocate. + */ +public final class CassandraClustersDeallocateSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBManagedCassandraClusterDeallocate.json + */ + /** + * Sample code: CosmosDBManagedCassandraClusterDeallocate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + cosmosDBManagedCassandraClusterDeallocate(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.cassandraClusters().deallocate("cassandra-prod-rg", "cassandra-prod", com.azure.core.util.Context.NONE); + } +} 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..27b0c7020662c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersDeleteSamples.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; + +/** + * Samples for CassandraClusters Delete. + */ +public final class CassandraClustersDeleteSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..e7139d87fb0f6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersGetByResourceGroupSamples.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; + +/** + * Samples for CassandraClusters GetByResourceGroup. + */ +public final class CassandraClustersGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersInvokeCommandSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersInvokeCommandSamples.java new file mode 100644 index 0000000000000..30e1b8b44283e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersInvokeCommandSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) 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.CommandPostBody; + +/** + * Samples for CassandraClusters InvokeCommand. + */ +public final class CassandraClustersInvokeCommandSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBManagedCassandraCommand.json + */ + /** + * Sample code: CosmosDBManagedCassandraCommand. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + cosmosDBManagedCassandraCommand(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.cassandraClusters() + .invokeCommand("cassandra-prod-rg", "cassandra-prod", + new CommandPostBody().withCommand("nodetool status").withHost("10.0.1.12"), + com.azure.core.util.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..d6ad1493ffc25 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersListByResourceGroupSamples.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; + +/** + * Samples for CassandraClusters ListByResourceGroup. + */ +public final class CassandraClustersListByResourceGroupSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..a0293b870bced --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersListSamples.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; + +/** + * Samples for CassandraClusters List. + */ +public final class CassandraClustersListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersStartSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersStartSamples.java new file mode 100644 index 0000000000000..eecdb764f59d0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersStartSamples.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; + +/** + * Samples for CassandraClusters Start. + */ +public final class CassandraClustersStartSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBManagedCassandraClusterStart.json + */ + /** + * Sample code: CosmosDBManagedCassandraClusterStart. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + cosmosDBManagedCassandraClusterStart(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.cassandraClusters().start("cassandra-prod-rg", "cassandra-prod", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersStatusSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersStatusSamples.java new file mode 100644 index 0000000000000..939af747ac73b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersStatusSamples.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; + +/** + * Samples for CassandraClusters Status. + */ +public final class CassandraClustersStatusSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBManagedCassandraStatus.json + */ + /** + * Sample code: CosmosDBManagedCassandraStatus. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + cosmosDBManagedCassandraStatus(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.cassandraClusters() + .statusWithResponse("cassandra-prod-rg", "cassandra-prod", com.azure.core.util.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..adfeefcead40e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersUpdateSamples.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.generated; + +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/stable/2024-11-15/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", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("owner", "mike")) + .withProperties(new ClusterResourceProperties().withAuthenticationMethod(AuthenticationMethod.NONE) + .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"))) + .withHoursBetweenBackups(12)) + .apply(); + } + + // Use "Map.of" if available + @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..be69193ef9572 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraDataCentersCreateUpdateSamples.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.resourcemanager.cosmos.generated.models.DataCenterResourceProperties; + +/** + * Samples for CassandraDataCenters CreateUpdate. + */ +public final class CassandraDataCentersCreateUpdateSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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("fakeTokenPlaceholder")) + .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..ede633c338de7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraDataCentersDeleteSamples.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; + +/** + * Samples for CassandraDataCenters Delete. + */ +public final class CassandraDataCentersDeleteSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..39691aaee25aa --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraDataCentersGetSamples.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; + +/** + * Samples for CassandraDataCenters Get. + */ +public final class CassandraDataCentersGetSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..997c9113ccbd8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraDataCentersListSamples.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; + +/** + * Samples for CassandraDataCenters List. + */ +public final class CassandraDataCentersListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..fb480b9191a66 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraDataCentersUpdateSamples.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.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/stable/2024-11-15/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", com.azure.core.util.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("fakeTokenPlaceholder")) + .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..079044953acce --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesCreateUpdateCassandraKeyspaceSamples.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.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/stable/2024-11-15/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(); + } + + // Use "Map.of" if available + @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..c9bb67359cbeb --- /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/stable/2024-11-15/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"))))) + .withTags(mapOf()) + .withOptions(new CreateUpdateOptions()) + .create(); + } + + // Use "Map.of" if available + @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..70e44aac3e640 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesDeleteCassandraKeyspaceSamples.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; + +/** + * Samples for CassandraResources DeleteCassandraKeyspace. + */ +public final class CassandraResourcesDeleteCassandraKeyspaceSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..7d660b0985a60 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesDeleteCassandraTableSamples.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; + +/** + * Samples for CassandraResources DeleteCassandraTable. + */ +public final class CassandraResourcesDeleteCassandraTableSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..c8279497fc377 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesGetCassandraKeyspaceSamples.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; + +/** + * Samples for CassandraResources GetCassandraKeyspace. + */ +public final class CassandraResourcesGetCassandraKeyspaceSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..eccf75bea85b2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesGetCassandraKeyspaceThroughputSamples.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; + +/** + * Samples for CassandraResources GetCassandraKeyspaceThroughput. + */ +public final class CassandraResourcesGetCassandraKeyspaceThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.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..dd3bf7ac1adab --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesGetCassandraTableSamples.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; + +/** + * Samples for CassandraResources GetCassandraTable. + */ +public final class CassandraResourcesGetCassandraTableSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.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..a7052413a334b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesGetCassandraTableThroughputSamples.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; + +/** + * Samples for CassandraResources GetCassandraTableThroughput. + */ +public final class CassandraResourcesGetCassandraTableThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.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..883f6b856489d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesListCassandraKeyspacesSamples.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; + +/** + * Samples for CassandraResources ListCassandraKeyspaces. + */ +public final class CassandraResourcesListCassandraKeyspacesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..d3ae5398586b7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesListCassandraTablesSamples.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; + +/** + * Samples for CassandraResources ListCassandraTables. + */ +public final class CassandraResourcesListCassandraTablesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..94019aa260c1f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesMigrateCassandraKeyspaceToAutoscaleSamples.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; + +/** + * Samples for CassandraResources MigrateCassandraKeyspaceToAutoscale. + */ +public final class CassandraResourcesMigrateCassandraKeyspaceToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..81ba7651d764e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesMigrateCassandraKeyspaceToManualThroughputSamples.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; + +/** + * Samples for CassandraResources MigrateCassandraKeyspaceToManualThroughput. + */ +public final class CassandraResourcesMigrateCassandraKeyspaceToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.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..88c16fa89b510 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesMigrateCassandraTableToAutoscaleSamples.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; + +/** + * Samples for CassandraResources MigrateCassandraTableToAutoscale. + */ +public final class CassandraResourcesMigrateCassandraTableToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.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..d932aaa7f4584 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesMigrateCassandraTableToManualThroughputSamples.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; + +/** + * Samples for CassandraResources MigrateCassandraTableToManualThroughput. + */ +public final class CassandraResourcesMigrateCassandraTableToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.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..0d8bec555ceb3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesUpdateCassandraKeyspaceThroughputSamples.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.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/stable/2024-11-15/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)), + com.azure.core.util.Context.NONE); + } + + // Use "Map.of" if available + @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..c5c065a61cedb --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesUpdateCassandraTableThroughputSamples.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.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/stable/2024-11-15/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)), + com.azure.core.util.Context.NONE); + } + + // Use "Map.of" if available + @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..f981db5faa2de --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CollectionListMetricDefinitionsSamples.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; + +/** + * Samples for Collection ListMetricDefinitions. + */ +public final class CollectionListMetricDefinitionsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..03ca7dc5ba2b2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CollectionListMetricsSamples.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; + +/** + * Samples for Collection ListMetrics. + */ +public final class CollectionListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.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..2529f21bf6cb5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CollectionListUsagesSamples.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; + +/** + * Samples for Collection ListUsages. + */ +public final class CollectionListUsagesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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'", + com.azure.core.util.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..8aedc9e7f121f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CollectionPartitionListMetricsSamples.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; + +/** + * Samples for CollectionPartition ListMetrics. + */ +public final class CollectionPartitionListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.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..b50ead060b428 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CollectionPartitionListUsagesSamples.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; + +/** + * Samples for CollectionPartition ListUsages. + */ +public final class CollectionPartitionListUsagesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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'", + com.azure.core.util.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..2eb0ba03b5b43 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CollectionPartitionRegionListMetricsSamples.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; + +/** + * Samples for CollectionPartitionRegion ListMetrics. + */ +public final class CollectionPartitionRegionListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.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..c6d072d637a0e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CollectionRegionListMetricsSamples.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; + +/** + * Samples for CollectionRegion ListMetrics. + */ +public final class CollectionRegionListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.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..c5b7ffea14f89 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountRegionListMetricsSamples.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; + +/** + * Samples for DatabaseAccountRegion ListMetrics. + */ +public final class DatabaseAccountRegionListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.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..b92f2f86aae99 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsCheckNameExistsSamples.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; + +/** + * Samples for DatabaseAccounts CheckNameExists. + */ +public final class DatabaseAccountsCheckNameExistsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..63a4781b179bc --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsCreateOrUpdateSamples.java @@ -0,0 +1,178 @@ +// Copyright (c) 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.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.Capacity; +import com.azure.resourcemanager.cosmos.generated.models.ConsistencyPolicy; +import com.azure.resourcemanager.cosmos.generated.models.ContinuousModeBackupPolicy; +import com.azure.resourcemanager.cosmos.generated.models.ContinuousModeProperties; +import com.azure.resourcemanager.cosmos.generated.models.ContinuousTier; +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.DatabaseRestoreResource; +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.MinimalTlsVersion; +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/stable/2024-11-15/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))) + .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) + .withCreateMode(CreateMode.RESTORE) + .withBackupPolicy(new ContinuousModeBackupPolicy() + .withContinuousModeProperties(new ContinuousModeProperties().withTier(ContinuousTier.CONTINUOUS30DAYS))) + .withRestoreParameters(new RestoreParameters().withRestoreSource( + "/subscriptions/subid/providers/Microsoft.DocumentDB/locations/westus/restorableDatabaseAccounts/1a97b4bb-f6a0-430e-ade1-638d781830cc") + .withRestoreTimestampInUtc(OffsetDateTime.parse("2021-03-11T22:05:09Z")) + .withRestoreWithTtlDisabled(false) + .withRestoreMode(RestoreMode.POINT_IN_TIME) + .withDatabasesToRestore(Arrays.asList( + new DatabaseRestoreResource().withDatabaseName("db1") + .withCollectionNames(Arrays.asList("collection1", "collection2")), + new DatabaseRestoreResource().withDatabaseName("db2") + .withCollectionNames(Arrays.asList("collection3", "collection4"))))) + .withMinimalTlsVersion(MinimalTlsVersion.TLS) + .create(); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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))) + .withTags(mapOf()) + .withKind(DatabaseAccountKind.MONGO_DB) + .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))) + .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)) + .withCreateMode(CreateMode.DEFAULT) + .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")) + .withCapacity(new Capacity().withTotalThroughputLimit(2000)) + .withMinimalTlsVersion(MinimalTlsVersion.TLS12) + .withEnableBurstCapacity(true) + .withEnablePerRegionPerPartitionAutoscale(true) + .create(); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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(); + } + + // Use "Map.of" if available + @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..00fd45c3616a8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsDeleteSamples.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; + +/** + * Samples for DatabaseAccounts Delete. + */ +public final class DatabaseAccountsDeleteSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..f85b9bab036ca --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsFailoverPriorityChangeSamples.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.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/stable/2024-11-15/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))), + com.azure.core.util.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..4665706236611 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsGetByResourceGroupSamples.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; + +/** + * Samples for DatabaseAccounts GetByResourceGroup. + */ +public final class DatabaseAccountsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..9481dc3ae67ee --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsGetReadOnlyKeysSamples.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; + +/** + * Samples for DatabaseAccounts GetReadOnlyKeys. + */ +public final class DatabaseAccountsGetReadOnlyKeysSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..de733638a8053 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsListByResourceGroupSamples.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; + +/** + * Samples for DatabaseAccounts ListByResourceGroup. + */ +public final class DatabaseAccountsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..d7830db34c226 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsListConnectionStringsSamples.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.generated; + +/** + * Samples for DatabaseAccounts ListConnectionStrings. + */ +public final class DatabaseAccountsListConnectionStringsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..b372f7bd70a29 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsListKeysSamples.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; + +/** + * Samples for DatabaseAccounts ListKeys. + */ +public final class DatabaseAccountsListKeysSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..6c16ef950388c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsListMetricDefinitionsSamples.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; + +/** + * Samples for DatabaseAccounts ListMetricDefinitions. + */ +public final class DatabaseAccountsListMetricDefinitionsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..81ace3cd846d1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsListMetricsSamples.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; + +/** + * Samples for DatabaseAccounts ListMetrics. + */ +public final class DatabaseAccountsListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.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..4c363e29b143a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsListReadOnlyKeysSamples.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; + +/** + * Samples for DatabaseAccounts ListReadOnlyKeys. + */ +public final class DatabaseAccountsListReadOnlyKeysSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..be3c6e18cee8e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsListSamples.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; + +/** + * Samples for DatabaseAccounts List. + */ +public final class DatabaseAccountsListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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(com.azure.core.util.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..961fd6aef3f2f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsListUsagesSamples.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; + +/** + * Samples for DatabaseAccounts ListUsages. + */ +public final class DatabaseAccountsListUsagesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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'", com.azure.core.util.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..7292b041f6915 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsOfflineRegionSamples.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.resourcemanager.cosmos.generated.models.RegionForOnlineOffline; + +/** + * Samples for DatabaseAccounts OfflineRegion. + */ +public final class DatabaseAccountsOfflineRegionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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().withRegion("North Europe"), + com.azure.core.util.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..c0b3550e17e3f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsOnlineRegionSamples.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.resourcemanager.cosmos.generated.models.RegionForOnlineOffline; + +/** + * Samples for DatabaseAccounts OnlineRegion. + */ +public final class DatabaseAccountsOnlineRegionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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().withRegion("North Europe"), + com.azure.core.util.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..2782a1aeb0fd9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsRegenerateKeySamples.java @@ -0,0 +1,29 @@ +// Copyright (c) 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.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/stable/2024-11-15/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), + com.azure.core.util.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..760a45eb75d45 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsUpdateSamples.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.generated; + +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.Capacity; +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.IpAddressOrRange; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentity; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentityUserAssignedIdentities; +import com.azure.resourcemanager.cosmos.generated.models.MinimalTlsVersion; +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/stable/2024-11-15/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", com.azure.core.util.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.LOCAL))) + .withNetworkAclBypass(NetworkAclBypass.AZURE_SERVICES) + .withNetworkAclBypassResourceIds(Arrays.asList( + "/subscriptions/subId/resourcegroups/rgName/providers/Microsoft.Synapse/workspaces/workspaceName")) + .withCapacity(new Capacity().withTotalThroughputLimit(2000)) + .withEnablePartitionMerge(true) + .withMinimalTlsVersion(MinimalTlsVersion.TLS) + .withEnableBurstCapacity(true) + .withEnablePerRegionPerPartitionAutoscale(true) + .apply(); + } + + // Use "Map.of" if available + @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..0d8476796f39a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseListMetricDefinitionsSamples.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; + +/** + * Samples for Database ListMetricDefinitions. + */ +public final class DatabaseListMetricDefinitionsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..121c258272481 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseListMetricsSamples.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; + +/** + * Samples for Database ListMetrics. + */ +public final class DatabaseListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.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..9ef4b6e7c7b06 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseListUsagesSamples.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; + +/** + * Samples for Database ListUsages. + */ +public final class DatabaseListUsagesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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'", + com.azure.core.util.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..9fc39aca83b07 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesCreateUpdateGremlinDatabaseSamples.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.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/stable/2024-11-15/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(); + } + + // Use "Map.of" if available + @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..ac0f1965b347d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesCreateUpdateGremlinGraphSamples.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.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/stable/2024-11-15/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(); + } + + // Use "Map.of" if available + @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..ceba27e6af95d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesDeleteGremlinDatabaseSamples.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; + +/** + * Samples for GremlinResources DeleteGremlinDatabase. + */ +public final class GremlinResourcesDeleteGremlinDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..6e178be4aec97 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesDeleteGremlinGraphSamples.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; + +/** + * Samples for GremlinResources DeleteGremlinGraph. + */ +public final class GremlinResourcesDeleteGremlinGraphSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..e20735b5e3116 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesGetGremlinDatabaseSamples.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; + +/** + * Samples for GremlinResources GetGremlinDatabase. + */ +public final class GremlinResourcesGetGremlinDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..8881d4515ac06 --- /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; + +/** + * Samples for GremlinResources GetGremlinDatabaseThroughput. + */ +public final class GremlinResourcesGetGremlinDatabaseThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..1ccf2dc4d4409 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesGetGremlinGraphSamples.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; + +/** + * Samples for GremlinResources GetGremlinGraph. + */ +public final class GremlinResourcesGetGremlinGraphSamples { + /* + * x-ms-original-file: + * specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.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..448a00b8e7b10 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesGetGremlinGraphThroughputSamples.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; + +/** + * Samples for GremlinResources GetGremlinGraphThroughput. + */ +public final class GremlinResourcesGetGremlinGraphThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.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..b2feb86ecd597 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesListGremlinDatabasesSamples.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; + +/** + * Samples for GremlinResources ListGremlinDatabases. + */ +public final class GremlinResourcesListGremlinDatabasesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..5ca6b585d71b3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesListGremlinGraphsSamples.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; + +/** + * Samples for GremlinResources ListGremlinGraphs. + */ +public final class GremlinResourcesListGremlinGraphsSamples { + /* + * x-ms-original-file: + * specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..9db75a9ed9ae4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesMigrateGremlinDatabaseToAutoscaleSamples.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; + +/** + * Samples for GremlinResources MigrateGremlinDatabaseToAutoscale. + */ +public final class GremlinResourcesMigrateGremlinDatabaseToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..b1c741b808103 --- /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; + +/** + * Samples for GremlinResources MigrateGremlinDatabaseToManualThroughput. + */ +public final class GremlinResourcesMigrateGremlinDatabaseToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..96e1c39460c79 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesMigrateGremlinGraphToAutoscaleSamples.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; + +/** + * Samples for GremlinResources MigrateGremlinGraphToAutoscale. + */ +public final class GremlinResourcesMigrateGremlinGraphToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.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..24d15ce3e4c41 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesMigrateGremlinGraphToManualThroughputSamples.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; + +/** + * Samples for GremlinResources MigrateGremlinGraphToManualThroughput. + */ +public final class GremlinResourcesMigrateGremlinGraphToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesRetrieveContinuousBackupInformationSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesRetrieveContinuousBackupInformationSamples.java new file mode 100644 index 0000000000000..330b6e2927003 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesRetrieveContinuousBackupInformationSamples.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.resourcemanager.cosmos.generated.models.ContinuousBackupRestoreLocation; + +/** + * Samples for GremlinResources RetrieveContinuousBackupInformation. + */ +public final class GremlinResourcesRetrieveContinuousBackupInformationSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBGremlinGraphBackupInformation.json + */ + /** + * Sample code: CosmosDBGremlinGraphBackupInformation. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + cosmosDBGremlinGraphBackupInformation(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.gremlinResources() + .retrieveContinuousBackupInformation("rgName", "ddb1", "databaseName", "graphName", + new ContinuousBackupRestoreLocation().withLocation("North Europe"), com.azure.core.util.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..f7c3d69677fb5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesUpdateGremlinDatabaseThroughputSamples.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.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/stable/2024-11-15/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)), + com.azure.core.util.Context.NONE); + } + + // Use "Map.of" if available + @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..8e089868f7700 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesUpdateGremlinGraphThroughputSamples.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.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/stable/2024-11-15/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)), + com.azure.core.util.Context.NONE); + } + + // Use "Map.of" if available + @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/LocationsGetSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/LocationsGetSamples.java new file mode 100644 index 0000000000000..34648b51a3b84 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/LocationsGetSamples.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; + +/** + * Samples for Locations Get. + */ +public final class LocationsGetSamples { + /* + * x-ms-original-file: + * specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBLocationGet.json + */ + /** + * Sample code: CosmosDBLocationGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBLocationGet(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.locations().getWithResponse("westus", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/LocationsListSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/LocationsListSamples.java new file mode 100644 index 0000000000000..e4b0c147fb0f1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/LocationsListSamples.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; + +/** + * Samples for Locations List. + */ +public final class LocationsListSamples { + /* + * x-ms-original-file: + * specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBLocationList. + * json + */ + /** + * Sample code: CosmosDBLocationList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBLocationList(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.locations().list(com.azure.core.util.Context.NONE); + } +} 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..c05da0f0a6e72 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesCreateUpdateMongoDBCollectionSamples.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.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/stable/2024-11-15/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", "fakeTokenPlaceholder")) + .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")))))) + .withTags(mapOf()) + .withOptions(new CreateUpdateOptions()) + .create(); + } + + // Use "Map.of" if available + @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..13d788d0c0fea --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesCreateUpdateMongoDBDatabaseSamples.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.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/stable/2024-11-15/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(); + } + + // Use "Map.of" if available + @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/MongoDBResourcesCreateUpdateMongoRoleDefinitionSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesCreateUpdateMongoRoleDefinitionSamples.java new file mode 100644 index 0000000000000..d9c5b6d759bc5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesCreateUpdateMongoRoleDefinitionSamples.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.Privilege; +import com.azure.resourcemanager.cosmos.generated.models.PrivilegeResource; +import com.azure.resourcemanager.cosmos.generated.models.Role; +import java.util.Arrays; + +/** + * Samples for MongoDBResources CreateUpdateMongoRoleDefinition. + */ +public final class MongoDBResourcesCreateUpdateMongoRoleDefinitionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBMongoDBRoleDefinitionCreateUpdate.json + */ + /** + * Sample code: CosmosDBMongoDBRoleDefinitionCreateUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + cosmosDBMongoDBRoleDefinitionCreateUpdate(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.mongoDBResources() + .defineUpdateMongoRoleDefinition("myMongoRoleDefinitionId") + .withExistingDatabaseAccount("myResourceGroupName", "myAccountName") + .withRoleName("myRoleName") + .withDatabaseName("sales") + .withPrivileges(Arrays + .asList(new Privilege().withResource(new PrivilegeResource().withDb("sales").withCollection("sales")) + .withActions(Arrays.asList("insert", "find")))) + .withRoles(Arrays.asList(new Role().withDb("sales").withRole("myInheritedRole"))) + .create(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesCreateUpdateMongoUserDefinitionSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesCreateUpdateMongoUserDefinitionSamples.java new file mode 100644 index 0000000000000..ee39bc85d1b64 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesCreateUpdateMongoUserDefinitionSamples.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.resourcemanager.cosmos.generated.models.Role; +import java.util.Arrays; + +/** + * Samples for MongoDBResources CreateUpdateMongoUserDefinition. + */ +public final class MongoDBResourcesCreateUpdateMongoUserDefinitionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBMongoDBUserDefinitionCreateUpdate.json + */ + /** + * Sample code: CosmosDBMongoDBUserDefinitionCreateUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + cosmosDBMongoDBUserDefinitionCreateUpdate(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.mongoDBResources() + .defineUpdateMongoUserDefinition("myMongoUserDefinitionId") + .withExistingDatabaseAccount("myResourceGroupName", "myAccountName") + .withUsername("myUserName") + .withPassword("myPassword") + .withDatabaseName("sales") + .withCustomData("My custom data") + .withRoles(Arrays.asList(new Role().withDb("sales").withRole("myReadRole"))) + .withMechanisms("SCRAM-SHA-256") + .create(); + } +} 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..6f4f774a0d7d8 --- /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; + +/** + * Samples for MongoDBResources DeleteMongoDBCollection. + */ +public final class MongoDBResourcesDeleteMongoDBCollectionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..184b7ad25effb --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesDeleteMongoDBDatabaseSamples.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; + +/** + * Samples for MongoDBResources DeleteMongoDBDatabase. + */ +public final class MongoDBResourcesDeleteMongoDBDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesDeleteMongoRoleDefinitionSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesDeleteMongoRoleDefinitionSamples.java new file mode 100644 index 0000000000000..1d68c7af9ce18 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesDeleteMongoRoleDefinitionSamples.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; + +/** + * Samples for MongoDBResources DeleteMongoRoleDefinition. + */ +public final class MongoDBResourcesDeleteMongoRoleDefinitionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBMongoDBRoleDefinitionDelete.json + */ + /** + * Sample code: CosmosDBMongoDBRoleDefinitionDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + cosmosDBMongoDBRoleDefinitionDelete(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.mongoDBResources() + .deleteMongoRoleDefinition("myMongoRoleDefinitionId", "myResourceGroupName", "myAccountName", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesDeleteMongoUserDefinitionSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesDeleteMongoUserDefinitionSamples.java new file mode 100644 index 0000000000000..a1505dd0c317b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesDeleteMongoUserDefinitionSamples.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; + +/** + * Samples for MongoDBResources DeleteMongoUserDefinition. + */ +public final class MongoDBResourcesDeleteMongoUserDefinitionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBMongoDBUserDefinitionDelete.json + */ + /** + * Sample code: CosmosDBMongoDBUserDefinitionDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + cosmosDBMongoDBUserDefinitionDelete(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.mongoDBResources() + .deleteMongoUserDefinition("myMongoUserDefinitionId", "myResourceGroupName", "myAccountName", + com.azure.core.util.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..58cba65d2fcb7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesGetMongoDBCollectionSamples.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; + +/** + * Samples for MongoDBResources GetMongoDBCollection. + */ +public final class MongoDBResourcesGetMongoDBCollectionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.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..72032b8f1438e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesGetMongoDBCollectionThroughputSamples.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; + +/** + * Samples for MongoDBResources GetMongoDBCollectionThroughput. + */ +public final class MongoDBResourcesGetMongoDBCollectionThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.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..f6119f8fcaa0a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesGetMongoDBDatabaseSamples.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; + +/** + * Samples for MongoDBResources GetMongoDBDatabase. + */ +public final class MongoDBResourcesGetMongoDBDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..de2f665de929f --- /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; + +/** + * Samples for MongoDBResources GetMongoDBDatabaseThroughput. + */ +public final class MongoDBResourcesGetMongoDBDatabaseThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesGetMongoRoleDefinitionSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesGetMongoRoleDefinitionSamples.java new file mode 100644 index 0000000000000..5b2552b3c83fd --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesGetMongoRoleDefinitionSamples.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; + +/** + * Samples for MongoDBResources GetMongoRoleDefinition. + */ +public final class MongoDBResourcesGetMongoRoleDefinitionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBMongoDBRoleDefinitionGet.json + */ + /** + * Sample code: CosmosDBMongoRoleDefinitionGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + cosmosDBMongoRoleDefinitionGet(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.mongoDBResources() + .getMongoRoleDefinitionWithResponse("myMongoRoleDefinitionId", "myResourceGroupName", "myAccountName", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesGetMongoUserDefinitionSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesGetMongoUserDefinitionSamples.java new file mode 100644 index 0000000000000..fa2e81921655c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesGetMongoUserDefinitionSamples.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; + +/** + * Samples for MongoDBResources GetMongoUserDefinition. + */ +public final class MongoDBResourcesGetMongoUserDefinitionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBMongoDBUserDefinitionGet.json + */ + /** + * Sample code: CosmosDBMongoDBUserDefinitionGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + cosmosDBMongoDBUserDefinitionGet(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.mongoDBResources() + .getMongoUserDefinitionWithResponse("myMongoUserDefinitionId", "myResourceGroupName", "myAccountName", + com.azure.core.util.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..f8158836453aa --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesListMongoDBCollectionsSamples.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; + +/** + * Samples for MongoDBResources ListMongoDBCollections. + */ +public final class MongoDBResourcesListMongoDBCollectionsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..8801f0368a4d2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesListMongoDBDatabasesSamples.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; + +/** + * Samples for MongoDBResources ListMongoDBDatabases. + */ +public final class MongoDBResourcesListMongoDBDatabasesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesListMongoRoleDefinitionsSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesListMongoRoleDefinitionsSamples.java new file mode 100644 index 0000000000000..147fb65d1430b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesListMongoRoleDefinitionsSamples.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; + +/** + * Samples for MongoDBResources ListMongoRoleDefinitions. + */ +public final class MongoDBResourcesListMongoRoleDefinitionsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBMongoDBRoleDefinitionList.json + */ + /** + * Sample code: CosmosDBMongoDBRoleDefinitionList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + cosmosDBMongoDBRoleDefinitionList(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.mongoDBResources() + .listMongoRoleDefinitions("myResourceGroupName", "myAccountName", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesListMongoUserDefinitionsSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesListMongoUserDefinitionsSamples.java new file mode 100644 index 0000000000000..29a2d81fca15d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesListMongoUserDefinitionsSamples.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; + +/** + * Samples for MongoDBResources ListMongoUserDefinitions. + */ +public final class MongoDBResourcesListMongoUserDefinitionsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBMongoDBUserDefinitionList.json + */ + /** + * Sample code: CosmosDBMongoDBUserDefinitionList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + cosmosDBMongoDBUserDefinitionList(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.mongoDBResources() + .listMongoUserDefinitions("myResourceGroupName", "myAccountName", com.azure.core.util.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..bbd53f18a0d49 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesMigrateMongoDBCollectionToAutoscaleSamples.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; + +/** + * Samples for MongoDBResources MigrateMongoDBCollectionToAutoscale. + */ +public final class MongoDBResourcesMigrateMongoDBCollectionToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.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..a6747ea10e821 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesMigrateMongoDBCollectionToManualThroughputSamples.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; + +/** + * Samples for MongoDBResources MigrateMongoDBCollectionToManualThroughput. + */ +public final class MongoDBResourcesMigrateMongoDBCollectionToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.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..e45788f4fd705 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleSamples.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; + +/** + * Samples for MongoDBResources MigrateMongoDBDatabaseToAutoscale. + */ +public final class MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..02330611a1da6 --- /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; + +/** + * Samples for MongoDBResources MigrateMongoDBDatabaseToManualThroughput. + */ +public final class MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesRetrieveContinuousBackupInformationSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesRetrieveContinuousBackupInformationSamples.java new file mode 100644 index 0000000000000..0ec2a05b3581b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesRetrieveContinuousBackupInformationSamples.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.resourcemanager.cosmos.generated.models.ContinuousBackupRestoreLocation; + +/** + * Samples for MongoDBResources RetrieveContinuousBackupInformation. + */ +public final class MongoDBResourcesRetrieveContinuousBackupInformationSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBMongoDBCollectionBackupInformation.json + */ + /** + * Sample code: CosmosDBMongoDBCollectionBackupInformation. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + cosmosDBMongoDBCollectionBackupInformation(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.mongoDBResources() + .retrieveContinuousBackupInformation("rgName", "ddb1", "databaseName", "collectionName", + new ContinuousBackupRestoreLocation().withLocation("North Europe"), com.azure.core.util.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..b512511880137 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesUpdateMongoDBCollectionThroughputSamples.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.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/stable/2024-11-15/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)), + com.azure.core.util.Context.NONE); + } + + // Use "Map.of" if available + @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..5334c15e3d89e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesUpdateMongoDBDatabaseThroughputSamples.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.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/stable/2024-11-15/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)), + com.azure.core.util.Context.NONE); + } + + // Use "Map.of" if available + @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..ef6d67f3a8f9e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/NotebookWorkspacesCreateOrUpdateSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) 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/stable/2024-11-15/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..bf8d88c7d739c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/NotebookWorkspacesDeleteSamples.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 Delete. + */ +public final class NotebookWorkspacesDeleteSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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, com.azure.core.util.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..0897ef984bdb2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/NotebookWorkspacesGetSamples.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 Get. + */ +public final class NotebookWorkspacesGetSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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, com.azure.core.util.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..44b68e4a36a84 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/NotebookWorkspacesListByDatabaseAccountSamples.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; + +/** + * Samples for NotebookWorkspaces ListByDatabaseAccount. + */ +public final class NotebookWorkspacesListByDatabaseAccountSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..433a8056a618e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/NotebookWorkspacesListConnectionInfoSamples.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.resourcemanager.cosmos.generated.models.NotebookWorkspaceName; + +/** + * Samples for NotebookWorkspaces ListConnectionInfo. + */ +public final class NotebookWorkspacesListConnectionInfoSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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, + com.azure.core.util.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..d912b42476a5c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/NotebookWorkspacesRegenerateAuthTokenSamples.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 RegenerateAuthToken. + */ +public final class NotebookWorkspacesRegenerateAuthTokenSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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, com.azure.core.util.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..7bd01e71619e4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/NotebookWorkspacesStartSamples.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 Start. + */ +public final class NotebookWorkspacesStartSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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, com.azure.core.util.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..5468c9318da04 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/OperationsListSamples.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; + +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: + * specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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(com.azure.core.util.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..82ee0338fb85a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PartitionKeyRangeIdListMetricsSamples.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; + +/** + * Samples for PartitionKeyRangeId ListMetrics. + */ +public final class PartitionKeyRangeIdListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.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..9e0ca6b6d1211 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PartitionKeyRangeIdRegionListMetricsSamples.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; + +/** + * Samples for PartitionKeyRangeIdRegion ListMetrics. + */ +public final class PartitionKeyRangeIdRegionListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.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..cd5640cfda8f0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PercentileListMetricsSamples.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; + +/** + * Samples for Percentile ListMetrics. + */ +public final class PercentileListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.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..cc2bd81bd982a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PercentileSourceTargetListMetricsSamples.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; + +/** + * Samples for PercentileSourceTarget ListMetrics. + */ +public final class PercentileSourceTargetListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.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..2a9204977b4c5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PercentileTargetListMetricsSamples.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; + +/** + * Samples for PercentileTarget ListMetrics. + */ +public final class PercentileTargetListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.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..d7c3bde56cfc0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PrivateEndpointConnectionsCreateOrUpdateSamples.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.resourcemanager.cosmos.generated.models.PrivateLinkServiceConnectionStateProperty; + +/** + * Samples for PrivateEndpointConnections CreateOrUpdate. + */ +public final class PrivateEndpointConnectionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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..82d989b895cb3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PrivateEndpointConnectionsDeleteSamples.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; + +/** + * Samples for PrivateEndpointConnections Delete. + */ +public final class PrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..a008648470709 --- /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; + +/** + * Samples for PrivateEndpointConnections Get. + */ +public final class PrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..4367979a37af4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PrivateEndpointConnectionsListByDatabaseAccountSamples.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; + +/** + * Samples for PrivateEndpointConnections ListByDatabaseAccount. + */ +public final class PrivateEndpointConnectionsListByDatabaseAccountSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..027ffc4159b3d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PrivateLinkResourcesGetSamples.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; + +/** + * Samples for PrivateLinkResources Get. + */ +public final class PrivateLinkResourcesGetSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..c950f42a807f2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PrivateLinkResourcesListByDatabaseAccountSamples.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; + +/** + * Samples for PrivateLinkResources ListByDatabaseAccount. + */ +public final class PrivateLinkResourcesListByDatabaseAccountSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..f5658960e8587 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableDatabaseAccountsGetByLocationSamples.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; + +/** + * Samples for RestorableDatabaseAccounts GetByLocation. + */ +public final class RestorableDatabaseAccountsGetByLocationSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.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..33ea2916539c6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableDatabaseAccountsListByLocationSamples.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; + +/** + * Samples for RestorableDatabaseAccounts ListByLocation. + */ +public final class RestorableDatabaseAccountsListByLocationSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..e2b3fbb8a5edf --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableDatabaseAccountsListSamples.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; + +/** + * Samples for RestorableDatabaseAccounts List. + */ +public final class RestorableDatabaseAccountsListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableGremlinDatabasesListSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableGremlinDatabasesListSamples.java new file mode 100644 index 0000000000000..08fc0f2170f68 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableGremlinDatabasesListSamples.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; + +/** + * Samples for RestorableGremlinDatabases List. + */ +public final class RestorableGremlinDatabasesListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBRestorableGremlinDatabaseList.json + */ + /** + * Sample code: CosmosDBRestorableGremlinDatabaseList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + cosmosDBRestorableGremlinDatabaseList(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.restorableGremlinDatabases() + .list("WestUS", "d9b26648-2f53-4541-b3d8-3044f4f9810d", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableGremlinGraphsListSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableGremlinGraphsListSamples.java new file mode 100644 index 0000000000000..b714463bba75f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableGremlinGraphsListSamples.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; + +/** + * Samples for RestorableGremlinGraphs List. + */ +public final class RestorableGremlinGraphsListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBRestorableGremlinGraphList.json + */ + /** + * Sample code: CosmosDBRestorableGremlinGraphList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + cosmosDBRestorableGremlinGraphList(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.restorableGremlinGraphs() + .list("WestUS", "98a570f2-63db-4117-91f0-366327b7b353", "PD5DALigDgw=", null, null, + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableGremlinResourcesListSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableGremlinResourcesListSamples.java new file mode 100644 index 0000000000000..b39b1c426db30 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableGremlinResourcesListSamples.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; + +/** + * Samples for RestorableGremlinResources List. + */ +public final class RestorableGremlinResourcesListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBRestorableGremlinResourceList.json + */ + /** + * Sample code: CosmosDBRestorableGremlinResourceList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + cosmosDBRestorableGremlinResourceList(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.restorableGremlinResources() + .list("WestUS", "d9b26648-2f53-4541-b3d8-3044f4f9810d", "WestUS", "06/01/2022 4:56", + com.azure.core.util.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..eec0e131e33f5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableMongodbCollectionsListSamples.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; + +/** + * Samples for RestorableMongodbCollections List. + */ +public final class RestorableMongodbCollectionsListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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=", null, null, + com.azure.core.util.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..13c905de894b6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableMongodbDatabasesListSamples.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; + +/** + * Samples for RestorableMongodbDatabases List. + */ +public final class RestorableMongodbDatabasesListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..5e04429dc577a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableMongodbResourcesListSamples.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; + +/** + * Samples for RestorableMongodbResources List. + */ +public final class RestorableMongodbResourcesListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", "06/01/2022 4:56", + com.azure.core.util.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..7bd05ba0e2529 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableSqlContainersListSamples.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; + +/** + * Samples for RestorableSqlContainers List. + */ +public final class RestorableSqlContainersListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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, + com.azure.core.util.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..10caa716556e5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableSqlDatabasesListSamples.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; + +/** + * Samples for RestorableSqlDatabases List. + */ +public final class RestorableSqlDatabasesListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..04f888bb80731 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableSqlResourcesListSamples.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; + +/** + * Samples for RestorableSqlResources List. + */ +public final class RestorableSqlResourcesListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", "06/01/2022 4:56", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableTableResourcesListSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableTableResourcesListSamples.java new file mode 100644 index 0000000000000..214f6d44218d9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableTableResourcesListSamples.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; + +/** + * Samples for RestorableTableResources List. + */ +public final class RestorableTableResourcesListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBRestorableTableResourceList.json + */ + /** + * Sample code: CosmosDBRestorableTableResourceList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + cosmosDBRestorableTableResourceList(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.restorableTableResources() + .list("WestUS", "d9b26648-2f53-4541-b3d8-3044f4f9810d", "WestUS", "06/01/2022 4:56", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableTablesListSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableTablesListSamples.java new file mode 100644 index 0000000000000..e81cf1b64172c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableTablesListSamples.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; + +/** + * Samples for RestorableTables List. + */ +public final class RestorableTablesListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBRestorableTableList.json + */ + /** + * Sample code: CosmosDBRestorableTableList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBRestorableTableList(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.restorableTables() + .list("WestUS", "98a570f2-63db-4117-91f0-366327b7b353", null, null, com.azure.core.util.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..21067fa68d458 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/ServiceCreateSamples.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.generated; + +import com.azure.resourcemanager.cosmos.generated.models.DataTransferServiceResourceCreateUpdateProperties; +import com.azure.resourcemanager.cosmos.generated.models.DedicatedGatewayType; +import com.azure.resourcemanager.cosmos.generated.models.GraphApiComputeServiceResourceCreateUpdateProperties; +import com.azure.resourcemanager.cosmos.generated.models.MaterializedViewsBuilderServiceResourceCreateUpdateProperties; +import com.azure.resourcemanager.cosmos.generated.models.ServiceSize; +import com.azure.resourcemanager.cosmos.generated.models.SqlDedicatedGatewayServiceResourceCreateUpdateProperties; + +/** + * Samples for Service Create. + */ +public final class ServiceCreateSamples { + /* + * x-ms-original-file: + * specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/services/ + * sqldedicatedgateway/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") + .withProperties( + new SqlDedicatedGatewayServiceResourceCreateUpdateProperties().withInstanceSize(ServiceSize.COSMOS_D4S) + .withInstanceCount(1) + .withDedicatedGatewayType(DedicatedGatewayType.INTEGRATED_CACHE)) + .create(); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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") + .withProperties( + new DataTransferServiceResourceCreateUpdateProperties().withInstanceSize(ServiceSize.COSMOS_D4S) + .withInstanceCount(1)) + .create(); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBMaterializedViewsBuilderServiceCreate.json + */ + /** + * Sample code: MaterializedViewsBuilderServiceCreate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + materializedViewsBuilderServiceCreate(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.services() + .define("MaterializedViewsBuilder") + .withExistingDatabaseAccount("rg1", "ddb1") + .withProperties(new MaterializedViewsBuilderServiceResourceCreateUpdateProperties() + .withInstanceSize(ServiceSize.COSMOS_D4S) + .withInstanceCount(1)) + .create(); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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") + .withProperties( + new GraphApiComputeServiceResourceCreateUpdateProperties().withInstanceSize(ServiceSize.COSMOS_D4S) + .withInstanceCount(1)) + .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..0002dcc4dd2a4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/ServiceDeleteSamples.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.generated; + +/** + * Samples for Service Delete. + */ +public final class ServiceDeleteSamples { + /* + * x-ms-original-file: + * specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/services/ + * sqldedicatedgateway/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", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBMaterializedViewsBuilderServiceDelete.json + */ + /** + * Sample code: MaterializedViewsBuilderServiceDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + materializedViewsBuilderServiceDelete(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.services().delete("rg1", "ddb1", "MaterializedViewsBuilder", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..3de1c2edd2103 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/ServiceGetSamples.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.generated; + +/** + * Samples for Service Get. + */ +public final class ServiceGetSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/services/ + * sqldedicatedgateway/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", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBMaterializedViewsBuilderServiceGet.json + */ + /** + * Sample code: MaterializedViewsBuilderServiceGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + materializedViewsBuilderServiceGet(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.services().getWithResponse("rg1", "ddb1", "MaterializedViewsBuilder", com.azure.core.util.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..75c82022d2d9e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/ServiceListSamples.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; + +/** + * Samples for Service List. + */ +public final class ServiceListSamples { + /* + * x-ms-original-file: + * specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesCreateUpdateClientEncryptionKeySamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesCreateUpdateClientEncryptionKeySamples.java new file mode 100644 index 0000000000000..c921e836a520e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesCreateUpdateClientEncryptionKeySamples.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.resourcemanager.cosmos.generated.models.ClientEncryptionKeyResource; +import com.azure.resourcemanager.cosmos.generated.models.KeyWrapMetadata; + +/** + * Samples for SqlResources CreateUpdateClientEncryptionKey. + */ +public final class SqlResourcesCreateUpdateClientEncryptionKeySamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBSqlClientEncryptionKeyCreateUpdate.json + */ + /** + * Sample code: CosmosDBClientEncryptionKeyCreateUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + cosmosDBClientEncryptionKeyCreateUpdate(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.sqlResources() + .defineUpdateClientEncryptionKey("cekName") + .withExistingSqlDatabase("rgName", "accountName", "databaseName") + .withResource(new ClientEncryptionKeyResource().withId("cekName") + .withEncryptionAlgorithm("AEAD_AES_256_CBC_HMAC_SHA256") + .withWrappedDataEncryptionKey("U3dhZ2dlciByb2Nrcw==".getBytes()) + .withKeyWrapMetadata(new KeyWrapMetadata().withName("customerManagedKey") + .withType("AzureKeyVault") + .withValue("AzureKeyVault Key URL") + .withAlgorithm("RSA-OAEP"))) + .create(); + } +} 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..396a3ad91c636 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesCreateUpdateSqlContainerSamples.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.generated; + +import com.azure.resourcemanager.cosmos.generated.models.ClientEncryptionIncludedPath; +import com.azure.resourcemanager.cosmos.generated.models.ClientEncryptionPolicy; +import com.azure.resourcemanager.cosmos.generated.models.ComputedProperty; +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/stable/2024-11-15/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")) + .withClientEncryptionPolicy(new ClientEncryptionPolicy() + .withIncludedPaths(Arrays.asList(new ClientEncryptionIncludedPath().withPath("/path") + .withClientEncryptionKeyId("fakeTokenPlaceholder") + .withEncryptionType("Deterministic") + .withEncryptionAlgorithm("AEAD_AES_256_CBC_HMAC_SHA256"))) + .withPolicyFormatVersion(2)) + .withComputedProperties(Arrays.asList( + new ComputedProperty().withName("cp_lowerName").withQuery("SELECT VALUE LOWER(c.name) FROM c")))) + .withTags(mapOf()) + .withOptions(new CreateUpdateOptions()) + .create(); + } + + // Use "Map.of" if available + @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..825ad188c9c00 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesCreateUpdateSqlDatabaseSamples.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.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/stable/2024-11-15/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(); + } + + // Use "Map.of" if available + @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..a824a27a3aaba --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesCreateUpdateSqlRoleAssignmentSamples.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; + +/** + * Samples for SqlResources CreateUpdateSqlRoleAssignment. + */ +public final class SqlResourcesCreateUpdateSqlRoleAssignmentSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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..ed3b920f11873 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesCreateUpdateSqlRoleDefinitionSamples.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.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/stable/2024-11-15/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..5fbe218a19ba7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesCreateUpdateSqlStoredProcedureSamples.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.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/stable/2024-11-15/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..6df3ebc8c8dd0 --- /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/stable/2024-11-15/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..05e9b9d31ac44 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesCreateUpdateSqlUserDefinedFunctionSamples.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.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/stable/2024-11-15/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..ced598aa8ec27 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesDeleteSqlContainerSamples.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; + +/** + * Samples for SqlResources DeleteSqlContainer. + */ +public final class SqlResourcesDeleteSqlContainerSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..7bac0de5cdd3e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesDeleteSqlDatabaseSamples.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; + +/** + * Samples for SqlResources DeleteSqlDatabase. + */ +public final class SqlResourcesDeleteSqlDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..1e6f1111b76e4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesDeleteSqlRoleAssignmentSamples.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; + +/** + * Samples for SqlResources DeleteSqlRoleAssignment. + */ +public final class SqlResourcesDeleteSqlRoleAssignmentSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.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..e95b032605f3b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesDeleteSqlRoleDefinitionSamples.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; + +/** + * Samples for SqlResources DeleteSqlRoleDefinition. + */ +public final class SqlResourcesDeleteSqlRoleDefinitionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.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..733a114222343 --- /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; + +/** + * Samples for SqlResources DeleteSqlStoredProcedure. + */ +public final class SqlResourcesDeleteSqlStoredProcedureSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.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..393ee57f3e7bf --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesDeleteSqlTriggerSamples.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; + +/** + * Samples for SqlResources DeleteSqlTrigger. + */ +public final class SqlResourcesDeleteSqlTriggerSamples { + /* + * x-ms-original-file: + * specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.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..9fc7e6c0d1094 --- /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; + +/** + * Samples for SqlResources DeleteSqlUserDefinedFunction. + */ +public final class SqlResourcesDeleteSqlUserDefinedFunctionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesGetClientEncryptionKeySamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesGetClientEncryptionKeySamples.java new file mode 100644 index 0000000000000..ac99aede4b222 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesGetClientEncryptionKeySamples.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; + +/** + * Samples for SqlResources GetClientEncryptionKey. + */ +public final class SqlResourcesGetClientEncryptionKeySamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBSqlClientEncryptionKeyGet.json + */ + /** + * Sample code: CosmosDBClientEncryptionKeyGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + cosmosDBClientEncryptionKeyGet(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.sqlResources() + .getClientEncryptionKeyWithResponse("rgName", "accountName", "databaseName", "cekName", + com.azure.core.util.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..2a018cefb1c42 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesGetSqlContainerSamples.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; + +/** + * Samples for SqlResources GetSqlContainer. + */ +public final class SqlResourcesGetSqlContainerSamples { + /* + * x-ms-original-file: + * specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.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..3dc6a5e0718fc --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesGetSqlContainerThroughputSamples.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; + +/** + * Samples for SqlResources GetSqlContainerThroughput. + */ +public final class SqlResourcesGetSqlContainerThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.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..2bcfde7502773 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesGetSqlDatabaseSamples.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; + +/** + * Samples for SqlResources GetSqlDatabase. + */ +public final class SqlResourcesGetSqlDatabaseSamples { + /* + * x-ms-original-file: + * specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..510e94d5a6a56 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesGetSqlDatabaseThroughputSamples.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; + +/** + * Samples for SqlResources GetSqlDatabaseThroughput. + */ +public final class SqlResourcesGetSqlDatabaseThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..c2d4b5b164c36 --- /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; + +/** + * Samples for SqlResources GetSqlRoleAssignment. + */ +public final class SqlResourcesGetSqlRoleAssignmentSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.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..754fa28326f8b --- /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; + +/** + * Samples for SqlResources GetSqlRoleDefinition. + */ +public final class SqlResourcesGetSqlRoleDefinitionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.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..2fdf92b4e15bb --- /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; + +/** + * Samples for SqlResources GetSqlStoredProcedure. + */ +public final class SqlResourcesGetSqlStoredProcedureSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.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..13957462df8ab --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesGetSqlTriggerSamples.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; + +/** + * Samples for SqlResources GetSqlTrigger. + */ +public final class SqlResourcesGetSqlTriggerSamples { + /* + * x-ms-original-file: + * specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.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..ff6fb6d5eefba --- /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; + +/** + * Samples for SqlResources GetSqlUserDefinedFunction. + */ +public final class SqlResourcesGetSqlUserDefinedFunctionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesListClientEncryptionKeysSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesListClientEncryptionKeysSamples.java new file mode 100644 index 0000000000000..7cfab0c19cf44 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesListClientEncryptionKeysSamples.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; + +/** + * Samples for SqlResources ListClientEncryptionKeys. + */ +public final class SqlResourcesListClientEncryptionKeysSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBSqlClientEncryptionKeysList.json + */ + /** + * Sample code: CosmosDBClientEncryptionKeysList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + cosmosDBClientEncryptionKeysList(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.sqlResources() + .listClientEncryptionKeys("rgName", "accountName", "databaseName", com.azure.core.util.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..bf9e6d51cf77f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesListSqlContainersSamples.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; + +/** + * Samples for SqlResources ListSqlContainers. + */ +public final class SqlResourcesListSqlContainersSamples { + /* + * x-ms-original-file: + * specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..54f7124049ba1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesListSqlDatabasesSamples.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; + +/** + * Samples for SqlResources ListSqlDatabases. + */ +public final class SqlResourcesListSqlDatabasesSamples { + /* + * x-ms-original-file: + * specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..9eb9a75e67d47 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesListSqlRoleAssignmentsSamples.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; + +/** + * Samples for SqlResources ListSqlRoleAssignments. + */ +public final class SqlResourcesListSqlRoleAssignmentsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..8945ff7850dde --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesListSqlRoleDefinitionsSamples.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; + +/** + * Samples for SqlResources ListSqlRoleDefinitions. + */ +public final class SqlResourcesListSqlRoleDefinitionsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..a8cf487d8938e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesListSqlStoredProceduresSamples.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; + +/** + * Samples for SqlResources ListSqlStoredProcedures. + */ +public final class SqlResourcesListSqlStoredProceduresSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.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..73c21dd278e9a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesListSqlTriggersSamples.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; + +/** + * Samples for SqlResources ListSqlTriggers. + */ +public final class SqlResourcesListSqlTriggersSamples { + /* + * x-ms-original-file: + * specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..98cbb27499a21 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesListSqlUserDefinedFunctionsSamples.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; + +/** + * Samples for SqlResources ListSqlUserDefinedFunctions. + */ +public final class SqlResourcesListSqlUserDefinedFunctionsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.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..0fc1584bd07a4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesMigrateSqlContainerToAutoscaleSamples.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; + +/** + * Samples for SqlResources MigrateSqlContainerToAutoscale. + */ +public final class SqlResourcesMigrateSqlContainerToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.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..c188360830042 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesMigrateSqlContainerToManualThroughputSamples.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; + +/** + * Samples for SqlResources MigrateSqlContainerToManualThroughput. + */ +public final class SqlResourcesMigrateSqlContainerToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", + com.azure.core.util.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..8c44ccfbb17d2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesMigrateSqlDatabaseToAutoscaleSamples.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; + +/** + * Samples for SqlResources MigrateSqlDatabaseToAutoscale. + */ +public final class SqlResourcesMigrateSqlDatabaseToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..0df2db5428e6e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesMigrateSqlDatabaseToManualThroughputSamples.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; + +/** + * Samples for SqlResources MigrateSqlDatabaseToManualThroughput. + */ +public final class SqlResourcesMigrateSqlDatabaseToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..bcccdfda3061e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesRetrieveContinuousBackupInformationSamples.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.resourcemanager.cosmos.generated.models.ContinuousBackupRestoreLocation; + +/** + * Samples for SqlResources RetrieveContinuousBackupInformation. + */ +public final class SqlResourcesRetrieveContinuousBackupInformationSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBSqlContainerBackupInformation.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"), com.azure.core.util.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..fbcd32b9c77a3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesUpdateSqlContainerThroughputSamples.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.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/stable/2024-11-15/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)), + com.azure.core.util.Context.NONE); + } + + // Use "Map.of" if available + @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..150d3e1aa7831 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesUpdateSqlDatabaseThroughputSamples.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.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/stable/2024-11-15/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)), + com.azure.core.util.Context.NONE); + } + + // Use "Map.of" if available + @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..af7c2c9bc2d75 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/TableResourcesCreateUpdateTableSamples.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.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/stable/2024-11-15/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(); + } + + // Use "Map.of" if available + @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..c074fb3bc4ed5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/TableResourcesDeleteTableSamples.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; + +/** + * Samples for TableResources DeleteTable. + */ +public final class TableResourcesDeleteTableSamples { + /* + * x-ms-original-file: + * specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..70ab661bee7e2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/TableResourcesGetTableSamples.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; + +/** + * Samples for TableResources GetTable. + */ +public final class TableResourcesGetTableSamples { + /* + * x-ms-original-file: + * specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..30fac31bf3d66 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/TableResourcesGetTableThroughputSamples.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; + +/** + * Samples for TableResources GetTableThroughput. + */ +public final class TableResourcesGetTableThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..20592e5a61b63 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/TableResourcesListTablesSamples.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; + +/** + * Samples for TableResources ListTables. + */ +public final class TableResourcesListTablesSamples { + /* + * x-ms-original-file: + * specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..770ac8ab22033 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/TableResourcesMigrateTableToAutoscaleSamples.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; + +/** + * Samples for TableResources MigrateTableToAutoscale. + */ +public final class TableResourcesMigrateTableToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.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..b9d49b0aec950 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/TableResourcesMigrateTableToManualThroughputSamples.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; + +/** + * Samples for TableResources MigrateTableToManualThroughput. + */ +public final class TableResourcesMigrateTableToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/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", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/TableResourcesRetrieveContinuousBackupInformationSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/TableResourcesRetrieveContinuousBackupInformationSamples.java new file mode 100644 index 0000000000000..693e8659d3ae7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/TableResourcesRetrieveContinuousBackupInformationSamples.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.resourcemanager.cosmos.generated.models.ContinuousBackupRestoreLocation; + +/** + * Samples for TableResources RetrieveContinuousBackupInformation. + */ +public final class TableResourcesRetrieveContinuousBackupInformationSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/ + * CosmosDBTableBackupInformation.json + */ + /** + * Sample code: CosmosDBTableCollectionBackupInformation. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void + cosmosDBTableCollectionBackupInformation(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.tableResources() + .retrieveContinuousBackupInformation("rgName", "ddb1", "tableName1", + new ContinuousBackupRestoreLocation().withLocation("North Europe"), com.azure.core.util.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..8477b3ed8bfc0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/TableResourcesUpdateTableThroughputSamples.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.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/stable/2024-11-15/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)), + com.azure.core.util.Context.NONE); + } + + // Use "Map.of" if available + @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 efe169feef000..030a3800e7427 100644 --- a/sdk/cosmos/ci.yml +++ b/sdk/cosmos/ci.yml @@ -80,46 +80,51 @@ pr: - sdk/cosmos/azure-cosmos-test/pom.xml - sdk/cosmos/azure-cosmos-tests/pom.xml - sdk/cosmos/azure-cosmos-kafka-connect/pom.xml + parameters: - name: release_azurecosmos - displayName: 'azure-cosmos' + displayName: azure-cosmos type: boolean default: true - name: release_azurecosmosencryption - displayName: 'azure-cosmos-encryption' + displayName: azure-cosmos-encryption type: boolean default: true - name: release_azurecosmosspark31 - displayName: 'azure-cosmos-spark_3-1_2-12' + displayName: azure-cosmos-spark_3-1_2-12 type: boolean default: true - name: release_azurecosmosspark32 - displayName: 'azure-cosmos-spark_3-2_2-12' + displayName: azure-cosmos-spark_3-2_2-12 type: boolean default: true - name: release_azurecosmosspark33 - displayName: 'azure-cosmos-spark_3-3_2-12' + displayName: azure-cosmos-spark_3-3_2-12 type: boolean default: true - name: release_azurecosmosspark34 - displayName: 'azure-cosmos-spark_3-4_2-12' + displayName: azure-cosmos-spark_3-4_2-12 type: boolean default: true - name: release_azurecosmosspark35 - displayName: 'azure-cosmos-spark_3-5_2-12' + displayName: azure-cosmos-spark_3-5_2-12 type: boolean default: true - name: release_azurecosmostest - displayName: 'azure-cosmos-test' + displayName: azure-cosmos-test type: boolean default: true - name: release_azurecosmoskafka - displayName: 'azure-cosmos-kafka-connect' + displayName: azure-cosmos-kafka-connect type: boolean default: true + - name: release_azureresourcemanagercosmosgenerated + displayName: azure-resourcemanager-cosmos-generated + type: boolean + default: false 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 @@ -178,6 +183,10 @@ extends: skipPublishDocGithubIo: true skipPublishDocMs: true releaseInBatch: ${{ parameters.release_azurecosmoskafka }} + - name: azure-resourcemanager-cosmos-generated + groupId: com.azure.resourcemanager + safeName: azureresourcemanagercosmosgenerated + releaseInBatch: ${{ parameters.release_azureresourcemanagercosmosgenerated }} AdditionalModules: - name: azure-cosmos-tests groupId: com.azure diff --git a/sdk/cosmos/pom.xml b/sdk/cosmos/pom.xml index 88d83dfcacdb9..1cde44afc7a20 100644 --- a/sdk/cosmos/pom.xml +++ b/sdk/cosmos/pom.xml @@ -14,15 +14,16 @@ azure-cosmos-benchmark azure-cosmos-dotnet-benchmark azure-cosmos-encryption - azure-cosmos-spark_3_2-12 + azure-cosmos-kafka-connect + azure-cosmos-spark-account-data-resolver-sample azure-cosmos-spark_3-1_2-12 azure-cosmos-spark_3-2_2-12 azure-cosmos-spark_3-3_2-12 azure-cosmos-spark_3-4_2-12 azure-cosmos-spark_3-5_2-12 + azure-cosmos-spark_3_2-12 azure-cosmos-test azure-cosmos-tests - azure-cosmos-kafka-connect - azure-cosmos-spark-account-data-resolver-sample + azure-resourcemanager-cosmos-generated diff --git a/sdk/storage/azure-storage-stress/pom.xml b/sdk/storage/azure-storage-stress/pom.xml index f679d1a18ca74..c6bdc0552c313 100644 --- a/sdk/storage/azure-storage-stress/pom.xml +++ b/sdk/storage/azure-storage-stress/pom.xml @@ -47,7 +47,7 @@ com.azure azure-monitor-opentelemetry-exporter - 1.0.0-beta.30 + 1.0.0-beta.31 io.opentelemetry.instrumentation