diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index eec13445c3b19..5c6bd516ad87a 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -392,6 +392,7 @@ com.azure.resourcemanager:azure-resourcemanager-appcomplianceautomation;1.0.0-be com.azure.resourcemanager:azure-resourcemanager-servicenetworking;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-recoveryservicessiterecovery;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-billingbenefits;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-beta.1;1.0.0-beta.2 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..f9e18b5e14212 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2023-01-25) + +- 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-2022-11. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/README.md b/sdk/cosmos/azure-resourcemanager-cosmos-generated/README.md new file mode 100644 index 0000000000000..4c9983f81bde1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/README.md @@ -0,0 +1,105 @@ +# 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-2022-11. 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 + +By default, Azure Active Directory token authentication depends on correct configuration of the following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. + +With above configuration, `azure` 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://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md +[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/ 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..c916a4015ad03 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/SAMPLE.md @@ -0,0 +1,5849 @@ +# 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/2022-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(); + } + + @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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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(); + } + + @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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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(); + } + + @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/2022-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(); + } + + @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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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); + } + + @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/2022-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); + } + + @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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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.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/2022-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()) + .withRestoreParameters( + new RestoreParameters() + .withRestoreMode(RestoreMode.POINT_IN_TIME) + .withRestoreSource( + "/subscriptions/subid/providers/Microsoft.DocumentDB/locations/westus/restorableDatabaseAccounts/1a97b4bb-f6a0-430e-ade1-638d781830cc") + .withRestoreTimestampInUtc(OffsetDateTime.parse("2021-03-11T22:05:09Z")) + .withDatabasesToRestore( + Arrays + .asList( + new 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/2022-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) + .create(); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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(); + } + + @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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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(), 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/2022-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(), 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/2022-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/2022-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) + .apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### 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/2022-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(); + } + + @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/2022-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(); + } + + @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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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); + } + + @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/2022-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); + } + + @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/2022-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/2022-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/2022-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", "Hash")) + .withIndexes( + Arrays + .asList( + new MongoIndex() + .withKey(new MongoIndexKeys().withKeys(Arrays.asList("_ts"))) + .withOptions(new MongoIndexOptions().withExpireAfterSeconds(100).withUnique(true)), + new MongoIndex().withKey(new MongoIndexKeys().withKeys(Arrays.asList("_id")))))) + .withTags(mapOf()) + .withOptions(new CreateUpdateOptions()) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### MongoDBResources_CreateUpdateMongoDBDatabase + +```java +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBDatabaseResource; +import java.util.HashMap; +import java.util.Map; + +/** Samples for MongoDBResources CreateUpdateMongoDBDatabase. */ +public final class MongoDBResourcesCreateUpdateMongoDBDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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(); + } + + @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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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); + } + + @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/2022-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); + } + + @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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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.ServiceSize; +import com.azure.resourcemanager.cosmos.generated.models.ServiceType; + +/** Samples for Service Create. */ +public final class ServiceCreateSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlDedicatedGatewayServiceCreate.json + */ + /** + * Sample code: SqlDedicatedGatewayServiceCreate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void sqlDedicatedGatewayServiceCreate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .services() + .define("SqlDedicatedGateway") + .withExistingDatabaseAccount("rg1", "ddb1") + .withInstanceSize(ServiceSize.COSMOS_D4S) + .withInstanceCount(1) + .withServiceType(ServiceType.SQL_DEDICATED_GATEWAY) + .create(); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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") + .withInstanceSize(ServiceSize.COSMOS_D4S) + .withInstanceCount(1) + .withServiceType(ServiceType.DATA_TRANSFER) + .create(); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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") + .withInstanceSize(ServiceSize.COSMOS_D4S) + .withInstanceCount(1) + .withServiceType(ServiceType.MATERIALIZED_VIEWS_BUILDER) + .create(); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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") + .withInstanceSize(ServiceSize.COSMOS_D4S) + .withInstanceCount(1) + .withServiceType(ServiceType.GRAPH_APICOMPUTE) + .create(); + } +} +``` + +### Service_Delete + +```java +/** Samples for Service Delete. */ +public final class ServiceDeleteSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlDedicatedGatewayServiceDelete.json + */ + /** + * Sample code: SqlDedicatedGatewayServiceDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void sqlDedicatedGatewayServiceDelete( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.services().delete("rg1", "ddb1", "SqlDedicatedGateway", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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/2022-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/2022-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/2022-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/2022-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/2022-11-15/examples/CosmosDBSqlDedicatedGatewayServiceGet.json + */ + /** + * Sample code: SqlDedicatedGatewayServiceGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void sqlDedicatedGatewayServiceGet( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.services().getWithResponse("rg1", "ddb1", "SqlDedicatedGateway", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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/2022-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/2022-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.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/2022-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))) + .withTags(mapOf()) + .withOptions(new CreateUpdateOptions()) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### SqlResources_CreateUpdateSqlDatabase + +```java +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.SqlDatabaseResource; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SqlResources CreateUpdateSqlDatabase. */ +public final class SqlResourcesCreateUpdateSqlDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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(); + } + + @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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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); + } + + @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/2022-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); + } + + @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/2022-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(); + } + + @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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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/2022-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); + } + + @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..659cdfe2342de --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/pom.xml @@ -0,0 +1,55 @@ + + 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-2022-11. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + true + + + + com.azure + azure-core + 1.35.0 + + + com.azure + azure-core-management + 1.10.0 + + + 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..9da27a99e97d9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/CosmosDBManager.java @@ -0,0 +1,879 @@ +// Copyright (c) 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; + } + + /** + * @return Wrapped service client CosmosDBManagementClient providing direct access to the underlying auto-generated + * API implementation, based on Azure REST API. + */ + public CosmosDBManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CassandraClustersClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CassandraClustersClient.java new file mode 100644 index 0000000000000..72e86b5f016b2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CassandraClustersClient.java @@ -0,0 +1,483 @@ +// Copyright (c) Microsoft 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..2300a6b158146 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CassandraDataCentersClient.java @@ -0,0 +1,285 @@ +// Copyright (c) Microsoft 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..fd9f4f0e3aec8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CassandraResourcesClient.java @@ -0,0 +1,959 @@ +// Copyright (c) Microsoft 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..b438d1a914ae5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CollectionPartitionRegionsClient.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionMetricInner; + +/** An instance of this class provides access to all the operations defined in CollectionPartitionRegionsClient. */ +public interface CollectionPartitionRegionsClient { + /** + * Retrieves the metrics determined by the given filter for the given collection and region, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request 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..0344d440428c4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CollectionPartitionsClient.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionMetricInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionUsageInner; + +/** An instance of this class provides access to all the operations defined in CollectionPartitionsClient. */ +public interface CollectionPartitionsClient { + /** + * Retrieves the metrics determined by the given filter for the given collection, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request 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..b151376abbc35 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CollectionRegionsClient.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricInner; + +/** An instance of this class provides access to all the operations defined in CollectionRegionsClient. */ +public interface CollectionRegionsClient { + /** + * Retrieves the metrics determined by the given filter for the given database account, collection and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request 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..547eb6cae5600 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CollectionsClient.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricDefinitionInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.UsageInner; + +/** An instance of this class provides access to all the operations defined in CollectionsClient. */ +public interface CollectionsClient { + /** + * Retrieves the metrics determined by the given filter for the given database account and collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request 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..2a7338421794b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CosmosDBManagementClient.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.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..bfb41f05c5f0d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/DatabaseAccountRegionsClient.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricInner; + +/** An instance of this class provides access to all the operations defined in DatabaseAccountRegionsClient. */ +public interface DatabaseAccountRegionsClient { + /** + * Retrieves the metrics determined by the given filter for the given database account and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request 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..b43392b3f0325 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/DatabaseAccountsClient.java @@ -0,0 +1,786 @@ +// Copyright (c) Microsoft 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..c4b1e3549e78f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/DatabasesClient.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricDefinitionInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.UsageInner; + +/** An instance of this class provides access to all the operations defined in DatabasesClient. */ +public interface DatabasesClient { + /** + * Retrieves the metrics determined by the given filter for the given database account and database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request 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..98730f8b66d0e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/GremlinResourcesClient.java @@ -0,0 +1,1039 @@ +// Copyright (c) Microsoft 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..470439ece59be --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/LocationsClient.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.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..3e5542ede09a4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/MongoDBResourcesClient.java @@ -0,0 +1,1455 @@ +// Copyright (c) Microsoft 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..ad33cb812e11b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/NotebookWorkspacesClient.java @@ -0,0 +1,369 @@ +// Copyright (c) Microsoft 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..2d921867d6f5d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/OperationsClient.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.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..d1b21c9ed635d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PartitionKeyRangeIdRegionsClient.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionMetricInner; + +/** An instance of this class provides access to all the operations defined in PartitionKeyRangeIdRegionsClient. */ +public interface PartitionKeyRangeIdRegionsClient { + /** + * Retrieves the metrics determined by the given filter for the given partition key range id and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request 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..32f29eeccee62 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PartitionKeyRangeIdsClient.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionMetricInner; + +/** An instance of this class provides access to all the operations defined in PartitionKeyRangeIdsClient. */ +public interface PartitionKeyRangeIdsClient { + /** + * Retrieves the metrics determined by the given filter for the given partition key range id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request 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..1e21b1dc9c8f5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PercentileSourceTargetsClient.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PercentileMetricInner; + +/** An instance of this class provides access to all the operations defined in PercentileSourceTargetsClient. */ +public interface PercentileSourceTargetsClient { + /** + * Retrieves the metrics determined by the given filter for the given account, source and target region. This url is + * only for PBS and Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param sourceRegion Source region from which data is written. Cosmos DB region, with spaces between words and + * each word capitalized. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each + * word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request 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..1e3c31aad4fad --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PercentileTargetsClient.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PercentileMetricInner; + +/** An instance of this class provides access to all the operations defined in PercentileTargetsClient. */ +public interface PercentileTargetsClient { + /** + * Retrieves the metrics determined by the given filter for the given account target region. This url is only for + * PBS and Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each + * word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request 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..0597b959a463c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PercentilesClient.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PercentileMetricInner; + +/** An instance of this class provides access to all the operations defined in PercentilesClient. */ +public interface PercentilesClient { + /** + * Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and + * Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request 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..7c59c93729744 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PrivateEndpointConnectionsClient.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PrivateEndpointConnectionInner; + +/** An instance of this class provides access to all the operations defined in PrivateEndpointConnectionsClient. */ +public interface PrivateEndpointConnectionsClient { + /** + * List all private endpoint connections on a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private endpoint connections 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 A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 A private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner createOrUpdate( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters); + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters A private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner createOrUpdate( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@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..725a06c116bb1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PrivateLinkResourcesClient.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.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..8519cdfe0d9e2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableDatabaseAccountsClient.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; + +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..d4563d7ae3375 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableGremlinDatabasesClient.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.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..d3fa8c443887d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableGremlinGraphsClient.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +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..7f60434e205c8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableGremlinResourcesClient.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.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..15cd84687aa84 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableMongodbCollectionsClient.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +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..fc820c02dbb19 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableMongodbDatabasesClient.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.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..dec3f66719dd5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableMongodbResourcesClient.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.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..4ba124c27016a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableSqlContainersClient.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +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..01acf6a205996 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableSqlDatabasesClient.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.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..10d3c3ad4c837 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableSqlResourcesClient.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.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..07151bb43fc80 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableTableResourcesClient.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.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..08e08d10c3a40 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableTablesClient.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.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..6f57e6874aae7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/ServicesClient.java @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ServiceResourceInner; +import com.azure.resourcemanager.cosmos.generated.models.ServiceResourceCreateUpdateParameters; + +/** An instance of this class provides access to all the operations defined in ServicesClient. */ +public interface ServicesClient { + /** + * Gets the status of service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of service 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..c4e7182498a3c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/SqlResourcesClient.java @@ -0,0 +1,2389 @@ +// Copyright (c) Microsoft 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..29d288f16fd66 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/TableResourcesClient.java @@ -0,0 +1,533 @@ +// Copyright (c) Microsoft 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..bcf264a61a580 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/BackupInformationInner.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.cosmos.generated.models.ContinuousBackupInformation; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Backup information of a resource. */ +@Immutable +public final class BackupInformationInner { + /* + * Information about the status of continuous backups. + */ + @JsonProperty(value = "continuousBackupInformation", access = JsonProperty.Access.WRITE_ONLY) + 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(); + } + } +} 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..12783d8e497a8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraClusterPublicStatusInner.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.resourcemanager.cosmos.generated.models.CassandraClusterPublicStatusDataCentersItem; +import com.azure.resourcemanager.cosmos.generated.models.ConnectionError; +import com.azure.resourcemanager.cosmos.generated.models.ManagedCassandraReaperStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of a managed Cassandra cluster public status. */ +@Fluent +public final class CassandraClusterPublicStatusInner { + /* + * The eTag property. + */ + @JsonProperty(value = "eTag") + private String etag; + + /* + * The reaperStatus property. + */ + @JsonProperty(value = "reaperStatus") + private ManagedCassandraReaperStatus reaperStatus; + + /* + * List relevant information about any connection errors to the Datacenters. + */ + @JsonProperty(value = "connectionErrors") + private List connectionErrors; + + /* + * List of the status of each datacenter in this cluster. + */ + @JsonProperty(value = "dataCenters") + 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 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 (dataCenters() != null) { + dataCenters().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraKeyspaceCreateUpdateProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraKeyspaceCreateUpdateProperties.java new file mode 100644 index 0000000000000..284e230b7e0c3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraKeyspaceCreateUpdateProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.CassandraKeyspaceResource; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties to create and update Azure Cosmos DB Cassandra keyspace. */ +@Fluent +public final class CassandraKeyspaceCreateUpdateProperties { + /* + * The standard JSON format of a Cassandra keyspace + */ + @JsonProperty(value = "resource", required = true) + private CassandraKeyspaceResource resource; + + /* + * A key-value pair of options to be applied for the request. This corresponds to the headers sent with the + * request. + */ + @JsonProperty(value = "options") + private CreateUpdateOptions options; + + /** 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 + .logExceptionAsError( + 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); +} 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..59c4b41e24b6f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraKeyspaceGetProperties.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.CassandraKeyspaceGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.CassandraKeyspaceGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an Azure Cosmos DB Cassandra keyspace. */ +@Fluent +public final class CassandraKeyspaceGetProperties { + /* + * The resource property. + */ + @JsonProperty(value = "resource") + private CassandraKeyspaceGetPropertiesResource resource; + + /* + * The options property. + */ + @JsonProperty(value = "options") + 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(); + } + } +} 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..bd71da680b3a1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraKeyspaceGetResultsInner.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.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.CassandraKeyspaceGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.CassandraKeyspaceGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; +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 + */ + @JsonProperty(value = "properties") + private CassandraKeyspaceGetProperties innerProperties; + + /** 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; + } + + /** {@inheritDoc} */ + @Override + public CassandraKeyspaceGetResultsInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public CassandraKeyspaceGetResultsInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public CassandraKeyspaceGetPropertiesResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the CassandraKeyspaceGetResultsInner object itself. + */ + public CassandraKeyspaceGetResultsInner withResource(CassandraKeyspaceGetPropertiesResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new CassandraKeyspaceGetProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Get the options property: The options property. + * + * @return the options value. + */ + public CassandraKeyspaceGetPropertiesOptions options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: The options property. + * + * @param options the options value to set. + * @return the CassandraKeyspaceGetResultsInner object itself. + */ + public CassandraKeyspaceGetResultsInner withOptions(CassandraKeyspaceGetPropertiesOptions options) { + if (this.innerProperties() == null) { + this.innerProperties = new CassandraKeyspaceGetProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraTableCreateUpdateProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraTableCreateUpdateProperties.java new file mode 100644 index 0000000000000..f0d33d5a3f9a8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraTableCreateUpdateProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.CassandraTableResource; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties to create and update Azure Cosmos DB Cassandra table. */ +@Fluent +public final class CassandraTableCreateUpdateProperties { + /* + * The standard JSON format of a Cassandra table + */ + @JsonProperty(value = "resource", required = true) + private CassandraTableResource resource; + + /* + * A key-value pair of options to be applied for the request. This corresponds to the headers sent with the + * request. + */ + @JsonProperty(value = "options") + private CreateUpdateOptions options; + + /** 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 + .logExceptionAsError( + 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); +} 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..42b2a1c0d955f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraTableGetProperties.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.CassandraTableGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.CassandraTableGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an Azure Cosmos DB Cassandra table. */ +@Fluent +public final class CassandraTableGetProperties { + /* + * The resource property. + */ + @JsonProperty(value = "resource") + private CassandraTableGetPropertiesResource resource; + + /* + * The options property. + */ + @JsonProperty(value = "options") + 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(); + } + } +} 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..fe4a4b1f84270 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraTableGetResultsInner.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.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.CassandraTableGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.CassandraTableGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; +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 + */ + @JsonProperty(value = "properties") + private CassandraTableGetProperties innerProperties; + + /** 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; + } + + /** {@inheritDoc} */ + @Override + public CassandraTableGetResultsInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public CassandraTableGetResultsInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public CassandraTableGetPropertiesResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the CassandraTableGetResultsInner object itself. + */ + public CassandraTableGetResultsInner withResource(CassandraTableGetPropertiesResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new CassandraTableGetProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Get the options property: The options property. + * + * @return the options value. + */ + public CassandraTableGetPropertiesOptions options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: The options property. + * + * @param options the options value to set. + * @return the CassandraTableGetResultsInner object itself. + */ + public CassandraTableGetResultsInner withOptions(CassandraTableGetPropertiesOptions options) { + if (this.innerProperties() == null) { + this.innerProperties = new CassandraTableGetProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/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..e8a86c2cc7f4e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ClientEncryptionKeyCreateUpdateProperties.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ClientEncryptionKeyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties to create and update ClientEncryptionKey. */ +@Fluent +public final class ClientEncryptionKeyCreateUpdateProperties { + /* + * The standard JSON format of a ClientEncryptionKey + */ + @JsonProperty(value = "resource", required = true) + 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 + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property resource in model ClientEncryptionKeyCreateUpdateProperties")); + } else { + resource().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ClientEncryptionKeyCreateUpdateProperties.class); +} 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..4c7034da42fec --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ClientEncryptionKeyGetProperties.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.ClientEncryptionKeyGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of a ClientEncryptionKey resource. */ +@Fluent +public final class ClientEncryptionKeyGetProperties { + /* + * The resource property. + */ + @JsonProperty(value = "resource") + 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(); + } + } +} 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..054808bacb0aa --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ClientEncryptionKeyGetResultsInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.ArmProxyResource; +import com.azure.resourcemanager.cosmos.generated.models.ClientEncryptionKeyGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Client Encryption Key. */ +@Fluent +public final class ClientEncryptionKeyGetResultsInner extends ArmProxyResource { + /* + * The properties of a ClientEncryptionKey + */ + @JsonProperty(value = "properties") + private ClientEncryptionKeyGetProperties innerProperties; + + /** 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 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() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/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..469be9f2a0909 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ClusterResourceInner.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.ClusterResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.ManagedCassandraArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.ManagedCassandraManagedServiceIdentity; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Representation of a managed Cassandra cluster. */ +@Fluent +public final class ClusterResourceInner extends ManagedCassandraArmResourceProperties { + /* + * Properties of a managed Cassandra cluster. + */ + @JsonProperty(value = "properties") + private ClusterResourceProperties properties; + + /** 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; + } + + /** {@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() { + super.validate(); + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/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..9c97b78999447 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CommandOutputInner.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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Response of /command api. */ +@Fluent +public final class CommandOutputInner { + /* + * Output of the command. + */ + @JsonProperty(value = "commandOutput") + 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() { + } +} 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..3dbad039ec751 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DataCenterResourceInner.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.ArmProxyResource; +import com.azure.resourcemanager.cosmos.generated.models.DataCenterResourceProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A managed Cassandra data center. */ +@Fluent +public final class DataCenterResourceInner extends ArmProxyResource { + /* + * Properties of a managed Cassandra data center. + */ + @JsonProperty(value = "properties") + private DataCenterResourceProperties properties; + + /** 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountCreateUpdateProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountCreateUpdateProperties.java new file mode 100644 index 0000000000000..90b1382fc10ea --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountCreateUpdateProperties.java @@ -0,0 +1,891 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.AnalyticalStorageConfiguration; +import com.azure.resourcemanager.cosmos.generated.models.ApiProperties; +import com.azure.resourcemanager.cosmos.generated.models.BackupPolicy; +import com.azure.resourcemanager.cosmos.generated.models.Capability; +import com.azure.resourcemanager.cosmos.generated.models.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 com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties to create and update Azure Cosmos DB database accounts. */ +@Fluent +public final class DatabaseAccountCreateUpdateProperties { + /* + * The consistency policy for the Cosmos DB account. + */ + @JsonProperty(value = "consistencyPolicy") + private ConsistencyPolicy consistencyPolicy; + + /* + * An array that contains the georeplication locations enabled for the Cosmos DB account. + */ + @JsonProperty(value = "locations", required = true) + private List locations; + + /* + * The offer type for the database + */ + @JsonProperty(value = "databaseAccountOfferType", required = true) + private String databaseAccountOfferType = "Standard"; + + /* + * List of IpRules. + */ + @JsonProperty(value = "ipRules") + private List ipRules; + + /* + * Flag to indicate whether to enable/disable Virtual Network ACL rules. + */ + @JsonProperty(value = "isVirtualNetworkFilterEnabled") + private Boolean isVirtualNetworkFilterEnabled; + + /* + * Enables automatic failover of the write region in the rare event that the region is unavailable due to an + * outage. Automatic failover will result in a new write region for the account and is chosen based on the failover + * priorities configured for the account. + */ + @JsonProperty(value = "enableAutomaticFailover") + private Boolean enableAutomaticFailover; + + /* + * List of Cosmos DB capabilities for the account + */ + @JsonProperty(value = "capabilities") + private List capabilities; + + /* + * List of Virtual Network ACL rules configured for the Cosmos DB account. + */ + @JsonProperty(value = "virtualNetworkRules") + private List virtualNetworkRules; + + /* + * Enables the account to write in multiple locations + */ + @JsonProperty(value = "enableMultipleWriteLocations") + private Boolean enableMultipleWriteLocations; + + /* + * Enables the cassandra connector on the Cosmos DB C* account + */ + @JsonProperty(value = "enableCassandraConnector") + private Boolean enableCassandraConnector; + + /* + * The cassandra connector offer type for the Cosmos DB database C* account. + */ + @JsonProperty(value = "connectorOffer") + private ConnectorOffer connectorOffer; + + /* + * Disable write operations on metadata resources (databases, containers, throughput) via account keys + */ + @JsonProperty(value = "disableKeyBasedMetadataWriteAccess") + private Boolean disableKeyBasedMetadataWriteAccess; + + /* + * The URI of the key vault + */ + @JsonProperty(value = "keyVaultKeyUri") + private String keyVaultKeyUri; + + /* + * The default identity for accessing key vault used in features like customer managed keys. The default identity + * needs to be explicitly set by the users. It can be "FirstPartyIdentity", "SystemAssignedIdentity" and more. + */ + @JsonProperty(value = "defaultIdentity") + private String defaultIdentity; + + /* + * Whether requests from Public Network are allowed + */ + @JsonProperty(value = "publicNetworkAccess") + private PublicNetworkAccess publicNetworkAccess; + + /* + * Flag to indicate whether Free Tier is enabled. + */ + @JsonProperty(value = "enableFreeTier") + private Boolean enableFreeTier; + + /* + * API specific properties. Currently, supported only for MongoDB API. + */ + @JsonProperty(value = "apiProperties") + private ApiProperties apiProperties; + + /* + * Flag to indicate whether to enable storage analytics. + */ + @JsonProperty(value = "enableAnalyticalStorage") + private Boolean enableAnalyticalStorage; + + /* + * Analytical storage specific properties. + */ + @JsonProperty(value = "analyticalStorageConfiguration") + private AnalyticalStorageConfiguration analyticalStorageConfiguration; + + /* + * Enum to indicate the mode of account creation. + */ + @JsonProperty(value = "createMode") + private CreateMode createMode; + + /* + * The object representing the policy for taking backups on an account. + */ + @JsonProperty(value = "backupPolicy") + private BackupPolicy backupPolicy; + + /* + * The CORS policy for the Cosmos DB database account. + */ + @JsonProperty(value = "cors") + private List cors; + + /* + * Indicates what services are allowed to bypass firewall checks. + */ + @JsonProperty(value = "networkAclBypass") + private NetworkAclBypass networkAclBypass; + + /* + * An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account. + */ + @JsonProperty(value = "networkAclBypassResourceIds") + private List networkAclBypassResourceIds; + + /* + * Opt-out of local authentication and ensure only MSI and AAD can be used exclusively for authentication. + */ + @JsonProperty(value = "disableLocalAuth") + private Boolean disableLocalAuth; + + /* + * Parameters to indicate the information about the restore. + */ + @JsonProperty(value = "restoreParameters") + private RestoreParameters restoreParameters; + + /* + * The object that represents all properties related to capacity enforcement on an account. + */ + @JsonProperty(value = "capacity") + 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. + */ + @JsonProperty(value = "keysMetadata", access = JsonProperty.Access.WRITE_ONLY) + private DatabaseAccountKeysMetadata keysMetadata; + + /* + * Flag to indicate enabling/disabling of Partition Merge feature on the account + */ + @JsonProperty(value = "enablePartitionMerge") + private Boolean enablePartitionMerge; + + /* + * Indicates the minimum allowed Tls version. The default is Tls 1.0, except for Cassandra and Mongo API's, which + * only work with Tls 1.2. + */ + @JsonProperty(value = "minimalTlsVersion") + private MinimalTlsVersion minimalTlsVersion; + + /** Creates an instance of DatabaseAccountCreateUpdateProperties class. */ + public DatabaseAccountCreateUpdateProperties() { + databaseAccountOfferType = "Standard"; + } + + /** + * Get the consistencyPolicy property: The consistency policy for the Cosmos DB account. + * + * @return the consistencyPolicy value. + */ + public ConsistencyPolicy consistencyPolicy() { + return this.consistencyPolicy; + } + + /** + * Set the consistencyPolicy property: The consistency policy for the Cosmos DB account. + * + * @param consistencyPolicy the consistencyPolicy value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withConsistencyPolicy(ConsistencyPolicy consistencyPolicy) { + this.consistencyPolicy = consistencyPolicy; + return this; + } + + /** + * Get the locations property: An array that contains the georeplication locations enabled for the Cosmos DB + * account. + * + * @return the locations value. + */ + public List locations() { + return this.locations; + } + + /** + * Set the locations property: An array that contains the georeplication locations enabled for the Cosmos DB + * account. + * + * @param locations the locations value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withLocations(List locations) { + this.locations = locations; + return this; + } + + /** + * Get the databaseAccountOfferType property: The offer type for the database. + * + * @return the databaseAccountOfferType value. + */ + public String databaseAccountOfferType() { + return this.databaseAccountOfferType; + } + + /** + * Set the databaseAccountOfferType property: The offer type for the database. + * + * @param databaseAccountOfferType the databaseAccountOfferType value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withDatabaseAccountOfferType(String databaseAccountOfferType) { + this.databaseAccountOfferType = databaseAccountOfferType; + return this; + } + + /** + * Get the ipRules property: List of IpRules. + * + * @return the ipRules value. + */ + public List ipRules() { + return this.ipRules; + } + + /** + * Set the ipRules property: List of IpRules. + * + * @param ipRules the ipRules value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withIpRules(List ipRules) { + this.ipRules = ipRules; + return this; + } + + /** + * Get the isVirtualNetworkFilterEnabled property: Flag to indicate whether to enable/disable Virtual Network ACL + * rules. + * + * @return the isVirtualNetworkFilterEnabled value. + */ + public Boolean isVirtualNetworkFilterEnabled() { + return this.isVirtualNetworkFilterEnabled; + } + + /** + * Set the isVirtualNetworkFilterEnabled property: Flag to indicate whether to enable/disable Virtual Network ACL + * rules. + * + * @param isVirtualNetworkFilterEnabled the isVirtualNetworkFilterEnabled value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withIsVirtualNetworkFilterEnabled( + Boolean isVirtualNetworkFilterEnabled) { + this.isVirtualNetworkFilterEnabled = isVirtualNetworkFilterEnabled; + return this; + } + + /** + * Get the enableAutomaticFailover property: Enables automatic failover of the write region in the rare event that + * the region is unavailable due to an outage. Automatic failover will result in a new write region for the account + * and is chosen based on the failover priorities configured for the account. + * + * @return the enableAutomaticFailover value. + */ + public Boolean enableAutomaticFailover() { + return this.enableAutomaticFailover; + } + + /** + * Set the enableAutomaticFailover property: Enables automatic failover of the write region in the rare event that + * the region is unavailable due to an outage. Automatic failover will result in a new write region for the account + * and is chosen based on the failover priorities configured for the account. + * + * @param enableAutomaticFailover the enableAutomaticFailover value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withEnableAutomaticFailover(Boolean enableAutomaticFailover) { + this.enableAutomaticFailover = enableAutomaticFailover; + return this; + } + + /** + * Get the capabilities property: List of Cosmos DB capabilities for the account. + * + * @return the capabilities value. + */ + public List capabilities() { + return this.capabilities; + } + + /** + * Set the capabilities property: List of Cosmos DB capabilities for the account. + * + * @param capabilities the capabilities value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withCapabilities(List capabilities) { + this.capabilities = capabilities; + return this; + } + + /** + * Get the virtualNetworkRules property: List of Virtual Network ACL rules configured for the Cosmos DB account. + * + * @return the virtualNetworkRules value. + */ + public List virtualNetworkRules() { + return this.virtualNetworkRules; + } + + /** + * Set the virtualNetworkRules property: List of Virtual Network ACL rules configured for the Cosmos DB account. + * + * @param virtualNetworkRules the virtualNetworkRules value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withVirtualNetworkRules(List virtualNetworkRules) { + this.virtualNetworkRules = virtualNetworkRules; + return this; + } + + /** + * Get the enableMultipleWriteLocations property: Enables the account to write in multiple locations. + * + * @return the enableMultipleWriteLocations value. + */ + public Boolean enableMultipleWriteLocations() { + return this.enableMultipleWriteLocations; + } + + /** + * Set the enableMultipleWriteLocations property: Enables the account to write in multiple locations. + * + * @param enableMultipleWriteLocations the enableMultipleWriteLocations value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withEnableMultipleWriteLocations( + Boolean enableMultipleWriteLocations) { + this.enableMultipleWriteLocations = enableMultipleWriteLocations; + return this; + } + + /** + * Get the enableCassandraConnector property: Enables the cassandra connector on the Cosmos DB C* account. + * + * @return the enableCassandraConnector value. + */ + public Boolean enableCassandraConnector() { + return this.enableCassandraConnector; + } + + /** + * Set the enableCassandraConnector property: Enables the cassandra connector on the Cosmos DB C* account. + * + * @param enableCassandraConnector the enableCassandraConnector value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withEnableCassandraConnector(Boolean enableCassandraConnector) { + this.enableCassandraConnector = enableCassandraConnector; + return this; + } + + /** + * Get the connectorOffer property: The cassandra connector offer type for the Cosmos DB database C* account. + * + * @return the connectorOffer value. + */ + public ConnectorOffer connectorOffer() { + return this.connectorOffer; + } + + /** + * Set the connectorOffer property: The cassandra connector offer type for the Cosmos DB database C* account. + * + * @param connectorOffer the connectorOffer value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withConnectorOffer(ConnectorOffer connectorOffer) { + this.connectorOffer = connectorOffer; + return this; + } + + /** + * Get the disableKeyBasedMetadataWriteAccess property: Disable write operations on metadata resources (databases, + * containers, throughput) via account keys. + * + * @return the disableKeyBasedMetadataWriteAccess value. + */ + public Boolean disableKeyBasedMetadataWriteAccess() { + return this.disableKeyBasedMetadataWriteAccess; + } + + /** + * Set the disableKeyBasedMetadataWriteAccess property: Disable write operations on metadata resources (databases, + * containers, throughput) via account keys. + * + * @param disableKeyBasedMetadataWriteAccess the disableKeyBasedMetadataWriteAccess value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withDisableKeyBasedMetadataWriteAccess( + Boolean disableKeyBasedMetadataWriteAccess) { + this.disableKeyBasedMetadataWriteAccess = disableKeyBasedMetadataWriteAccess; + return this; + } + + /** + * Get the keyVaultKeyUri property: The URI of the key vault. + * + * @return the keyVaultKeyUri value. + */ + public String keyVaultKeyUri() { + return this.keyVaultKeyUri; + } + + /** + * Set the keyVaultKeyUri property: The URI of the key vault. + * + * @param keyVaultKeyUri the keyVaultKeyUri value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withKeyVaultKeyUri(String keyVaultKeyUri) { + this.keyVaultKeyUri = keyVaultKeyUri; + return this; + } + + /** + * Get the defaultIdentity property: The default identity for accessing key vault used in features like customer + * managed keys. The default identity needs to be explicitly set by the users. It can be "FirstPartyIdentity", + * "SystemAssignedIdentity" and more. + * + * @return the defaultIdentity value. + */ + public String defaultIdentity() { + return this.defaultIdentity; + } + + /** + * Set the defaultIdentity property: The default identity for accessing key vault used in features like customer + * managed keys. The default identity needs to be explicitly set by the users. It can be "FirstPartyIdentity", + * "SystemAssignedIdentity" and more. + * + * @param defaultIdentity the defaultIdentity value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withDefaultIdentity(String defaultIdentity) { + this.defaultIdentity = defaultIdentity; + return this; + } + + /** + * Get the publicNetworkAccess property: Whether requests from Public Network are allowed. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccess publicNetworkAccess() { + return this.publicNetworkAccess; + } + + /** + * Set the publicNetworkAccess property: Whether requests from Public Network are allowed. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + this.publicNetworkAccess = publicNetworkAccess; + return this; + } + + /** + * Get the enableFreeTier property: Flag to indicate whether Free Tier is enabled. + * + * @return the enableFreeTier value. + */ + public Boolean enableFreeTier() { + return this.enableFreeTier; + } + + /** + * Set the enableFreeTier property: Flag to indicate whether Free Tier is enabled. + * + * @param enableFreeTier the enableFreeTier value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withEnableFreeTier(Boolean enableFreeTier) { + this.enableFreeTier = enableFreeTier; + return this; + } + + /** + * Get the apiProperties property: API specific properties. Currently, supported only for MongoDB API. + * + * @return the apiProperties value. + */ + public ApiProperties apiProperties() { + return this.apiProperties; + } + + /** + * Set the apiProperties property: API specific properties. Currently, supported only for MongoDB API. + * + * @param apiProperties the apiProperties value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withApiProperties(ApiProperties apiProperties) { + this.apiProperties = apiProperties; + return this; + } + + /** + * Get the enableAnalyticalStorage property: Flag to indicate whether to enable storage analytics. + * + * @return the enableAnalyticalStorage value. + */ + public Boolean enableAnalyticalStorage() { + return this.enableAnalyticalStorage; + } + + /** + * Set the enableAnalyticalStorage property: Flag to indicate whether to enable storage analytics. + * + * @param enableAnalyticalStorage the enableAnalyticalStorage value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withEnableAnalyticalStorage(Boolean enableAnalyticalStorage) { + this.enableAnalyticalStorage = enableAnalyticalStorage; + return this; + } + + /** + * Get the analyticalStorageConfiguration property: Analytical storage specific properties. + * + * @return the analyticalStorageConfiguration value. + */ + public AnalyticalStorageConfiguration analyticalStorageConfiguration() { + return this.analyticalStorageConfiguration; + } + + /** + * Set the analyticalStorageConfiguration property: Analytical storage specific properties. + * + * @param analyticalStorageConfiguration the analyticalStorageConfiguration value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withAnalyticalStorageConfiguration( + AnalyticalStorageConfiguration analyticalStorageConfiguration) { + this.analyticalStorageConfiguration = analyticalStorageConfiguration; + return this; + } + + /** + * Get the createMode property: Enum to indicate the mode of account creation. + * + * @return the createMode value. + */ + public CreateMode createMode() { + return this.createMode; + } + + /** + * Set the createMode property: Enum to indicate the mode of account creation. + * + * @param createMode the createMode value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withCreateMode(CreateMode createMode) { + this.createMode = createMode; + return this; + } + + /** + * Get the backupPolicy property: The object representing the policy for taking backups on an account. + * + * @return the backupPolicy value. + */ + public BackupPolicy backupPolicy() { + return this.backupPolicy; + } + + /** + * Set the backupPolicy property: The object representing the policy for taking backups on an account. + * + * @param backupPolicy the backupPolicy value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withBackupPolicy(BackupPolicy backupPolicy) { + this.backupPolicy = backupPolicy; + return this; + } + + /** + * Get the cors property: The CORS policy for the Cosmos DB database account. + * + * @return the cors value. + */ + public List cors() { + return this.cors; + } + + /** + * Set the cors property: The CORS policy for the Cosmos DB database account. + * + * @param cors the cors value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withCors(List cors) { + this.cors = cors; + return this; + } + + /** + * Get the networkAclBypass property: Indicates what services are allowed to bypass firewall checks. + * + * @return the networkAclBypass value. + */ + public NetworkAclBypass networkAclBypass() { + return this.networkAclBypass; + } + + /** + * Set the networkAclBypass property: Indicates what services are allowed to bypass firewall checks. + * + * @param networkAclBypass the networkAclBypass value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withNetworkAclBypass(NetworkAclBypass networkAclBypass) { + this.networkAclBypass = networkAclBypass; + return this; + } + + /** + * Get the networkAclBypassResourceIds property: An array that contains the Resource Ids for Network Acl Bypass for + * the Cosmos DB account. + * + * @return the networkAclBypassResourceIds value. + */ + public List networkAclBypassResourceIds() { + return this.networkAclBypassResourceIds; + } + + /** + * Set the networkAclBypassResourceIds property: An array that contains the Resource Ids for Network Acl Bypass for + * the Cosmos DB account. + * + * @param networkAclBypassResourceIds the networkAclBypassResourceIds value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withNetworkAclBypassResourceIds( + List networkAclBypassResourceIds) { + this.networkAclBypassResourceIds = networkAclBypassResourceIds; + return this; + } + + /** + * Get the 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 is Tls 1.0, except for + * Cassandra and Mongo API's, which 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 is Tls 1.0, except for + * Cassandra and Mongo API's, which 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (consistencyPolicy() != null) { + consistencyPolicy().validate(); + } + if (locations() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property locations in model DatabaseAccountCreateUpdateProperties")); + } else { + locations().forEach(e -> e.validate()); + } + if (ipRules() != null) { + ipRules().forEach(e -> e.validate()); + } + if (capabilities() != null) { + capabilities().forEach(e -> e.validate()); + } + if (virtualNetworkRules() != null) { + virtualNetworkRules().forEach(e -> e.validate()); + } + if (apiProperties() != null) { + apiProperties().validate(); + } + if (analyticalStorageConfiguration() != null) { + analyticalStorageConfiguration().validate(); + } + if (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); +} 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..377d65b6281f6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountGetProperties.java @@ -0,0 +1,985 @@ +// Copyright (c) Microsoft 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.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 com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties for the database account. */ +@Fluent +public final class DatabaseAccountGetProperties { + /* + * The status of the Cosmos DB account at the time the operation was called. The status can be one of following. + * 'Creating' – the Cosmos DB account is being created. When an account is in Creating state, only properties that + * are specified as input for the Create Cosmos DB account operation are returned. 'Succeeded' – the Cosmos DB + * account is active for use. 'Updating' – the Cosmos DB account is being updated. 'Deleting' – the Cosmos DB + * account is being deleted. 'Failed' – the Cosmos DB account failed creation. 'DeletionFailed' – the Cosmos DB + * account deletion failed. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The connection endpoint for the Cosmos DB database account. + */ + @JsonProperty(value = "documentEndpoint", access = JsonProperty.Access.WRITE_ONLY) + private String documentEndpoint; + + /* + * The offer type for the Cosmos DB database account. Default value: Standard. + */ + @JsonProperty(value = "databaseAccountOfferType", access = JsonProperty.Access.WRITE_ONLY) + private DatabaseAccountOfferType databaseAccountOfferType; + + /* + * List of IpRules. + */ + @JsonProperty(value = "ipRules") + private List ipRules; + + /* + * Flag to indicate whether to enable/disable Virtual Network ACL rules. + */ + @JsonProperty(value = "isVirtualNetworkFilterEnabled") + private Boolean isVirtualNetworkFilterEnabled; + + /* + * Enables automatic failover of the write region in the rare event that the region is unavailable due to an + * outage. Automatic failover will result in a new write region for the account and is chosen based on the failover + * priorities configured for the account. + */ + @JsonProperty(value = "enableAutomaticFailover") + private Boolean enableAutomaticFailover; + + /* + * The consistency policy for the Cosmos DB database account. + */ + @JsonProperty(value = "consistencyPolicy") + private ConsistencyPolicy consistencyPolicy; + + /* + * List of Cosmos DB capabilities for the account + */ + @JsonProperty(value = "capabilities") + private List capabilities; + + /* + * An array that contains the write location for the Cosmos DB account. + */ + @JsonProperty(value = "writeLocations", access = JsonProperty.Access.WRITE_ONLY) + private List writeLocations; + + /* + * An array that contains of the read locations enabled for the Cosmos DB account. + */ + @JsonProperty(value = "readLocations", access = JsonProperty.Access.WRITE_ONLY) + private List readLocations; + + /* + * An array that contains all of the locations enabled for the Cosmos DB account. + */ + @JsonProperty(value = "locations", access = JsonProperty.Access.WRITE_ONLY) + private List locations; + + /* + * An array that contains the regions ordered by their failover priorities. + */ + @JsonProperty(value = "failoverPolicies", access = JsonProperty.Access.WRITE_ONLY) + private List failoverPolicies; + + /* + * List of Virtual Network ACL rules configured for the Cosmos DB account. + */ + @JsonProperty(value = "virtualNetworkRules") + private List virtualNetworkRules; + + /* + * List of Private Endpoint Connections configured for the Cosmos DB account. + */ + @JsonProperty(value = "privateEndpointConnections", access = JsonProperty.Access.WRITE_ONLY) + private List privateEndpointConnections; + + /* + * Enables the account to write in multiple locations + */ + @JsonProperty(value = "enableMultipleWriteLocations") + private Boolean enableMultipleWriteLocations; + + /* + * Enables the cassandra connector on the Cosmos DB C* account + */ + @JsonProperty(value = "enableCassandraConnector") + private Boolean enableCassandraConnector; + + /* + * The cassandra connector offer type for the Cosmos DB database C* account. + */ + @JsonProperty(value = "connectorOffer") + private ConnectorOffer connectorOffer; + + /* + * Disable write operations on metadata resources (databases, containers, throughput) via account keys + */ + @JsonProperty(value = "disableKeyBasedMetadataWriteAccess") + private Boolean disableKeyBasedMetadataWriteAccess; + + /* + * The URI of the key vault + */ + @JsonProperty(value = "keyVaultKeyUri") + private String keyVaultKeyUri; + + /* + * The default identity for accessing key vault used in features like customer managed keys. The default identity + * needs to be explicitly set by the users. It can be "FirstPartyIdentity", "SystemAssignedIdentity" and more. + */ + @JsonProperty(value = "defaultIdentity") + private String defaultIdentity; + + /* + * Whether requests from Public Network are allowed + */ + @JsonProperty(value = "publicNetworkAccess") + private PublicNetworkAccess publicNetworkAccess; + + /* + * Flag to indicate whether Free Tier is enabled. + */ + @JsonProperty(value = "enableFreeTier") + private Boolean enableFreeTier; + + /* + * API specific properties. + */ + @JsonProperty(value = "apiProperties") + private ApiProperties apiProperties; + + /* + * Flag to indicate whether to enable storage analytics. + */ + @JsonProperty(value = "enableAnalyticalStorage") + private Boolean enableAnalyticalStorage; + + /* + * Analytical storage specific properties. + */ + @JsonProperty(value = "analyticalStorageConfiguration") + private AnalyticalStorageConfiguration analyticalStorageConfiguration; + + /* + * A unique identifier assigned to the database account + */ + @JsonProperty(value = "instanceId", access = JsonProperty.Access.WRITE_ONLY) + private String instanceId; + + /* + * Enum to indicate the mode of account creation. + */ + @JsonProperty(value = "createMode") + private CreateMode createMode; + + /* + * Parameters to indicate the information about the restore. + */ + @JsonProperty(value = "restoreParameters") + private RestoreParameters restoreParameters; + + /* + * The object representing the policy for taking backups on an account. + */ + @JsonProperty(value = "backupPolicy") + private BackupPolicy backupPolicy; + + /* + * The CORS policy for the Cosmos DB database account. + */ + @JsonProperty(value = "cors") + private List cors; + + /* + * Indicates what services are allowed to bypass firewall checks. + */ + @JsonProperty(value = "networkAclBypass") + private NetworkAclBypass networkAclBypass; + + /* + * An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account. + */ + @JsonProperty(value = "networkAclBypassResourceIds") + private List networkAclBypassResourceIds; + + /* + * Opt-out of local authentication and ensure only MSI and AAD can be used exclusively for authentication. + */ + @JsonProperty(value = "disableLocalAuth") + private Boolean disableLocalAuth; + + /* + * The object that represents all properties related to capacity enforcement on an account. + */ + @JsonProperty(value = "capacity") + private Capacity capacity; + + /* + * The object that represents the metadata for the Account Keys of the Cosmos DB account. + */ + @JsonProperty(value = "keysMetadata", access = JsonProperty.Access.WRITE_ONLY) + private DatabaseAccountKeysMetadata keysMetadata; + + /* + * Flag to indicate enabling/disabling of Partition Merge feature on the account + */ + @JsonProperty(value = "enablePartitionMerge") + private Boolean enablePartitionMerge; + + /* + * Indicates the minimum allowed Tls version. The default is Tls 1.0, except for Cassandra and Mongo API's, which + * only work with Tls 1.2. + */ + @JsonProperty(value = "minimalTlsVersion") + private MinimalTlsVersion minimalTlsVersion; + + /** 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 is Tls 1.0, except for + * Cassandra and Mongo API's, which 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 is Tls 1.0, except for + * Cassandra and Mongo API's, which 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; + } + + /** + * 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(); + } + } +} 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..a1bac6a69d8d9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountGetResultsInner.java @@ -0,0 +1,896 @@ +// Copyright (c) Microsoft 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.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 com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** An Azure Cosmos DB database account. */ +@Fluent +public final class DatabaseAccountGetResultsInner extends ArmResourceProperties { + /* + * Indicates the type of database account. This can only be set at database account creation. + */ + @JsonProperty(value = "kind") + private DatabaseAccountKind kind; + + /* + * Identity for the resource. + */ + @JsonProperty(value = "identity") + private ManagedServiceIdentity identity; + + /* + * Properties for the database account. + */ + @JsonProperty(value = "properties") + private DatabaseAccountGetProperties innerProperties; + + /* + * The system meta data relating to this resource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** 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; + } + + /** {@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 is Tls 1.0, except for + * Cassandra and Mongo API's, which 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 is Tls 1.0, except for + * Cassandra and Mongo API's, which 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (identity() != null) { + identity().validate(); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/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..17e17bb7441c6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountListConnectionStringsResultInner.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountConnectionString; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The connection strings for the given database account. */ +@Fluent +public final class DatabaseAccountListConnectionStringsResultInner { + /* + * An array that contains the connection strings for the Cosmos DB account. + */ + @JsonProperty(value = "connectionStrings") + 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()); + } + } +} 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..92221fdd87e3c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountListKeysResultInner.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** 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. + */ + @JsonProperty(value = "primaryMasterKey", access = JsonProperty.Access.WRITE_ONLY) + private String primaryMasterKey; + + /* + * Base 64 encoded value of the secondary read-write key. + */ + @JsonProperty(value = "secondaryMasterKey", access = JsonProperty.Access.WRITE_ONLY) + private String secondaryMasterKey; + + /** 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountListReadOnlyKeysResultInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountListReadOnlyKeysResultInner.java new file mode 100644 index 0000000000000..4cede977a1f87 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountListReadOnlyKeysResultInner.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The read-only access keys for the given database account. */ +@Immutable +public class DatabaseAccountListReadOnlyKeysResultInner { + /* + * Base 64 encoded value of the primary read-only key. + */ + @JsonProperty(value = "primaryReadonlyMasterKey", access = JsonProperty.Access.WRITE_ONLY) + private String primaryReadonlyMasterKey; + + /* + * Base 64 encoded value of the secondary read-only key. + */ + @JsonProperty(value = "secondaryReadonlyMasterKey", access = JsonProperty.Access.WRITE_ONLY) + private String secondaryReadonlyMasterKey; + + /** 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; + } + + /** + * Get the secondaryReadonlyMasterKey property: Base 64 encoded value of the secondary read-only key. + * + * @return the secondaryReadonlyMasterKey value. + */ + public String secondaryReadonlyMasterKey() { + return this.secondaryReadonlyMasterKey; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountUpdateProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountUpdateProperties.java new file mode 100644 index 0000000000000..4e77bc6a1c17f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountUpdateProperties.java @@ -0,0 +1,796 @@ +// Copyright (c) Microsoft 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.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 com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties to update Azure Cosmos DB database accounts. */ +@Fluent +public final class DatabaseAccountUpdateProperties { + /* + * The consistency policy for the Cosmos DB account. + */ + @JsonProperty(value = "consistencyPolicy") + private ConsistencyPolicy consistencyPolicy; + + /* + * An array that contains the georeplication locations enabled for the Cosmos DB account. + */ + @JsonProperty(value = "locations") + private List locations; + + /* + * List of IpRules. + */ + @JsonProperty(value = "ipRules") + private List ipRules; + + /* + * Flag to indicate whether to enable/disable Virtual Network ACL rules. + */ + @JsonProperty(value = "isVirtualNetworkFilterEnabled") + private Boolean isVirtualNetworkFilterEnabled; + + /* + * Enables automatic failover of the write region in the rare event that the region is unavailable due to an + * outage. Automatic failover will result in a new write region for the account and is chosen based on the failover + * priorities configured for the account. + */ + @JsonProperty(value = "enableAutomaticFailover") + private Boolean enableAutomaticFailover; + + /* + * List of Cosmos DB capabilities for the account + */ + @JsonProperty(value = "capabilities") + private List capabilities; + + /* + * List of Virtual Network ACL rules configured for the Cosmos DB account. + */ + @JsonProperty(value = "virtualNetworkRules") + private List virtualNetworkRules; + + /* + * Enables the account to write in multiple locations + */ + @JsonProperty(value = "enableMultipleWriteLocations") + private Boolean enableMultipleWriteLocations; + + /* + * Enables the cassandra connector on the Cosmos DB C* account + */ + @JsonProperty(value = "enableCassandraConnector") + private Boolean enableCassandraConnector; + + /* + * The cassandra connector offer type for the Cosmos DB database C* account. + */ + @JsonProperty(value = "connectorOffer") + private ConnectorOffer connectorOffer; + + /* + * Disable write operations on metadata resources (databases, containers, throughput) via account keys + */ + @JsonProperty(value = "disableKeyBasedMetadataWriteAccess") + private Boolean disableKeyBasedMetadataWriteAccess; + + /* + * The URI of the key vault + */ + @JsonProperty(value = "keyVaultKeyUri") + private String keyVaultKeyUri; + + /* + * The default identity for accessing key vault used in features like customer managed keys. The default identity + * needs to be explicitly set by the users. It can be "FirstPartyIdentity", "SystemAssignedIdentity" and more. + */ + @JsonProperty(value = "defaultIdentity") + private String defaultIdentity; + + /* + * Whether requests from Public Network are allowed + */ + @JsonProperty(value = "publicNetworkAccess") + private PublicNetworkAccess publicNetworkAccess; + + /* + * Flag to indicate whether Free Tier is enabled. + */ + @JsonProperty(value = "enableFreeTier") + private Boolean enableFreeTier; + + /* + * API specific properties. Currently, supported only for MongoDB API. + */ + @JsonProperty(value = "apiProperties") + private ApiProperties apiProperties; + + /* + * Flag to indicate whether to enable storage analytics. + */ + @JsonProperty(value = "enableAnalyticalStorage") + private Boolean enableAnalyticalStorage; + + /* + * Analytical storage specific properties. + */ + @JsonProperty(value = "analyticalStorageConfiguration") + private AnalyticalStorageConfiguration analyticalStorageConfiguration; + + /* + * The object representing the policy for taking backups on an account. + */ + @JsonProperty(value = "backupPolicy") + private BackupPolicy backupPolicy; + + /* + * The CORS policy for the Cosmos DB database account. + */ + @JsonProperty(value = "cors") + private List cors; + + /* + * Indicates what services are allowed to bypass firewall checks. + */ + @JsonProperty(value = "networkAclBypass") + private NetworkAclBypass networkAclBypass; + + /* + * An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account. + */ + @JsonProperty(value = "networkAclBypassResourceIds") + private List networkAclBypassResourceIds; + + /* + * Opt-out of local authentication and ensure only MSI and AAD can be used exclusively for authentication. + */ + @JsonProperty(value = "disableLocalAuth") + private Boolean disableLocalAuth; + + /* + * The object that represents all properties related to capacity enforcement on an account. + */ + @JsonProperty(value = "capacity") + 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. + */ + @JsonProperty(value = "keysMetadata", access = JsonProperty.Access.WRITE_ONLY) + private DatabaseAccountKeysMetadata keysMetadata; + + /* + * Flag to indicate enabling/disabling of Partition Merge feature on the account + */ + @JsonProperty(value = "enablePartitionMerge") + private Boolean enablePartitionMerge; + + /* + * Indicates the minimum allowed Tls version. The default is Tls 1.0, except for Cassandra and Mongo API's, which + * only work with Tls 1.2. + */ + @JsonProperty(value = "minimalTlsVersion") + private MinimalTlsVersion minimalTlsVersion; + + /** 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 is Tls 1.0, except for + * Cassandra and Mongo API's, which 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 is Tls 1.0, except for + * Cassandra and Mongo API's, which 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; + } + + /** + * 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(); + } + } +} 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..5094613060a01 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/GremlinDatabaseCreateUpdateProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.GremlinDatabaseResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties to create and update Azure Cosmos DB Gremlin database. */ +@Fluent +public final class GremlinDatabaseCreateUpdateProperties { + /* + * The standard JSON format of a Gremlin database + */ + @JsonProperty(value = "resource", required = true) + private GremlinDatabaseResource resource; + + /* + * A key-value pair of options to be applied for the request. This corresponds to the headers sent with the + * request. + */ + @JsonProperty(value = "options") + private CreateUpdateOptions options; + + /** 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 + .logExceptionAsError( + 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); +} 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..c9a1b9fd645a4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/GremlinDatabaseGetProperties.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.GremlinDatabaseGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.GremlinDatabaseGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an Azure Cosmos DB SQL database. */ +@Fluent +public final class GremlinDatabaseGetProperties { + /* + * The resource property. + */ + @JsonProperty(value = "resource") + private GremlinDatabaseGetPropertiesResource resource; + + /* + * The options property. + */ + @JsonProperty(value = "options") + 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(); + } + } +} 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..faf6aacc9fbba --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/GremlinDatabaseGetResultsInner.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.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.GremlinDatabaseGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.GremlinDatabaseGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; +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 + */ + @JsonProperty(value = "properties") + private GremlinDatabaseGetProperties innerProperties; + + /** 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; + } + + /** {@inheritDoc} */ + @Override + public GremlinDatabaseGetResultsInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public GremlinDatabaseGetResultsInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public GremlinDatabaseGetPropertiesResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the GremlinDatabaseGetResultsInner object itself. + */ + public GremlinDatabaseGetResultsInner withResource(GremlinDatabaseGetPropertiesResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new GremlinDatabaseGetProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Get the options property: The options property. + * + * @return the options value. + */ + public GremlinDatabaseGetPropertiesOptions options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: The options property. + * + * @param options the options value to set. + * @return the GremlinDatabaseGetResultsInner object itself. + */ + public GremlinDatabaseGetResultsInner withOptions(GremlinDatabaseGetPropertiesOptions options) { + if (this.innerProperties() == null) { + this.innerProperties = new GremlinDatabaseGetProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/GremlinGraphCreateUpdateProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/GremlinGraphCreateUpdateProperties.java new file mode 100644 index 0000000000000..9d8ea1faa8ca1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/GremlinGraphCreateUpdateProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.GremlinGraphResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties to create and update Azure Cosmos DB Gremlin graph. */ +@Fluent +public final class GremlinGraphCreateUpdateProperties { + /* + * The standard JSON format of a Gremlin graph + */ + @JsonProperty(value = "resource", required = true) + private GremlinGraphResource resource; + + /* + * A key-value pair of options to be applied for the request. This corresponds to the headers sent with the + * request. + */ + @JsonProperty(value = "options") + private CreateUpdateOptions options; + + /** 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 + .logExceptionAsError( + 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); +} 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..d239b7b752620 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/GremlinGraphGetProperties.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.GremlinGraphGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.GremlinGraphGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an Azure Cosmos DB Gremlin graph. */ +@Fluent +public final class GremlinGraphGetProperties { + /* + * The resource property. + */ + @JsonProperty(value = "resource") + private GremlinGraphGetPropertiesResource resource; + + /* + * The options property. + */ + @JsonProperty(value = "options") + 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(); + } + } +} 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..32639b437e833 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/GremlinGraphGetResultsInner.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.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.GremlinGraphGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.GremlinGraphGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; +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 + */ + @JsonProperty(value = "properties") + private GremlinGraphGetProperties innerProperties; + + /** 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; + } + + /** {@inheritDoc} */ + @Override + public GremlinGraphGetResultsInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public GremlinGraphGetResultsInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public GremlinGraphGetPropertiesResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the GremlinGraphGetResultsInner object itself. + */ + public GremlinGraphGetResultsInner withResource(GremlinGraphGetPropertiesResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new GremlinGraphGetProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Get the options property: The options property. + * + * @return the options value. + */ + public GremlinGraphGetPropertiesOptions options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: The options property. + * + * @param options the options value to set. + * @return the GremlinGraphGetResultsInner object itself. + */ + public GremlinGraphGetResultsInner withOptions(GremlinGraphGetPropertiesOptions options) { + if (this.innerProperties() == null) { + this.innerProperties = new GremlinGraphGetProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/LocationGetResultInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/LocationGetResultInner.java new file mode 100644 index 0000000000000..10c1f910041d0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/LocationGetResultInner.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.ArmProxyResource; +import com.azure.resourcemanager.cosmos.generated.models.LocationProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB location get result. */ +@Fluent +public final class LocationGetResultInner extends ArmProxyResource { + /* + * Cosmos DB location metadata + */ + @JsonProperty(value = "properties") + private LocationProperties properties; + + /** 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MetricDefinitionInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MetricDefinitionInner.java new file mode 100644 index 0000000000000..10f757ddca70f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MetricDefinitionInner.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.cosmos.generated.models.MetricAvailability; +import com.azure.resourcemanager.cosmos.generated.models.MetricName; +import com.azure.resourcemanager.cosmos.generated.models.PrimaryAggregationType; +import com.azure.resourcemanager.cosmos.generated.models.UnitType; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The definition of a metric. */ +@Immutable +public final class MetricDefinitionInner { + /* + * The list of metric availabilities for the account. + */ + @JsonProperty(value = "metricAvailabilities", access = JsonProperty.Access.WRITE_ONLY) + private List metricAvailabilities; + + /* + * The primary aggregation type of the metric. + */ + @JsonProperty(value = "primaryAggregationType", access = JsonProperty.Access.WRITE_ONLY) + private PrimaryAggregationType primaryAggregationType; + + /* + * The unit of the metric. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private UnitType unit; + + /* + * The resource uri of the database. + */ + @JsonProperty(value = "resourceUri", access = JsonProperty.Access.WRITE_ONLY) + private String resourceUri; + + /* + * The name information for the metric. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private MetricName name; + + /** 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(); + } + } +} 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..13a59fe6c9201 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MetricInner.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.cosmos.generated.models.MetricName; +import com.azure.resourcemanager.cosmos.generated.models.MetricValue; +import com.azure.resourcemanager.cosmos.generated.models.UnitType; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Metric data. */ +@Immutable +public class MetricInner { + /* + * The start time for the metric (ISO-8601 format). + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * The end time for the metric (ISO-8601 format). + */ + @JsonProperty(value = "endTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime endTime; + + /* + * The time grain to be used to summarize the metric values. + */ + @JsonProperty(value = "timeGrain", access = JsonProperty.Access.WRITE_ONLY) + private String timeGrain; + + /* + * The unit of the metric. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private UnitType unit; + + /* + * The name information for the metric. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private MetricName name; + + /* + * The metric values for the specified time window and timestep. + */ + @JsonProperty(value = "metricValues", access = JsonProperty.Access.WRITE_ONLY) + private List metricValues; + + /** 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; + } + + /** + * Get the endTime property: The end time for the metric (ISO-8601 format). + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Get the timeGrain property: The time grain to be used to summarize the metric values. + * + * @return the timeGrain value. + */ + public String timeGrain() { + return this.timeGrain; + } + + /** + * Get the unit property: The unit of the metric. + * + * @return the unit value. + */ + public UnitType unit() { + return this.unit; + } + + /** + * Get the name property: The name information for the metric. + * + * @return the name value. + */ + public MetricName name() { + return this.name; + } + + /** + * Get the metricValues property: The metric values for the specified time window and timestep. + * + * @return the metricValues value. + */ + public List metricValues() { + return this.metricValues; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() != null) { + name().validate(); + } + if (metricValues() != null) { + metricValues().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoDBCollectionCreateUpdateProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoDBCollectionCreateUpdateProperties.java new file mode 100644 index 0000000000000..e78f38ebf7c7f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoDBCollectionCreateUpdateProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBCollectionResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties to create and update Azure Cosmos DB MongoDB collection. */ +@Fluent +public final class MongoDBCollectionCreateUpdateProperties { + /* + * The standard JSON format of a MongoDB collection + */ + @JsonProperty(value = "resource", required = true) + private MongoDBCollectionResource resource; + + /* + * A key-value pair of options to be applied for the request. This corresponds to the headers sent with the + * request. + */ + @JsonProperty(value = "options") + private CreateUpdateOptions options; + + /** 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 + .logExceptionAsError( + 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); +} 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..f5679b19960e7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoDBCollectionGetProperties.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBCollectionGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBCollectionGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an Azure Cosmos DB MongoDB collection. */ +@Fluent +public final class MongoDBCollectionGetProperties { + /* + * The resource property. + */ + @JsonProperty(value = "resource") + private MongoDBCollectionGetPropertiesResource resource; + + /* + * The options property. + */ + @JsonProperty(value = "options") + 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(); + } + } +} 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..256ae5342500c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoDBCollectionGetResultsInner.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.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBCollectionGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBCollectionGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; +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 + */ + @JsonProperty(value = "properties") + private MongoDBCollectionGetProperties innerProperties; + + /** 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; + } + + /** {@inheritDoc} */ + @Override + public MongoDBCollectionGetResultsInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public MongoDBCollectionGetResultsInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public MongoDBCollectionGetPropertiesResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the MongoDBCollectionGetResultsInner object itself. + */ + public MongoDBCollectionGetResultsInner withResource(MongoDBCollectionGetPropertiesResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new MongoDBCollectionGetProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Get the options property: The options property. + * + * @return the options value. + */ + public MongoDBCollectionGetPropertiesOptions options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: The options property. + * + * @param options the options value to set. + * @return the MongoDBCollectionGetResultsInner object itself. + */ + public MongoDBCollectionGetResultsInner withOptions(MongoDBCollectionGetPropertiesOptions options) { + if (this.innerProperties() == null) { + this.innerProperties = new MongoDBCollectionGetProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoDBDatabaseCreateUpdateProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoDBDatabaseCreateUpdateProperties.java new file mode 100644 index 0000000000000..6b9caee16a41b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoDBDatabaseCreateUpdateProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBDatabaseResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties to create and update Azure Cosmos DB MongoDB database. */ +@Fluent +public final class MongoDBDatabaseCreateUpdateProperties { + /* + * The standard JSON format of a MongoDB database + */ + @JsonProperty(value = "resource", required = true) + private MongoDBDatabaseResource resource; + + /* + * A key-value pair of options to be applied for the request. This corresponds to the headers sent with the + * request. + */ + @JsonProperty(value = "options") + private CreateUpdateOptions options; + + /** 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 + .logExceptionAsError( + 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); +} 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..16ffba632f494 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoDBDatabaseGetProperties.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBDatabaseGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBDatabaseGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an Azure Cosmos DB MongoDB database. */ +@Fluent +public final class MongoDBDatabaseGetProperties { + /* + * The resource property. + */ + @JsonProperty(value = "resource") + private MongoDBDatabaseGetPropertiesResource resource; + + /* + * The options property. + */ + @JsonProperty(value = "options") + 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(); + } + } +} 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..f73ea5dd810a0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoDBDatabaseGetResultsInner.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.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBDatabaseGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBDatabaseGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; +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 + */ + @JsonProperty(value = "properties") + private MongoDBDatabaseGetProperties innerProperties; + + /** 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; + } + + /** {@inheritDoc} */ + @Override + public MongoDBDatabaseGetResultsInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public MongoDBDatabaseGetResultsInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public MongoDBDatabaseGetPropertiesResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the MongoDBDatabaseGetResultsInner object itself. + */ + public MongoDBDatabaseGetResultsInner withResource(MongoDBDatabaseGetPropertiesResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new MongoDBDatabaseGetProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Get the options property: The options property. + * + * @return the options value. + */ + public MongoDBDatabaseGetPropertiesOptions options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: The options property. + * + * @param options the options value to set. + * @return the MongoDBDatabaseGetResultsInner object itself. + */ + public MongoDBDatabaseGetResultsInner withOptions(MongoDBDatabaseGetPropertiesOptions options) { + if (this.innerProperties() == null) { + this.innerProperties = new MongoDBDatabaseGetProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/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..854de4e6fe7e1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoRoleDefinitionGetResultsInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +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 com.fasterxml.jackson.annotation.JsonProperty; +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. + */ + @JsonProperty(value = "properties") + private MongoRoleDefinitionResource innerProperties; + + /** 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 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() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/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..408fb65494ade --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoRoleDefinitionResource.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.fluent.models; + +import com.azure.core.annotation.Fluent; +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 com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Azure Cosmos DB Mongo Role Definition resource object. */ +@Fluent +public final class MongoRoleDefinitionResource { + /* + * A user-friendly name for the Role Definition. Must be unique for the database account. + */ + @JsonProperty(value = "roleName") + private String roleName; + + /* + * Indicates whether the Role Definition was built-in or user created. + */ + @JsonProperty(value = "type") + private MongoRoleDefinitionType type; + + /* + * The database name for which access is being granted for this Role Definition. + */ + @JsonProperty(value = "databaseName") + 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. + */ + @JsonProperty(value = "privileges") + private List privileges; + + /* + * The set of roles inherited by this Role Definition. + */ + @JsonProperty(value = "roles") + 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()); + } + } +} 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..6b4385a8120b8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoUserDefinitionGetResultsInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.ArmProxyResource; +import com.azure.resourcemanager.cosmos.generated.models.Role; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** An Azure Cosmos DB User Definition. */ +@Fluent +public final class MongoUserDefinitionGetResultsInner extends ArmProxyResource { + /* + * Properties related to the User Definition. + */ + @JsonProperty(value = "properties") + private MongoUserDefinitionResource innerProperties; + + /** 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 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() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/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..ed452f6a26558 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoUserDefinitionResource.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.Role; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Azure Cosmos DB Mongo User Definition resource object. */ +@Fluent +public final class MongoUserDefinitionResource { + /* + * The user name for User Definition. + */ + @JsonProperty(value = "userName") + private String username; + + /* + * The password for User Definition. Response does not contain user password. + */ + @JsonProperty(value = "password") + private String password; + + /* + * The database name for which access is being granted for this User Definition. + */ + @JsonProperty(value = "databaseName") + private String databaseName; + + /* + * A custom definition for the USer Definition. + */ + @JsonProperty(value = "customData") + private String customData; + + /* + * The set of roles inherited by the User Definition. + */ + @JsonProperty(value = "roles") + private List roles; + + /* + * The Mongo Auth mechanism. For now, we only support auth mechanism SCRAM-SHA-256. + */ + @JsonProperty(value = "mechanisms") + 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()); + } + } +} 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..0042e935c4039 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/NotebookWorkspaceConnectionInfoResultInner.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The connection info for the given notebook workspace. */ +@Immutable +public final class NotebookWorkspaceConnectionInfoResultInner { + /* + * Specifies auth token used for connecting to Notebook server (uses token-based auth). + */ + @JsonProperty(value = "authToken", access = JsonProperty.Access.WRITE_ONLY) + private String authToken; + + /* + * Specifies the endpoint of Notebook server. + */ + @JsonProperty(value = "notebookServerEndpoint", access = JsonProperty.Access.WRITE_ONLY) + private String notebookServerEndpoint; + + /** 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() { + } +} 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..5565c9016dd48 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/NotebookWorkspaceInner.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.cosmos.generated.models.ArmProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A notebook workspace resource. */ +@Immutable +public final class NotebookWorkspaceInner extends ArmProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private NotebookWorkspaceProperties innerProperties; + + /** 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 notebookServerEndpoint property: Specifies the endpoint of Notebook server. + * + * @return the notebookServerEndpoint value. + */ + public String notebookServerEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().notebookServerEndpoint(); + } + + /** + * Get the status property: Status of the notebook workspace. Possible values are: Creating, Online, Deleting, + * Failed, Updating. + * + * @return the status value. + */ + public String status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/NotebookWorkspaceProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/NotebookWorkspaceProperties.java new file mode 100644 index 0000000000000..02c55e37022d1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/NotebookWorkspaceProperties.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a notebook workspace resource. */ +@Immutable +public final class NotebookWorkspaceProperties { + /* + * Specifies the endpoint of Notebook server. + */ + @JsonProperty(value = "notebookServerEndpoint", access = JsonProperty.Access.WRITE_ONLY) + private String notebookServerEndpoint; + + /* + * Status of the notebook workspace. Possible values are: Creating, Online, Deleting, Failed, Updating. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /** 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() { + } +} 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..b55dddf653c21 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/OperationInner.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** REST API operation. */ +@Fluent +public final class OperationInner { + /* + * Operation name: {provider}/{resource}/{operation} + */ + @JsonProperty(value = "name") + private String name; + + /* + * The object that represents the operation. + */ + @JsonProperty(value = "display") + 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(); + } + } +} 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..ee5442bdf793e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PartitionMetricInner.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The metric values for a single partition. */ +@Immutable +public final class PartitionMetricInner extends MetricInner { + /* + * The partition id (GUID identifier) of the metric values. + */ + @JsonProperty(value = "partitionId", access = JsonProperty.Access.WRITE_ONLY) + private String partitionId; + + /* + * The partition key range id (integer identifier) of the metric values. + */ + @JsonProperty(value = "partitionKeyRangeId", access = JsonProperty.Access.WRITE_ONLY) + private String partitionKeyRangeId; + + /** 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PartitionUsageInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PartitionUsageInner.java new file mode 100644 index 0000000000000..b3e81a7151fab --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PartitionUsageInner.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The partition level usage data for a usage request. */ +@Immutable +public final class PartitionUsageInner extends UsageInner { + /* + * The partition id (GUID identifier) of the usages. + */ + @JsonProperty(value = "partitionId", access = JsonProperty.Access.WRITE_ONLY) + private String partitionId; + + /* + * The partition key range id (integer identifier) of the usages. + */ + @JsonProperty(value = "partitionKeyRangeId", access = JsonProperty.Access.WRITE_ONLY) + private String partitionKeyRangeId; + + /** 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PercentileMetricInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PercentileMetricInner.java new file mode 100644 index 0000000000000..625c25e4c9648 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PercentileMetricInner.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.cosmos.generated.models.MetricName; +import com.azure.resourcemanager.cosmos.generated.models.PercentileMetricValue; +import com.azure.resourcemanager.cosmos.generated.models.UnitType; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Percentile Metric data. */ +@Immutable +public final class PercentileMetricInner { + /* + * The start time for the metric (ISO-8601 format). + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * The end time for the metric (ISO-8601 format). + */ + @JsonProperty(value = "endTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime endTime; + + /* + * The time grain to be used to summarize the metric values. + */ + @JsonProperty(value = "timeGrain", access = JsonProperty.Access.WRITE_ONLY) + private String timeGrain; + + /* + * The unit of the metric. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private UnitType unit; + + /* + * The name information for the metric. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private MetricName name; + + /* + * The percentile metric values for the specified time window and timestep. + */ + @JsonProperty(value = "metricValues", access = JsonProperty.Access.WRITE_ONLY) + private List metricValues; + + /** 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()); + } + } +} 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..daa60b9096d2a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PrivateEndpointConnectionInner.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.cosmos.generated.models.PrivateEndpointProperty; +import com.azure.resourcemanager.cosmos.generated.models.PrivateLinkServiceConnectionStateProperty; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A private endpoint connection. */ +@Fluent +public final class PrivateEndpointConnectionInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private PrivateEndpointConnectionProperties innerProperties; + + /** 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 privateEndpoint property: Private endpoint which the connection belongs to. + * + * @return the privateEndpoint value. + */ + public PrivateEndpointProperty privateEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().privateEndpoint(); + } + + /** + * Set the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @param privateEndpoint the privateEndpoint value to set. + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner withPrivateEndpoint(PrivateEndpointProperty privateEndpoint) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateEndpointConnectionProperties(); + } + this.innerProperties().withPrivateEndpoint(privateEndpoint); + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: Connection State of the Private Endpoint Connection. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState() { + return this.innerProperties() == null ? null : this.innerProperties().privateLinkServiceConnectionState(); + } + + /** + * Set the privateLinkServiceConnectionState property: Connection State of the Private Endpoint Connection. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateEndpointConnectionProperties(); + } + this.innerProperties().withPrivateLinkServiceConnectionState(privateLinkServiceConnectionState); + return this; + } + + /** + * Get the groupId property: Group id of the private endpoint. + * + * @return the groupId value. + */ + public String groupId() { + return this.innerProperties() == null ? null : this.innerProperties().groupId(); + } + + /** + * Set the groupId property: Group id of the private endpoint. + * + * @param groupId the groupId value to set. + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner withGroupId(String groupId) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateEndpointConnectionProperties(); + } + this.innerProperties().withGroupId(groupId); + return this; + } + + /** + * Get the provisioningState property: Provisioning state of the private endpoint. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Set the provisioningState property: Provisioning state of the private endpoint. + * + * @param provisioningState the provisioningState value to set. + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner withProvisioningState(String provisioningState) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateEndpointConnectionProperties(); + } + this.innerProperties().withProvisioningState(provisioningState); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PrivateEndpointConnectionProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PrivateEndpointConnectionProperties.java new file mode 100644 index 0000000000000..9458981a7111a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PrivateEndpointConnectionProperties.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.PrivateEndpointProperty; +import com.azure.resourcemanager.cosmos.generated.models.PrivateLinkServiceConnectionStateProperty; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a private endpoint connection. */ +@Fluent +public final class PrivateEndpointConnectionProperties { + /* + * Private endpoint which the connection belongs to. + */ + @JsonProperty(value = "privateEndpoint") + private PrivateEndpointProperty privateEndpoint; + + /* + * Connection State of the Private Endpoint Connection. + */ + @JsonProperty(value = "privateLinkServiceConnectionState") + private PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState; + + /* + * Group id of the private endpoint. + */ + @JsonProperty(value = "groupId") + private String groupId; + + /* + * Provisioning state of the private endpoint. + */ + @JsonProperty(value = "provisioningState") + private String provisioningState; + + /** 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(); + } + } +} 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..a8aafe6e64f13 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PrivateLinkResourceInner.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.cosmos.generated.models.ArmProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A private link resource. */ +@Immutable +public final class PrivateLinkResourceInner extends ArmProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private PrivateLinkResourceProperties innerProperties; + + /** 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 groupId property: The private link resource group id. + * + * @return the groupId value. + */ + public String groupId() { + return this.innerProperties() == null ? null : this.innerProperties().groupId(); + } + + /** + * Get the requiredMembers property: The private link resource required member names. + * + * @return the requiredMembers value. + */ + public List requiredMembers() { + return this.innerProperties() == null ? null : this.innerProperties().requiredMembers(); + } + + /** + * Get the requiredZoneNames property: The private link resource required zone names. + * + * @return the requiredZoneNames value. + */ + public List requiredZoneNames() { + return this.innerProperties() == null ? null : this.innerProperties().requiredZoneNames(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PrivateLinkResourceProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PrivateLinkResourceProperties.java new file mode 100644 index 0000000000000..eb2a207d29744 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PrivateLinkResourceProperties.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of a private link resource. */ +@Immutable +public final class PrivateLinkResourceProperties { + /* + * The private link resource group id. + */ + @JsonProperty(value = "groupId", access = JsonProperty.Access.WRITE_ONLY) + private String groupId; + + /* + * The private link resource required member names. + */ + @JsonProperty(value = "requiredMembers", access = JsonProperty.Access.WRITE_ONLY) + private List requiredMembers; + + /* + * The private link resource required zone names. + */ + @JsonProperty(value = "requiredZoneNames", access = JsonProperty.Access.WRITE_ONLY) + private List requiredZoneNames; + + /** 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() { + } +} 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..c1cf7685dcd8e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableDatabaseAccountGetResultInner.java @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.ApiType; +import com.azure.resourcemanager.cosmos.generated.models.RestorableLocationResource; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** A Azure Cosmos DB restorable database account. */ +@Fluent +public final class RestorableDatabaseAccountGetResultInner { + /* + * The properties of a restorable database account. + */ + @JsonProperty(value = "properties") + private RestorableDatabaseAccountProperties innerProperties; + + /* + * The unique resource identifier of the ARM resource. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The name of the ARM resource. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The type of Azure resource. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * The location of the resource group to which the resource belongs. + */ + @JsonProperty(value = "location") + private String location; + + /** 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 apiType property: The API type of the restorable database account. + * + * @return the apiType value. + */ + public ApiType apiType() { + return this.innerProperties() == null ? null : this.innerProperties().apiType(); + } + + /** + * Get the restorableLocations property: List of regions where the of the database account can be restored from. + * + * @return the restorableLocations value. + */ + public List restorableLocations() { + return this.innerProperties() == null ? null : this.innerProperties().restorableLocations(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableDatabaseAccountProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableDatabaseAccountProperties.java new file mode 100644 index 0000000000000..4b3eabd75b649 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableDatabaseAccountProperties.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.resourcemanager.cosmos.generated.models.ApiType; +import com.azure.resourcemanager.cosmos.generated.models.RestorableLocationResource; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** The properties of a restorable database account. */ +@Fluent +public final class RestorableDatabaseAccountProperties { + /* + * The name of the global database account + */ + @JsonProperty(value = "accountName") + private String accountName; + + /* + * The creation time of the restorable database account (ISO-8601 format). + */ + @JsonProperty(value = "creationTime") + private OffsetDateTime creationTime; + + /* + * The time at which the restorable database account has been deleted (ISO-8601 format). + */ + @JsonProperty(value = "deletionTime") + private OffsetDateTime deletionTime; + + /* + * The API type of the restorable database account. + */ + @JsonProperty(value = "apiType", access = JsonProperty.Access.WRITE_ONLY) + private ApiType apiType; + + /* + * List of regions where the of the database account can be restored from. + */ + @JsonProperty(value = "restorableLocations", access = JsonProperty.Access.WRITE_ONLY) + private List restorableLocations; + + /** 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 apiType property: The API type of the restorable database account. + * + * @return the apiType value. + */ + public ApiType apiType() { + return this.apiType; + } + + /** + * Get the restorableLocations property: List of regions where the of the database account can be restored from. + * + * @return the restorableLocations value. + */ + public List restorableLocations() { + return this.restorableLocations; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (restorableLocations() != null) { + restorableLocations().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/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..270a07defb6f7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableGremlinDatabaseGetResultInner.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.RestorableGremlinDatabasePropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An Azure Cosmos DB Gremlin database event. */ +@Fluent +public final class RestorableGremlinDatabaseGetResultInner { + /* + * The properties of a Gremlin database event. + */ + @JsonProperty(value = "properties") + private RestorableGremlinDatabaseProperties innerProperties; + + /* + * The unique resource Identifier of the ARM resource. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The name of the ARM resource. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The type of Azure resource. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** 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(); + } + } +} 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..8a23dd5d24f7d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableGremlinDatabaseProperties.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.RestorableGremlinDatabasePropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an Azure Cosmos DB Gremlin database event. */ +@Fluent +public final class RestorableGremlinDatabaseProperties { + /* + * The resource of an Azure Cosmos DB Gremlin database event + */ + @JsonProperty(value = "resource") + 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(); + } + } +} 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..f184f29fb1073 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableGremlinGraphGetResultInner.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.RestorableGremlinGraphPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An Azure Cosmos DB Gremlin graph event. */ +@Fluent +public final class RestorableGremlinGraphGetResultInner { + /* + * The properties of a Gremlin graph event. + */ + @JsonProperty(value = "properties") + private RestorableGremlinGraphProperties innerProperties; + + /* + * The unique resource Identifier of the ARM resource. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The name of the ARM resource. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The type of Azure resource. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** 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(); + } + } +} 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..d3933200befa1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableGremlinGraphProperties.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.RestorableGremlinGraphPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an Azure Cosmos DB Gremlin graph event. */ +@Fluent +public final class RestorableGremlinGraphProperties { + /* + * The resource of an Azure Cosmos DB Gremlin graph event + */ + @JsonProperty(value = "resource") + 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(); + } + } +} 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..7a4a130bc833d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableGremlinResourcesGetResultInner.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Specific Databases to restore. */ +@Fluent +public final class RestorableGremlinResourcesGetResultInner { + /* + * The unique resource identifier of the ARM resource. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The name of the ARM resource. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The type of Azure resource. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * The name of the gremlin database available for restore. + */ + @JsonProperty(value = "databaseName") + private String databaseName; + + /* + * The names of the graphs available for restore. + */ + @JsonProperty(value = "graphNames") + 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() { + } +} 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..993054af2f61d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableMongodbCollectionGetResultInner.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbCollectionPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An Azure Cosmos DB MongoDB collection event. */ +@Fluent +public final class RestorableMongodbCollectionGetResultInner { + /* + * The properties of a MongoDB collection event. + */ + @JsonProperty(value = "properties") + private RestorableMongodbCollectionProperties innerProperties; + + /* + * The unique resource Identifier of the ARM resource. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The name of the ARM resource. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The type of Azure resource. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** 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(); + } + } +} 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..deccd5bce2cbf --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableMongodbCollectionProperties.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbCollectionPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an Azure Cosmos DB MongoDB collection event. */ +@Fluent +public final class RestorableMongodbCollectionProperties { + /* + * The resource of an Azure Cosmos DB MongoDB collection event + */ + @JsonProperty(value = "resource") + 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(); + } + } +} 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..4324b9d611f5e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableMongodbDatabaseGetResultInner.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbDatabasePropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An Azure Cosmos DB MongoDB database event. */ +@Fluent +public final class RestorableMongodbDatabaseGetResultInner { + /* + * The properties of a MongoDB database event. + */ + @JsonProperty(value = "properties") + private RestorableMongodbDatabaseProperties innerProperties; + + /* + * The unique resource Identifier of the ARM resource. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The name of the ARM resource. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The type of Azure resource. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** 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(); + } + } +} 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..34d8d28ad200b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableMongodbDatabaseProperties.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbDatabasePropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an Azure Cosmos DB MongoDB database event. */ +@Fluent +public final class RestorableMongodbDatabaseProperties { + /* + * The resource of an Azure Cosmos DB MongoDB database event + */ + @JsonProperty(value = "resource") + 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(); + } + } +} 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..c86961e9c337c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableMongodbResourcesGetResultInner.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Specific Databases to restore. */ +@Fluent +public final class RestorableMongodbResourcesGetResultInner { + /* + * The unique resource identifier of the ARM resource. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The name of the ARM resource. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The type of Azure resource. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * The name of the database available for restore. + */ + @JsonProperty(value = "databaseName") + private String databaseName; + + /* + * The names of the collections available for restore. + */ + @JsonProperty(value = "collectionNames") + private List collectionNames; + + /** 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() { + } +} 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..27496241ce98f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableSqlContainerGetResultInner.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlContainerPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An Azure Cosmos DB SQL container event. */ +@Fluent +public final class RestorableSqlContainerGetResultInner { + /* + * The properties of a SQL container event. + */ + @JsonProperty(value = "properties") + private RestorableSqlContainerProperties innerProperties; + + /* + * The unique resource Identifier of the ARM resource. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The name of the ARM resource. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The type of Azure resource. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** 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(); + } + } +} 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..56a39132b5e3c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableSqlContainerProperties.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlContainerPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an Azure Cosmos DB SQL container event. */ +@Fluent +public final class RestorableSqlContainerProperties { + /* + * The resource of an Azure Cosmos DB SQL container event + */ + @JsonProperty(value = "resource") + 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(); + } + } +} 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..c92ab55b8a412 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableSqlDatabaseGetResultInner.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlDatabasePropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An Azure Cosmos DB SQL database event. */ +@Fluent +public final class RestorableSqlDatabaseGetResultInner { + /* + * The properties of a SQL database event. + */ + @JsonProperty(value = "properties") + private RestorableSqlDatabaseProperties innerProperties; + + /* + * The unique resource Identifier of the ARM resource. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The name of the ARM resource. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The type of Azure resource. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** 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(); + } + } +} 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..2383580ef6ce5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableSqlDatabaseProperties.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlDatabasePropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an Azure Cosmos DB SQL database event. */ +@Fluent +public final class RestorableSqlDatabaseProperties { + /* + * The resource of an Azure Cosmos DB SQL database event + */ + @JsonProperty(value = "resource") + 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(); + } + } +} 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..6504ff29c574d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableSqlResourcesGetResultInner.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Specific Databases to restore. */ +@Fluent +public final class RestorableSqlResourcesGetResultInner { + /* + * The unique resource identifier of the ARM resource. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The name of the ARM resource. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The type of Azure resource. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * The name of the database available for restore. + */ + @JsonProperty(value = "databaseName") + private String databaseName; + + /* + * The names of the collections available for restore. + */ + @JsonProperty(value = "collectionNames") + private List collectionNames; + + /** 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() { + } +} 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..5a7bca9580537 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableTableGetResultInner.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.RestorableTablePropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An Azure Cosmos DB Table event. */ +@Fluent +public final class RestorableTableGetResultInner { + /* + * The properties of a Table event. + */ + @JsonProperty(value = "properties") + private RestorableTableProperties innerProperties; + + /* + * The unique resource Identifier of the ARM resource. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The name of the ARM resource. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The type of Azure resource. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** 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(); + } + } +} 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..537f647d33cb3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableTableProperties.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.RestorableTablePropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an Azure Cosmos DB Table event. */ +@Fluent +public final class RestorableTableProperties { + /* + * The resource of an Azure Cosmos DB Table event + */ + @JsonProperty(value = "resource") + 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(); + } + } +} 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..047ecb72cf264 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableTableResourcesGetResultInner.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.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Specific Databases to restore. */ +@Immutable +public final class RestorableTableResourcesGetResultInner { + /* + * The unique resource identifier of the ARM resource. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The name of the Table. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The type of Azure resource. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** 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() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ServiceResourceCreateUpdateProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ServiceResourceCreateUpdateProperties.java new file mode 100644 index 0000000000000..ecb1217dca958 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ServiceResourceCreateUpdateProperties.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.ServiceSize; +import com.azure.resourcemanager.cosmos.generated.models.ServiceType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties in ServiceResourceCreateUpdateParameters. */ +@Fluent +public final class ServiceResourceCreateUpdateProperties { + /* + * Instance type for the service. + */ + @JsonProperty(value = "instanceSize") + private ServiceSize instanceSize; + + /* + * Instance count for the service. + */ + @JsonProperty(value = "instanceCount") + private Integer instanceCount; + + /* + * ServiceType for the service. + */ + @JsonProperty(value = "serviceType") + private ServiceType serviceType; + + /** Creates an instance of ServiceResourceCreateUpdateProperties class. */ + public ServiceResourceCreateUpdateProperties() { + } + + /** + * Get the instanceSize property: Instance type for the service. + * + * @return the instanceSize value. + */ + public ServiceSize instanceSize() { + return this.instanceSize; + } + + /** + * Set the instanceSize property: Instance type for the service. + * + * @param instanceSize the instanceSize value to set. + * @return the ServiceResourceCreateUpdateProperties object itself. + */ + public ServiceResourceCreateUpdateProperties withInstanceSize(ServiceSize instanceSize) { + this.instanceSize = instanceSize; + return this; + } + + /** + * Get the instanceCount property: Instance count for the service. + * + * @return the instanceCount value. + */ + public Integer instanceCount() { + return this.instanceCount; + } + + /** + * Set the instanceCount property: Instance count for the service. + * + * @param instanceCount the instanceCount value to set. + * @return the ServiceResourceCreateUpdateProperties object itself. + */ + public ServiceResourceCreateUpdateProperties withInstanceCount(Integer instanceCount) { + this.instanceCount = instanceCount; + return this; + } + + /** + * Get the serviceType property: ServiceType for the service. + * + * @return the serviceType value. + */ + public ServiceType serviceType() { + return this.serviceType; + } + + /** + * Set the serviceType property: ServiceType for the service. + * + * @param serviceType the serviceType value to set. + * @return the ServiceResourceCreateUpdateProperties object itself. + */ + public ServiceResourceCreateUpdateProperties withServiceType(ServiceType serviceType) { + this.serviceType = serviceType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ServiceResourceInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ServiceResourceInner.java new file mode 100644 index 0000000000000..9e5358ee732d1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ServiceResourceInner.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.ArmProxyResource; +import com.azure.resourcemanager.cosmos.generated.models.ServiceResourceProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties for the database account. */ +@Fluent +public final class ServiceResourceInner extends ArmProxyResource { + /* + * Services response resource. + */ + @JsonProperty(value = "properties") + private ServiceResourceProperties properties; + + /** 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlContainerCreateUpdateProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlContainerCreateUpdateProperties.java new file mode 100644 index 0000000000000..5db32e2d54fa3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlContainerCreateUpdateProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.SqlContainerResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties to create and update Azure Cosmos DB container. */ +@Fluent +public final class SqlContainerCreateUpdateProperties { + /* + * The standard JSON format of a container + */ + @JsonProperty(value = "resource", required = true) + private SqlContainerResource resource; + + /* + * A key-value pair of options to be applied for the request. This corresponds to the headers sent with the + * request. + */ + @JsonProperty(value = "options") + private CreateUpdateOptions options; + + /** 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 + .logExceptionAsError( + 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); +} 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..ecb8aa4a9190e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlContainerGetProperties.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.SqlContainerGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.SqlContainerGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an Azure Cosmos DB container. */ +@Fluent +public final class SqlContainerGetProperties { + /* + * The resource property. + */ + @JsonProperty(value = "resource") + private SqlContainerGetPropertiesResource resource; + + /* + * The options property. + */ + @JsonProperty(value = "options") + 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(); + } + } +} 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..95a69711ec035 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlContainerGetResultsInner.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.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.SqlContainerGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.SqlContainerGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An Azure Cosmos DB container. */ +@Fluent +public final class SqlContainerGetResultsInner extends ArmResourceProperties { + /* + * The properties of an Azure Cosmos DB container + */ + @JsonProperty(value = "properties") + private SqlContainerGetProperties innerProperties; + + /** 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; + } + + /** {@inheritDoc} */ + @Override + public SqlContainerGetResultsInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlContainerGetResultsInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public SqlContainerGetPropertiesResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the SqlContainerGetResultsInner object itself. + */ + public SqlContainerGetResultsInner withResource(SqlContainerGetPropertiesResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlContainerGetProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Get the options property: The options property. + * + * @return the options value. + */ + public SqlContainerGetPropertiesOptions options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: The options property. + * + * @param options the options value to set. + * @return the SqlContainerGetResultsInner object itself. + */ + public SqlContainerGetResultsInner withOptions(SqlContainerGetPropertiesOptions options) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlContainerGetProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlDatabaseCreateUpdateProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlDatabaseCreateUpdateProperties.java new file mode 100644 index 0000000000000..a533a71e3c757 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlDatabaseCreateUpdateProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.SqlDatabaseResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties to create and update Azure Cosmos DB SQL database. */ +@Fluent +public final class SqlDatabaseCreateUpdateProperties { + /* + * The standard JSON format of a SQL database + */ + @JsonProperty(value = "resource", required = true) + private SqlDatabaseResource resource; + + /* + * A key-value pair of options to be applied for the request. This corresponds to the headers sent with the + * request. + */ + @JsonProperty(value = "options") + private CreateUpdateOptions options; + + /** 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 + .logExceptionAsError( + 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); +} 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..0db8b73edfdf6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlDatabaseGetProperties.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.SqlDatabaseGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.SqlDatabaseGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an Azure Cosmos DB SQL database. */ +@Fluent +public final class SqlDatabaseGetProperties { + /* + * The resource property. + */ + @JsonProperty(value = "resource") + private SqlDatabaseGetPropertiesResource resource; + + /* + * The options property. + */ + @JsonProperty(value = "options") + 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(); + } + } +} 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..e69d44e4d40fe --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlDatabaseGetResultsInner.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.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.SqlDatabaseGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.SqlDatabaseGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; +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 + */ + @JsonProperty(value = "properties") + private SqlDatabaseGetProperties innerProperties; + + /** 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; + } + + /** {@inheritDoc} */ + @Override + public SqlDatabaseGetResultsInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlDatabaseGetResultsInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public SqlDatabaseGetPropertiesResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the SqlDatabaseGetResultsInner object itself. + */ + public SqlDatabaseGetResultsInner withResource(SqlDatabaseGetPropertiesResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlDatabaseGetProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Get the options property: The options property. + * + * @return the options value. + */ + public SqlDatabaseGetPropertiesOptions options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: The options property. + * + * @param options the options value to set. + * @return the SqlDatabaseGetResultsInner object itself. + */ + public SqlDatabaseGetResultsInner withOptions(SqlDatabaseGetPropertiesOptions options) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlDatabaseGetProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlRoleAssignmentGetResultsInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlRoleAssignmentGetResultsInner.java new file mode 100644 index 0000000000000..6e8fa43d9d1a2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlRoleAssignmentGetResultsInner.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.ArmProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An Azure Cosmos DB Role Assignment. */ +@Fluent +public final class SqlRoleAssignmentGetResultsInner extends ArmProxyResource { + /* + * Properties related to the Role Assignment. + */ + @JsonProperty(value = "properties") + private SqlRoleAssignmentResource innerProperties; + + /** 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 roleDefinitionId property: The unique identifier for the associated Role Definition. + * + * @return the roleDefinitionId value. + */ + public String roleDefinitionId() { + return this.innerProperties() == null ? null : this.innerProperties().roleDefinitionId(); + } + + /** + * Set the roleDefinitionId property: The unique identifier for the associated Role Definition. + * + * @param roleDefinitionId the roleDefinitionId value to set. + * @return the SqlRoleAssignmentGetResultsInner object itself. + */ + public SqlRoleAssignmentGetResultsInner withRoleDefinitionId(String roleDefinitionId) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlRoleAssignmentResource(); + } + this.innerProperties().withRoleDefinitionId(roleDefinitionId); + return this; + } + + /** + * Get the scope property: The data plane resource path for which access is being granted through this Role + * Assignment. + * + * @return the scope value. + */ + public String scope() { + return this.innerProperties() == null ? null : this.innerProperties().scope(); + } + + /** + * Set the scope property: The data plane resource path for which access is being granted through this Role + * Assignment. + * + * @param scope the scope value to set. + * @return the SqlRoleAssignmentGetResultsInner object itself. + */ + public SqlRoleAssignmentGetResultsInner withScope(String scope) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlRoleAssignmentResource(); + } + this.innerProperties().withScope(scope); + return this; + } + + /** + * Get the principalId property: The unique identifier for the associated AAD principal in the AAD graph to which + * access is being granted through this Role Assignment. Tenant ID for the principal is inferred using the tenant + * associated with the subscription. + * + * @return the principalId value. + */ + public String principalId() { + return this.innerProperties() == null ? null : this.innerProperties().principalId(); + } + + /** + * Set the principalId property: The unique identifier for the associated AAD principal in the AAD graph to which + * access is being granted through this Role Assignment. Tenant ID for the principal is inferred using the tenant + * associated with the subscription. + * + * @param principalId the principalId value to set. + * @return the SqlRoleAssignmentGetResultsInner object itself. + */ + public SqlRoleAssignmentGetResultsInner withPrincipalId(String principalId) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlRoleAssignmentResource(); + } + this.innerProperties().withPrincipalId(principalId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlRoleAssignmentResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlRoleAssignmentResource.java new file mode 100644 index 0000000000000..4289b0b12ec85 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlRoleAssignmentResource.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Azure Cosmos DB SQL Role Assignment resource object. */ +@Fluent +public final class SqlRoleAssignmentResource { + /* + * The unique identifier for the associated Role Definition. + */ + @JsonProperty(value = "roleDefinitionId") + private String roleDefinitionId; + + /* + * The data plane resource path for which access is being granted through this Role Assignment. + */ + @JsonProperty(value = "scope") + private String scope; + + /* + * The unique identifier for the associated AAD principal in the AAD graph to which access is being granted through + * this Role Assignment. Tenant ID for the principal is inferred using the tenant associated with the subscription. + */ + @JsonProperty(value = "principalId") + private String principalId; + + /** 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() { + } +} 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..596b568ab9563 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlRoleDefinitionGetResultsInner.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.ArmProxyResource; +import com.azure.resourcemanager.cosmos.generated.models.Permission; +import com.azure.resourcemanager.cosmos.generated.models.RoleDefinitionType; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** An Azure Cosmos DB SQL Role Definition. */ +@Fluent +public final class SqlRoleDefinitionGetResultsInner extends ArmProxyResource { + /* + * Properties related to the Role Definition. + */ + @JsonProperty(value = "properties") + private SqlRoleDefinitionResource innerProperties; + + /** 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 roleName property: A user-friendly name for the Role Definition. Must be unique for the database account. + * + * @return the roleName value. + */ + public String roleName() { + return this.innerProperties() == null ? null : this.innerProperties().roleName(); + } + + /** + * Set the roleName property: A user-friendly name for the Role Definition. Must be unique for the database account. + * + * @param roleName the roleName value to set. + * @return the SqlRoleDefinitionGetResultsInner object itself. + */ + public SqlRoleDefinitionGetResultsInner withRoleName(String roleName) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlRoleDefinitionResource(); + } + this.innerProperties().withRoleName(roleName); + return this; + } + + /** + * Get the type property: Indicates whether the Role Definition was built-in or user created. + * + * @return the type value. + */ + public RoleDefinitionType typePropertiesType() { + return this.innerProperties() == null ? null : this.innerProperties().type(); + } + + /** + * Set the type property: Indicates whether the Role Definition was built-in or user created. + * + * @param type the type value to set. + * @return the SqlRoleDefinitionGetResultsInner object itself. + */ + public SqlRoleDefinitionGetResultsInner withTypePropertiesType(RoleDefinitionType type) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlRoleDefinitionResource(); + } + this.innerProperties().withType(type); + return this; + } + + /** + * Get the assignableScopes property: A set of fully qualified Scopes at or below which Role Assignments may be + * created using this Role Definition. This will allow application of this Role Definition on the entire database + * account or any underlying Database / Collection. Must have at least one element. Scopes higher than Database + * account are not enforceable as assignable Scopes. Note that resources referenced in assignable Scopes need not + * exist. + * + * @return the assignableScopes value. + */ + public List assignableScopes() { + return this.innerProperties() == null ? null : this.innerProperties().assignableScopes(); + } + + /** + * Set the assignableScopes property: A set of fully qualified Scopes at or below which Role Assignments may be + * created using this Role Definition. This will allow application of this Role Definition on the entire database + * account or any underlying Database / Collection. Must have at least one element. Scopes higher than Database + * account are not enforceable as assignable Scopes. Note that resources referenced in assignable Scopes need not + * exist. + * + * @param assignableScopes the assignableScopes value to set. + * @return the SqlRoleDefinitionGetResultsInner object itself. + */ + public SqlRoleDefinitionGetResultsInner withAssignableScopes(List assignableScopes) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlRoleDefinitionResource(); + } + this.innerProperties().withAssignableScopes(assignableScopes); + return this; + } + + /** + * Get the permissions property: The set of operations allowed through this Role Definition. + * + * @return the permissions value. + */ + public List permissions() { + return this.innerProperties() == null ? null : this.innerProperties().permissions(); + } + + /** + * Set the permissions property: The set of operations allowed through this Role Definition. + * + * @param permissions the permissions value to set. + * @return the SqlRoleDefinitionGetResultsInner object itself. + */ + public SqlRoleDefinitionGetResultsInner withPermissions(List permissions) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlRoleDefinitionResource(); + } + this.innerProperties().withPermissions(permissions); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlRoleDefinitionResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlRoleDefinitionResource.java new file mode 100644 index 0000000000000..ed0d997f60776 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlRoleDefinitionResource.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.Permission; +import com.azure.resourcemanager.cosmos.generated.models.RoleDefinitionType; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Azure Cosmos DB SQL Role Definition resource object. */ +@Fluent +public final class SqlRoleDefinitionResource { + /* + * A user-friendly name for the Role Definition. Must be unique for the database account. + */ + @JsonProperty(value = "roleName") + private String roleName; + + /* + * Indicates whether the Role Definition was built-in or user created. + */ + @JsonProperty(value = "type") + private RoleDefinitionType type; + + /* + * A set of fully qualified Scopes at or below which Role Assignments may be created using this Role Definition. + * This will allow application of this Role Definition on the entire database account or any underlying Database / + * Collection. Must have at least one element. Scopes higher than Database account are not enforceable as + * assignable Scopes. Note that resources referenced in assignable Scopes need not exist. + */ + @JsonProperty(value = "assignableScopes") + private List assignableScopes; + + /* + * The set of operations allowed through this Role Definition. + */ + @JsonProperty(value = "permissions") + private List permissions; + + /** 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()); + } + } +} 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..76b9f139901c4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlStoredProcedureCreateUpdateProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.SqlStoredProcedureResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties to create and update Azure Cosmos DB storedProcedure. */ +@Fluent +public final class SqlStoredProcedureCreateUpdateProperties { + /* + * The standard JSON format of a storedProcedure + */ + @JsonProperty(value = "resource", required = true) + private SqlStoredProcedureResource resource; + + /* + * A key-value pair of options to be applied for the request. This corresponds to the headers sent with the + * request. + */ + @JsonProperty(value = "options") + private CreateUpdateOptions options; + + /** 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 + .logExceptionAsError( + 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); +} 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..79029a56ff5f4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlStoredProcedureGetProperties.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.SqlStoredProcedureGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an Azure Cosmos DB StoredProcedure. */ +@Fluent +public final class SqlStoredProcedureGetProperties { + /* + * The resource property. + */ + @JsonProperty(value = "resource") + 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(); + } + } +} 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..bd1b9090b4e4f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlStoredProcedureGetResultsInner.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.SqlStoredProcedureGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An Azure Cosmos DB storedProcedure. */ +@Fluent +public final class SqlStoredProcedureGetResultsInner extends ArmResourceProperties { + /* + * The properties of an Azure Cosmos DB storedProcedure + */ + @JsonProperty(value = "properties") + private SqlStoredProcedureGetProperties innerProperties; + + /** 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; + } + + /** {@inheritDoc} */ + @Override + public SqlStoredProcedureGetResultsInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlStoredProcedureGetResultsInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public SqlStoredProcedureGetPropertiesResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the SqlStoredProcedureGetResultsInner object itself. + */ + public SqlStoredProcedureGetResultsInner withResource(SqlStoredProcedureGetPropertiesResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlStoredProcedureGetProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlTriggerCreateUpdateProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlTriggerCreateUpdateProperties.java new file mode 100644 index 0000000000000..81c499cfc4af7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlTriggerCreateUpdateProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.SqlTriggerResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties to create and update Azure Cosmos DB trigger. */ +@Fluent +public final class SqlTriggerCreateUpdateProperties { + /* + * The standard JSON format of a trigger + */ + @JsonProperty(value = "resource", required = true) + private SqlTriggerResource resource; + + /* + * A key-value pair of options to be applied for the request. This corresponds to the headers sent with the + * request. + */ + @JsonProperty(value = "options") + private CreateUpdateOptions options; + + /** 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 + .logExceptionAsError( + 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); +} 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..6eafa69a51dd3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlTriggerGetProperties.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.SqlTriggerGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an Azure Cosmos DB trigger. */ +@Fluent +public final class SqlTriggerGetProperties { + /* + * The resource property. + */ + @JsonProperty(value = "resource") + 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(); + } + } +} 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..37702105efff9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlTriggerGetResultsInner.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.SqlTriggerGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An Azure Cosmos DB trigger. */ +@Fluent +public final class SqlTriggerGetResultsInner extends ArmResourceProperties { + /* + * The properties of an Azure Cosmos DB trigger + */ + @JsonProperty(value = "properties") + private SqlTriggerGetProperties innerProperties; + + /** 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; + } + + /** {@inheritDoc} */ + @Override + public SqlTriggerGetResultsInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlTriggerGetResultsInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public SqlTriggerGetPropertiesResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the SqlTriggerGetResultsInner object itself. + */ + public SqlTriggerGetResultsInner withResource(SqlTriggerGetPropertiesResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlTriggerGetProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlUserDefinedFunctionCreateUpdateProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlUserDefinedFunctionCreateUpdateProperties.java new file mode 100644 index 0000000000000..93e971b9a0811 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlUserDefinedFunctionCreateUpdateProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.SqlUserDefinedFunctionResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties to create and update Azure Cosmos DB userDefinedFunction. */ +@Fluent +public final class SqlUserDefinedFunctionCreateUpdateProperties { + /* + * The standard JSON format of a userDefinedFunction + */ + @JsonProperty(value = "resource", required = true) + private SqlUserDefinedFunctionResource resource; + + /* + * A key-value pair of options to be applied for the request. This corresponds to the headers sent with the + * request. + */ + @JsonProperty(value = "options") + private CreateUpdateOptions options; + + /** 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 + .logExceptionAsError( + 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); +} 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..23a8fb720219b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlUserDefinedFunctionGetProperties.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.SqlUserDefinedFunctionGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an Azure Cosmos DB userDefinedFunction. */ +@Fluent +public final class SqlUserDefinedFunctionGetProperties { + /* + * The resource property. + */ + @JsonProperty(value = "resource") + 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(); + } + } +} 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..617474d8188af --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlUserDefinedFunctionGetResultsInner.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.SqlUserDefinedFunctionGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An Azure Cosmos DB userDefinedFunction. */ +@Fluent +public final class SqlUserDefinedFunctionGetResultsInner extends ArmResourceProperties { + /* + * The properties of an Azure Cosmos DB userDefinedFunction + */ + @JsonProperty(value = "properties") + private SqlUserDefinedFunctionGetProperties innerProperties; + + /** 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; + } + + /** {@inheritDoc} */ + @Override + public SqlUserDefinedFunctionGetResultsInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlUserDefinedFunctionGetResultsInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public SqlUserDefinedFunctionGetPropertiesResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the SqlUserDefinedFunctionGetResultsInner object itself. + */ + public SqlUserDefinedFunctionGetResultsInner withResource(SqlUserDefinedFunctionGetPropertiesResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlUserDefinedFunctionGetProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/TableCreateUpdateProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/TableCreateUpdateProperties.java new file mode 100644 index 0000000000000..358259f76f2c8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/TableCreateUpdateProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.TableResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties to create and update Azure Cosmos DB Table. */ +@Fluent +public final class TableCreateUpdateProperties { + /* + * The standard JSON format of a Table + */ + @JsonProperty(value = "resource", required = true) + private TableResource resource; + + /* + * A key-value pair of options to be applied for the request. This corresponds to the headers sent with the + * request. + */ + @JsonProperty(value = "options") + private CreateUpdateOptions options; + + /** 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 + .logExceptionAsError( + 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); +} 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..ee4d2d7636571 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/TableGetProperties.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.TableGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.TableGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an Azure Cosmos Table. */ +@Fluent +public final class TableGetProperties { + /* + * The resource property. + */ + @JsonProperty(value = "resource") + private TableGetPropertiesResource resource; + + /* + * The options property. + */ + @JsonProperty(value = "options") + 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(); + } + } +} 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..f2f1a1fc530ff --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/TableGetResultsInner.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.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.TableGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.TableGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An Azure Cosmos DB Table. */ +@Fluent +public final class TableGetResultsInner extends ArmResourceProperties { + /* + * The properties of an Azure Cosmos DB Table + */ + @JsonProperty(value = "properties") + private TableGetProperties innerProperties; + + /** 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; + } + + /** {@inheritDoc} */ + @Override + public TableGetResultsInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public TableGetResultsInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public TableGetPropertiesResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the TableGetResultsInner object itself. + */ + public TableGetResultsInner withResource(TableGetPropertiesResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new TableGetProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Get the options property: The options property. + * + * @return the options value. + */ + public TableGetPropertiesOptions options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: The options property. + * + * @param options the options value to set. + * @return the TableGetResultsInner object itself. + */ + public TableGetResultsInner withOptions(TableGetPropertiesOptions options) { + if (this.innerProperties() == null) { + this.innerProperties = new TableGetProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ThroughputSettingsGetProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ThroughputSettingsGetProperties.java new file mode 100644 index 0000000000000..b622d8bd80f9e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ThroughputSettingsGetProperties.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an Azure Cosmos DB resource throughput. */ +@Fluent +public final class ThroughputSettingsGetProperties { + /* + * The resource property. + */ + @JsonProperty(value = "resource") + 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(); + } + } +} 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..1c136532f1963 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ThroughputSettingsGetResultsInner.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; +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 + */ + @JsonProperty(value = "properties") + private ThroughputSettingsGetProperties innerProperties; + + /** 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; + } + + /** {@inheritDoc} */ + @Override + public ThroughputSettingsGetResultsInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ThroughputSettingsGetResultsInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public ThroughputSettingsGetPropertiesResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the ThroughputSettingsGetResultsInner object itself. + */ + public ThroughputSettingsGetResultsInner withResource(ThroughputSettingsGetPropertiesResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new ThroughputSettingsGetProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ThroughputSettingsUpdateProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ThroughputSettingsUpdateProperties.java new file mode 100644 index 0000000000000..f241f33501b10 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ThroughputSettingsUpdateProperties.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties to update Azure Cosmos DB resource throughput. */ +@Fluent +public final class ThroughputSettingsUpdateProperties { + /* + * The standard JSON format of a resource throughput + */ + @JsonProperty(value = "resource", required = true) + 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 + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property resource in model ThroughputSettingsUpdateProperties")); + } else { + resource().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ThroughputSettingsUpdateProperties.class); +} 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..e36684615358e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/UsageInner.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.cosmos.generated.models.MetricName; +import com.azure.resourcemanager.cosmos.generated.models.UnitType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The usage data for a usage request. */ +@Immutable +public class UsageInner { + /* + * The unit of the metric. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private UnitType unit; + + /* + * The name information for the metric. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private MetricName name; + + /* + * The quota period used to summarize the usage values. + */ + @JsonProperty(value = "quotaPeriod", access = JsonProperty.Access.WRITE_ONLY) + private String quotaPeriod; + + /* + * Maximum value for this metric + */ + @JsonProperty(value = "limit", access = JsonProperty.Access.WRITE_ONLY) + private Long limit; + + /* + * Current value for this metric + */ + @JsonProperty(value = "currentValue", access = JsonProperty.Access.WRITE_ONLY) + private Long currentValue; + + /** 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; + } + + /** + * Get the name property: The name information for the metric. + * + * @return the name value. + */ + public MetricName name() { + return this.name; + } + + /** + * Get the quotaPeriod property: The quota period used to summarize the usage values. + * + * @return the quotaPeriod value. + */ + public String quotaPeriod() { + return this.quotaPeriod; + } + + /** + * Get the limit property: Maximum value for this metric. + * + * @return the limit value. + */ + public Long limit() { + return this.limit; + } + + /** + * Get the currentValue property: Current value for this metric. + * + * @return the currentValue value. + */ + public Long currentValue() { + return this.currentValue; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() != null) { + name().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/package-info.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/package-info.java new file mode 100644 index 0000000000000..5140b0ddb6664 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the inner data models for CosmosDBManagementClient. Azure Cosmos DB Database Service Resource + * Provider REST API. + */ +package com.azure.resourcemanager.cosmos.generated.fluent.models; diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/package-info.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/package-info.java new file mode 100644 index 0000000000000..98db5a655ee9c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the service clients for CosmosDBManagementClient. Azure Cosmos DB Database Service Resource + * Provider REST API. + */ +package com.azure.resourcemanager.cosmos.generated.fluent; diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/BackupInformationImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/BackupInformationImpl.java new file mode 100644 index 0000000000000..0a04e870558a4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/BackupInformationImpl.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.BackupInformationInner; +import com.azure.resourcemanager.cosmos.generated.models.BackupInformation; +import com.azure.resourcemanager.cosmos.generated.models.ContinuousBackupInformation; + +public final class BackupInformationImpl implements BackupInformation { + private BackupInformationInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + BackupInformationImpl( + BackupInformationInner innerObject, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public ContinuousBackupInformation continuousBackupInformation() { + return this.innerModel().continuousBackupInformation(); + } + + public BackupInformationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/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..c7f92e5116f23 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraClusterPublicStatusImpl.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.CassandraClusterPublicStatusInner; +import com.azure.resourcemanager.cosmos.generated.models.CassandraClusterPublicStatus; +import com.azure.resourcemanager.cosmos.generated.models.CassandraClusterPublicStatusDataCentersItem; +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 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..50076a0b7412f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraClustersClientImpl.java @@ -0,0 +1,2322 @@ +// Copyright (c) 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..b579bac371ec7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraClustersImpl.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.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 Utils.mapPage(inner, inner1 -> new ClusterResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new ClusterResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new ClusterResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new ClusterResourceImpl(inner1, this.manager())); + } + + public 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 = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String clusterName = Utils.getValueFromIdByName(id, "cassandraClusters"); + if (clusterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'cassandraClusters'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, clusterName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String clusterName = Utils.getValueFromIdByName(id, "cassandraClusters"); + if (clusterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'cassandraClusters'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, clusterName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String clusterName = Utils.getValueFromIdByName(id, "cassandraClusters"); + if (clusterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'cassandraClusters'.", id))); + } + this.delete(resourceGroupName, clusterName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String clusterName = Utils.getValueFromIdByName(id, "cassandraClusters"); + if (clusterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'cassandraClusters'.", id))); + } + this.delete(resourceGroupName, clusterName, context); + } + + private CassandraClustersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + public ClusterResourceImpl define(String name) { + return new ClusterResourceImpl(name, this.manager()); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraDataCentersClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraDataCentersClientImpl.java new file mode 100644 index 0000000000000..801858a6d501e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraDataCentersClientImpl.java @@ -0,0 +1,1359 @@ +// Copyright (c) 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..a7741e7f0f6ee --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraDataCentersImpl.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.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 Utils.mapPage(inner, inner1 -> new DataCenterResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String clusterName, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, clusterName, context); + return Utils.mapPage(inner, inner1 -> new DataCenterResourceImpl(inner1, this.manager())); + } + + public 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 = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String clusterName = Utils.getValueFromIdByName(id, "cassandraClusters"); + if (clusterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'cassandraClusters'.", id))); + } + String dataCenterName = Utils.getValueFromIdByName(id, "dataCenters"); + if (dataCenterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'dataCenters'.", id))); + } + return this.getWithResponse(resourceGroupName, clusterName, dataCenterName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String clusterName = Utils.getValueFromIdByName(id, "cassandraClusters"); + if (clusterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'cassandraClusters'.", id))); + } + String dataCenterName = Utils.getValueFromIdByName(id, "dataCenters"); + if (dataCenterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'dataCenters'.", id))); + } + return this.getWithResponse(resourceGroupName, clusterName, dataCenterName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String clusterName = Utils.getValueFromIdByName(id, "cassandraClusters"); + if (clusterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'cassandraClusters'.", id))); + } + String dataCenterName = Utils.getValueFromIdByName(id, "dataCenters"); + if (dataCenterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'dataCenters'.", id))); + } + this.delete(resourceGroupName, clusterName, dataCenterName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String clusterName = Utils.getValueFromIdByName(id, "cassandraClusters"); + if (clusterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'cassandraClusters'.", id))); + } + String dataCenterName = Utils.getValueFromIdByName(id, "dataCenters"); + if (dataCenterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'dataCenters'.", id))); + } + this.delete(resourceGroupName, clusterName, dataCenterName, context); + } + + private CassandraDataCentersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + public DataCenterResourceImpl define(String name) { + return new DataCenterResourceImpl(name, this.manager()); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraKeyspaceGetResultsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraKeyspaceGetResultsImpl.java new file mode 100644 index 0000000000000..2d13ead05fb24 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraKeyspaceGetResultsImpl.java @@ -0,0 +1,236 @@ +// Copyright (c) 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 = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.keyspaceName = Utils.getValueFromIdByName(innerObject.id(), "cassandraKeyspaces"); + } + + public CassandraKeyspaceGetResults refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getCassandraResources() + .getCassandraKeyspaceWithResponse(resourceGroupName, accountName, keyspaceName, Context.NONE) + .getValue(); + return this; + } + + public CassandraKeyspaceGetResults refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCassandraResources() + .getCassandraKeyspaceWithResponse(resourceGroupName, accountName, keyspaceName, context) + .getValue(); + return this; + } + + public CassandraKeyspaceGetResultsImpl withRegion(Region location) { + this.createCreateUpdateCassandraKeyspaceParameters.withLocation(location.toString()); + return this; + } + + public CassandraKeyspaceGetResultsImpl withRegion(String location) { + this.createCreateUpdateCassandraKeyspaceParameters.withLocation(location); + return this; + } + + public CassandraKeyspaceGetResultsImpl withResource(CassandraKeyspaceResource resource) { + if (isInCreateMode()) { + this.createCreateUpdateCassandraKeyspaceParameters.withResource(resource); + return this; + } else { + this.updateCreateUpdateCassandraKeyspaceParameters.withResource(resource); + return this; + } + } + + public CassandraKeyspaceGetResultsImpl withTags(Map tags) { + if (isInCreateMode()) { + this.createCreateUpdateCassandraKeyspaceParameters.withTags(tags); + return this; + } else { + this.updateCreateUpdateCassandraKeyspaceParameters.withTags(tags); + return this; + } + } + + public CassandraKeyspaceGetResultsImpl 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..612dff4b3cb8c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraResourcesClientImpl.java @@ -0,0 +1,4555 @@ +// Copyright (c) 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..afeb782ccf0c7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraResourcesImpl.java @@ -0,0 +1,658 @@ +// Copyright (c) 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 Utils.mapPage(inner, inner1 -> new CassandraKeyspaceGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listCassandraKeyspaces( + String resourceGroupName, String accountName, Context context) { + PagedIterable inner = + this.serviceClient().listCassandraKeyspaces(resourceGroupName, accountName, context); + return Utils.mapPage(inner, inner1 -> new CassandraKeyspaceGetResultsImpl(inner1, this.manager())); + } + + public 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 Utils.mapPage(inner, inner1 -> new CassandraTableGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listCassandraTables( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + PagedIterable inner = + this.serviceClient().listCassandraTables(resourceGroupName, accountName, keyspaceName, context); + return Utils.mapPage(inner, inner1 -> new CassandraTableGetResultsImpl(inner1, this.manager())); + } + + public 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 = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String keyspaceName = Utils.getValueFromIdByName(id, "cassandraKeyspaces"); + if (keyspaceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'cassandraKeyspaces'.", id))); + } + return this + .getCassandraKeyspaceWithResponse(resourceGroupName, accountName, keyspaceName, Context.NONE) + .getValue(); + } + + public Response getCassandraKeyspaceByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String keyspaceName = Utils.getValueFromIdByName(id, "cassandraKeyspaces"); + if (keyspaceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'cassandraKeyspaces'.", id))); + } + return this.getCassandraKeyspaceWithResponse(resourceGroupName, accountName, keyspaceName, context); + } + + public CassandraTableGetResults getCassandraTableById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String keyspaceName = Utils.getValueFromIdByName(id, "cassandraKeyspaces"); + if (keyspaceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'cassandraKeyspaces'.", id))); + } + String tableName = Utils.getValueFromIdByName(id, "tables"); + if (tableName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tables'.", id))); + } + return this + .getCassandraTableWithResponse(resourceGroupName, accountName, keyspaceName, tableName, Context.NONE) + .getValue(); + } + + public Response getCassandraTableByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String keyspaceName = Utils.getValueFromIdByName(id, "cassandraKeyspaces"); + if (keyspaceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'cassandraKeyspaces'.", id))); + } + String tableName = Utils.getValueFromIdByName(id, "tables"); + if (tableName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tables'.", id))); + } + return this.getCassandraTableWithResponse(resourceGroupName, accountName, keyspaceName, tableName, context); + } + + public void deleteCassandraKeyspaceById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String keyspaceName = Utils.getValueFromIdByName(id, "cassandraKeyspaces"); + if (keyspaceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'cassandraKeyspaces'.", id))); + } + this.deleteCassandraKeyspace(resourceGroupName, accountName, keyspaceName, Context.NONE); + } + + public void deleteCassandraKeyspaceByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String keyspaceName = Utils.getValueFromIdByName(id, "cassandraKeyspaces"); + if (keyspaceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'cassandraKeyspaces'.", id))); + } + this.deleteCassandraKeyspace(resourceGroupName, accountName, keyspaceName, context); + } + + public void deleteCassandraTableById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String keyspaceName = Utils.getValueFromIdByName(id, "cassandraKeyspaces"); + if (keyspaceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'cassandraKeyspaces'.", id))); + } + String tableName = Utils.getValueFromIdByName(id, "tables"); + if (tableName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tables'.", id))); + } + this.deleteCassandraTable(resourceGroupName, accountName, keyspaceName, tableName, Context.NONE); + } + + public void deleteCassandraTableByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String keyspaceName = Utils.getValueFromIdByName(id, "cassandraKeyspaces"); + if (keyspaceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'cassandraKeyspaces'.", id))); + } + String tableName = Utils.getValueFromIdByName(id, "tables"); + if (tableName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tables'.", id))); + } + this.deleteCassandraTable(resourceGroupName, accountName, keyspaceName, tableName, context); + } + + 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..2d808e7425a34 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraTableGetResultsImpl.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.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 = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.keyspaceName = Utils.getValueFromIdByName(innerObject.id(), "cassandraKeyspaces"); + this.tableName = Utils.getValueFromIdByName(innerObject.id(), "tables"); + } + + public CassandraTableGetResults refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getCassandraResources() + .getCassandraTableWithResponse(resourceGroupName, accountName, keyspaceName, tableName, Context.NONE) + .getValue(); + return this; + } + + public CassandraTableGetResults refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCassandraResources() + .getCassandraTableWithResponse(resourceGroupName, accountName, keyspaceName, tableName, context) + .getValue(); + return this; + } + + public CassandraTableGetResultsImpl withRegion(Region location) { + this.createCreateUpdateCassandraTableParameters.withLocation(location.toString()); + return this; + } + + public CassandraTableGetResultsImpl withRegion(String location) { + this.createCreateUpdateCassandraTableParameters.withLocation(location); + return this; + } + + public CassandraTableGetResultsImpl withResource(CassandraTableResource resource) { + if (isInCreateMode()) { + this.createCreateUpdateCassandraTableParameters.withResource(resource); + return this; + } else { + this.updateCreateUpdateCassandraTableParameters.withResource(resource); + return this; + } + } + + public CassandraTableGetResultsImpl withTags(Map tags) { + if (isInCreateMode()) { + this.createCreateUpdateCassandraTableParameters.withTags(tags); + return this; + } else { + this.updateCreateUpdateCassandraTableParameters.withTags(tags); + return this; + } + } + + public CassandraTableGetResultsImpl 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..46f4c7bea0ba5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/ClientEncryptionKeyGetResultsImpl.java @@ -0,0 +1,189 @@ +// Copyright (c) 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 = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "sqlDatabases"); + this.clientEncryptionKeyName = Utils.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..d2e284f4a862c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/ClusterResourceImpl.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.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 = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.clusterName = Utils.getValueFromIdByName(innerObject.id(), "cassandraClusters"); + } + + public ClusterResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getCassandraClusters() + .getByResourceGroupWithResponse(resourceGroupName, clusterName, Context.NONE) + .getValue(); + return this; + } + + public ClusterResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCassandraClusters() + .getByResourceGroupWithResponse(resourceGroupName, clusterName, context) + .getValue(); + return this; + } + + public 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..3a09e0609a874 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionPartitionRegionsClientImpl.java @@ -0,0 +1,359 @@ +// Copyright (c) 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..ddc306559e40d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionPartitionRegionsImpl.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.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 Utils.mapPage(inner, inner1 -> new PartitionMetricImpl(inner1, this.manager())); + } + + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listMetrics(resourceGroupName, accountName, region, databaseRid, collectionRid, filter, context); + return Utils.mapPage(inner, inner1 -> new PartitionMetricImpl(inner1, this.manager())); + } + + private CollectionPartitionRegionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionPartitionsClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionPartitionsClientImpl.java new file mode 100644 index 0000000000000..90c4443cc9553 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionPartitionsClientImpl.java @@ -0,0 +1,595 @@ +// Copyright (c) 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..b92e68fe64e13 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionPartitionsImpl.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.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 Utils.mapPage(inner, inner1 -> new PartitionMetricImpl(inner1, this.manager())); + } + + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listMetrics(resourceGroupName, accountName, databaseRid, collectionRid, filter, context); + return Utils.mapPage(inner, inner1 -> new PartitionMetricImpl(inner1, this.manager())); + } + + public PagedIterable listUsages( + String resourceGroupName, String accountName, String databaseRid, String collectionRid) { + PagedIterable inner = + this.serviceClient().listUsages(resourceGroupName, accountName, databaseRid, collectionRid); + return Utils.mapPage(inner, inner1 -> new PartitionUsageImpl(inner1, this.manager())); + } + + public PagedIterable listUsages( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listUsages(resourceGroupName, accountName, databaseRid, collectionRid, filter, context); + return Utils.mapPage(inner, inner1 -> new PartitionUsageImpl(inner1, this.manager())); + } + + private CollectionPartitionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionRegionsClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionRegionsClientImpl.java new file mode 100644 index 0000000000000..c8e50d88d008d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionRegionsClientImpl.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.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..252e4412c6a47 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionRegionsImpl.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.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 Utils.mapPage(inner, inner1 -> new MetricImpl(inner1, this.manager())); + } + + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listMetrics(resourceGroupName, accountName, region, databaseRid, collectionRid, filter, context); + return Utils.mapPage(inner, inner1 -> new MetricImpl(inner1, this.manager())); + } + + private CollectionRegionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionsClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionsClientImpl.java new file mode 100644 index 0000000000000..7815fd91f1671 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionsClientImpl.java @@ -0,0 +1,816 @@ +// Copyright (c) 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..17b1cf495a48a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionsImpl.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.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 Utils.mapPage(inner, inner1 -> new MetricImpl(inner1, this.manager())); + } + + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listMetrics(resourceGroupName, accountName, databaseRid, collectionRid, filter, context); + return Utils.mapPage(inner, inner1 -> new MetricImpl(inner1, this.manager())); + } + + public PagedIterable listUsages( + String resourceGroupName, String accountName, String databaseRid, String collectionRid) { + PagedIterable inner = + this.serviceClient().listUsages(resourceGroupName, accountName, databaseRid, collectionRid); + return Utils.mapPage(inner, inner1 -> new UsageImpl(inner1, this.manager())); + } + + public PagedIterable listUsages( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listUsages(resourceGroupName, accountName, databaseRid, collectionRid, filter, context); + return Utils.mapPage(inner, inner1 -> new UsageImpl(inner1, this.manager())); + } + + public PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, String databaseRid, String collectionRid) { + PagedIterable inner = + this.serviceClient().listMetricDefinitions(resourceGroupName, accountName, databaseRid, collectionRid); + return Utils.mapPage(inner, inner1 -> new MetricDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, String databaseRid, String collectionRid, Context context) { + PagedIterable inner = + this + .serviceClient() + .listMetricDefinitions(resourceGroupName, accountName, databaseRid, collectionRid, context); + return Utils.mapPage(inner, inner1 -> new MetricDefinitionImpl(inner1, this.manager())); + } + + private CollectionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/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..52adcff1e164a --- /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..3518fbe7b745a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CosmosDBManagementClientBuilder.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.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, + 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..9ec5244f6dc15 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CosmosDBManagementClientImpl.java @@ -0,0 +1,794 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.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 = "2022-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(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..2677c59d5152b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DataCenterResourceImpl.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.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 = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.clusterName = Utils.getValueFromIdByName(innerObject.id(), "cassandraClusters"); + this.dataCenterName = Utils.getValueFromIdByName(innerObject.id(), "dataCenters"); + } + + public DataCenterResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getCassandraDataCenters() + .getWithResponse(resourceGroupName, clusterName, dataCenterName, Context.NONE) + .getValue(); + return this; + } + + public DataCenterResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCassandraDataCenters() + .getWithResponse(resourceGroupName, clusterName, dataCenterName, context) + .getValue(); + return this; + } + + public DataCenterResourceImpl withProperties(DataCenterResourceProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountGetResultsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountGetResultsImpl.java new file mode 100644 index 0000000000000..d1faa7de287be --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountGetResultsImpl.java @@ -0,0 +1,782 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.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 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 = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + } + + public DatabaseAccountGetResults refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseAccounts() + .getByResourceGroupWithResponse(resourceGroupName, accountName, Context.NONE) + .getValue(); + return this; + } + + public DatabaseAccountGetResults refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseAccounts() + .getByResourceGroupWithResponse(resourceGroupName, accountName, context) + .getValue(); + return this; + } + + public void failoverPriorityChange(FailoverPolicies failoverParameters) { + serviceManager.databaseAccounts().failoverPriorityChange(resourceGroupName, accountName, failoverParameters); + } + + public void failoverPriorityChange(FailoverPolicies failoverParameters, Context context) { + serviceManager + .databaseAccounts() + .failoverPriorityChange(resourceGroupName, accountName, failoverParameters, context); + } + + public 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; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountListConnectionStringsResultImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountListConnectionStringsResultImpl.java new file mode 100644 index 0000000000000..aae6831ee85da --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountListConnectionStringsResultImpl.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountListConnectionStringsResultInner; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountConnectionString; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountListConnectionStringsResult; +import java.util.Collections; +import java.util.List; + +public final class DatabaseAccountListConnectionStringsResultImpl + implements DatabaseAccountListConnectionStringsResult { + private DatabaseAccountListConnectionStringsResultInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + DatabaseAccountListConnectionStringsResultImpl( + DatabaseAccountListConnectionStringsResultInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List connectionStrings() { + List inner = this.innerModel().connectionStrings(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public DatabaseAccountListConnectionStringsResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountListKeysResultImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountListKeysResultImpl.java new file mode 100644 index 0000000000000..b7698d1acbe39 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountListKeysResultImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountListKeysResultInner; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountListKeysResult; + +public final class DatabaseAccountListKeysResultImpl implements DatabaseAccountListKeysResult { + private DatabaseAccountListKeysResultInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + DatabaseAccountListKeysResultImpl( + DatabaseAccountListKeysResultInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String primaryReadonlyMasterKey() { + return this.innerModel().primaryReadonlyMasterKey(); + } + + public String secondaryReadonlyMasterKey() { + return this.innerModel().secondaryReadonlyMasterKey(); + } + + public String primaryMasterKey() { + return this.innerModel().primaryMasterKey(); + } + + public String secondaryMasterKey() { + return this.innerModel().secondaryMasterKey(); + } + + public DatabaseAccountListKeysResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountListReadOnlyKeysResultImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountListReadOnlyKeysResultImpl.java new file mode 100644 index 0000000000000..237c67a6a6171 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountListReadOnlyKeysResultImpl.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountListReadOnlyKeysResultInner; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountListReadOnlyKeysResult; + +public final class DatabaseAccountListReadOnlyKeysResultImpl implements DatabaseAccountListReadOnlyKeysResult { + private DatabaseAccountListReadOnlyKeysResultInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + DatabaseAccountListReadOnlyKeysResultImpl( + DatabaseAccountListReadOnlyKeysResultInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String primaryReadonlyMasterKey() { + return this.innerModel().primaryReadonlyMasterKey(); + } + + public String secondaryReadonlyMasterKey() { + return this.innerModel().secondaryReadonlyMasterKey(); + } + + public DatabaseAccountListReadOnlyKeysResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountRegionsClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountRegionsClientImpl.java new file mode 100644 index 0000000000000..017a6e7a90495 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountRegionsClientImpl.java @@ -0,0 +1,288 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.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..8a6359050f0cf --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountRegionsImpl.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.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 Utils.mapPage(inner, inner1 -> new MetricImpl(inner1, this.manager())); + } + + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String region, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listMetrics(resourceGroupName, accountName, region, filter, context); + return Utils.mapPage(inner, inner1 -> new MetricImpl(inner1, this.manager())); + } + + private DatabaseAccountRegionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountsClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountsClientImpl.java new file mode 100644 index 0000000000000..fca4dd16515f8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountsClientImpl.java @@ -0,0 +1,3960 @@ +// Copyright (c) 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..ad5f3da04ff8e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountsImpl.java @@ -0,0 +1,388 @@ +// Copyright (c) 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 Utils.mapPage(inner, inner1 -> new DatabaseAccountGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new DatabaseAccountGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new DatabaseAccountGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new DatabaseAccountGetResultsImpl(inner1, this.manager())); + } + + public 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 Utils.mapPage(inner, inner1 -> new MetricImpl(inner1, this.manager())); + } + + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listMetrics(resourceGroupName, accountName, filter, context); + return Utils.mapPage(inner, inner1 -> new MetricImpl(inner1, this.manager())); + } + + public PagedIterable listUsages(String resourceGroupName, String accountName) { + PagedIterable inner = this.serviceClient().listUsages(resourceGroupName, accountName); + return Utils.mapPage(inner, inner1 -> new UsageImpl(inner1, this.manager())); + } + + public PagedIterable listUsages( + String resourceGroupName, String accountName, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listUsages(resourceGroupName, accountName, filter, context); + return Utils.mapPage(inner, inner1 -> new UsageImpl(inner1, this.manager())); + } + + public PagedIterable listMetricDefinitions(String resourceGroupName, String accountName) { + PagedIterable inner = + this.serviceClient().listMetricDefinitions(resourceGroupName, accountName); + return Utils.mapPage(inner, inner1 -> new MetricDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, Context context) { + PagedIterable inner = + this.serviceClient().listMetricDefinitions(resourceGroupName, accountName, context); + return Utils.mapPage(inner, inner1 -> new MetricDefinitionImpl(inner1, this.manager())); + } + + public DatabaseAccountGetResults getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, accountName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, accountName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + this.delete(resourceGroupName, accountName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + this.delete(resourceGroupName, accountName, context); + } + + private DatabaseAccountsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + public DatabaseAccountGetResultsImpl define(String name) { + return new DatabaseAccountGetResultsImpl(name, this.manager()); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/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..5f0c7c8d74903 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabasesClientImpl.java @@ -0,0 +1,723 @@ +// Copyright (c) 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..54fafdfdbd7e3 --- /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 Utils.mapPage(inner, inner1 -> new MetricImpl(inner1, this.manager())); + } + + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String databaseRid, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listMetrics(resourceGroupName, accountName, databaseRid, filter, context); + return Utils.mapPage(inner, inner1 -> new MetricImpl(inner1, this.manager())); + } + + public PagedIterable listUsages(String resourceGroupName, String accountName, String databaseRid) { + PagedIterable inner = this.serviceClient().listUsages(resourceGroupName, accountName, databaseRid); + return Utils.mapPage(inner, inner1 -> new UsageImpl(inner1, this.manager())); + } + + public PagedIterable listUsages( + String resourceGroupName, String accountName, String databaseRid, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listUsages(resourceGroupName, accountName, databaseRid, filter, context); + return Utils.mapPage(inner, inner1 -> new UsageImpl(inner1, this.manager())); + } + + public PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, String databaseRid) { + PagedIterable inner = + this.serviceClient().listMetricDefinitions(resourceGroupName, accountName, databaseRid); + return Utils.mapPage(inner, inner1 -> new MetricDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, String databaseRid, Context context) { + PagedIterable inner = + this.serviceClient().listMetricDefinitions(resourceGroupName, accountName, databaseRid, context); + return Utils.mapPage(inner, inner1 -> new MetricDefinitionImpl(inner1, this.manager())); + } + + private DatabasesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/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..65bd81ef82df1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/GremlinDatabaseGetResultsImpl.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.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 = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "gremlinDatabases"); + } + + public GremlinDatabaseGetResults refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getGremlinResources() + .getGremlinDatabaseWithResponse(resourceGroupName, accountName, databaseName, Context.NONE) + .getValue(); + return this; + } + + public GremlinDatabaseGetResults refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getGremlinResources() + .getGremlinDatabaseWithResponse(resourceGroupName, accountName, databaseName, context) + .getValue(); + return this; + } + + public GremlinDatabaseGetResultsImpl withRegion(Region location) { + this.createCreateUpdateGremlinDatabaseParameters.withLocation(location.toString()); + return this; + } + + public GremlinDatabaseGetResultsImpl withRegion(String location) { + this.createCreateUpdateGremlinDatabaseParameters.withLocation(location); + return this; + } + + public GremlinDatabaseGetResultsImpl withResource(GremlinDatabaseResource resource) { + if (isInCreateMode()) { + this.createCreateUpdateGremlinDatabaseParameters.withResource(resource); + return this; + } else { + this.updateCreateUpdateGremlinDatabaseParameters.withResource(resource); + return this; + } + } + + public GremlinDatabaseGetResultsImpl withTags(Map tags) { + if (isInCreateMode()) { + this.createCreateUpdateGremlinDatabaseParameters.withTags(tags); + return this; + } else { + this.updateCreateUpdateGremlinDatabaseParameters.withTags(tags); + return this; + } + } + + public GremlinDatabaseGetResultsImpl 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..dfab4ab3b9883 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/GremlinGraphGetResultsImpl.java @@ -0,0 +1,260 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.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 = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "gremlinDatabases"); + this.graphName = Utils.getValueFromIdByName(innerObject.id(), "graphs"); + } + + public GremlinGraphGetResults refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getGremlinResources() + .getGremlinGraphWithResponse(resourceGroupName, accountName, databaseName, graphName, Context.NONE) + .getValue(); + return this; + } + + public GremlinGraphGetResults refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getGremlinResources() + .getGremlinGraphWithResponse(resourceGroupName, accountName, databaseName, graphName, context) + .getValue(); + return this; + } + + public 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..285b4a2eca538 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/GremlinResourcesClientImpl.java @@ -0,0 +1,4923 @@ +// Copyright (c) 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..646cde00115f4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/GremlinResourcesImpl.java @@ -0,0 +1,691 @@ +// Copyright (c) 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 Utils.mapPage(inner, inner1 -> new GremlinDatabaseGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listGremlinDatabases( + String resourceGroupName, String accountName, Context context) { + PagedIterable inner = + this.serviceClient().listGremlinDatabases(resourceGroupName, accountName, context); + return Utils.mapPage(inner, inner1 -> new GremlinDatabaseGetResultsImpl(inner1, this.manager())); + } + + public 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 Utils.mapPage(inner, inner1 -> new GremlinGraphGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listGremlinGraphs( + String resourceGroupName, String accountName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listGremlinGraphs(resourceGroupName, accountName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new GremlinGraphGetResultsImpl(inner1, this.manager())); + } + + public 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 = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "gremlinDatabases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'gremlinDatabases'.", id))); + } + return this + .getGremlinDatabaseWithResponse(resourceGroupName, accountName, databaseName, Context.NONE) + .getValue(); + } + + public Response getGremlinDatabaseByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "gremlinDatabases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'gremlinDatabases'.", id))); + } + return this.getGremlinDatabaseWithResponse(resourceGroupName, accountName, databaseName, context); + } + + public GremlinGraphGetResults getGremlinGraphById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "gremlinDatabases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'gremlinDatabases'.", id))); + } + String graphName = Utils.getValueFromIdByName(id, "graphs"); + if (graphName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'graphs'.", id))); + } + return this + .getGremlinGraphWithResponse(resourceGroupName, accountName, databaseName, graphName, Context.NONE) + .getValue(); + } + + public Response getGremlinGraphByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "gremlinDatabases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'gremlinDatabases'.", id))); + } + String graphName = Utils.getValueFromIdByName(id, "graphs"); + if (graphName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'graphs'.", id))); + } + return this.getGremlinGraphWithResponse(resourceGroupName, accountName, databaseName, graphName, context); + } + + public void deleteGremlinDatabaseById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "gremlinDatabases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'gremlinDatabases'.", id))); + } + this.deleteGremlinDatabase(resourceGroupName, accountName, databaseName, Context.NONE); + } + + public void deleteGremlinDatabaseByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "gremlinDatabases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'gremlinDatabases'.", id))); + } + this.deleteGremlinDatabase(resourceGroupName, accountName, databaseName, context); + } + + public void deleteGremlinGraphById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "gremlinDatabases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'gremlinDatabases'.", id))); + } + String graphName = Utils.getValueFromIdByName(id, "graphs"); + if (graphName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'graphs'.", id))); + } + this.deleteGremlinGraph(resourceGroupName, accountName, databaseName, graphName, Context.NONE); + } + + public void deleteGremlinGraphByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "gremlinDatabases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'gremlinDatabases'.", id))); + } + String graphName = Utils.getValueFromIdByName(id, "graphs"); + if (graphName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'graphs'.", id))); + } + this.deleteGremlinGraph(resourceGroupName, accountName, databaseName, graphName, context); + } + + private GremlinResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + public GremlinDatabaseGetResultsImpl defineUpdateGremlinDatabase(String name) { + return new GremlinDatabaseGetResultsImpl(name, this.manager()); + } + + public GremlinGraphGetResultsImpl defineUpdateGremlinGraph(String name) { + return new GremlinGraphGetResultsImpl(name, this.manager()); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/LocationGetResultImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/LocationGetResultImpl.java new file mode 100644 index 0000000000000..19035aed67192 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/LocationGetResultImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.LocationGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.LocationGetResult; +import com.azure.resourcemanager.cosmos.generated.models.LocationProperties; + +public final class LocationGetResultImpl implements LocationGetResult { + private LocationGetResultInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + LocationGetResultImpl( + LocationGetResultInner innerObject, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public LocationProperties properties() { + return this.innerModel().properties(); + } + + public LocationGetResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/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..a55ed9a386d93 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/LocationsClientImpl.java @@ -0,0 +1,342 @@ +// Copyright (c) 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..adb9cb71d1523 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/LocationsImpl.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.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 Utils.mapPage(inner, inner1 -> new LocationGetResultImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new LocationGetResultImpl(inner1, this.manager())); + } + + public 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..3c7cc72920796 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MetricDefinitionImpl.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricDefinitionInner; +import com.azure.resourcemanager.cosmos.generated.models.MetricAvailability; +import com.azure.resourcemanager.cosmos.generated.models.MetricDefinition; +import com.azure.resourcemanager.cosmos.generated.models.MetricName; +import com.azure.resourcemanager.cosmos.generated.models.PrimaryAggregationType; +import com.azure.resourcemanager.cosmos.generated.models.UnitType; +import java.util.Collections; +import java.util.List; + +public final class MetricDefinitionImpl implements MetricDefinition { + private MetricDefinitionInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + MetricDefinitionImpl( + MetricDefinitionInner innerObject, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List metricAvailabilities() { + List inner = this.innerModel().metricAvailabilities(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public PrimaryAggregationType primaryAggregationType() { + return this.innerModel().primaryAggregationType(); + } + + public UnitType unit() { + return this.innerModel().unit(); + } + + public String resourceUri() { + return this.innerModel().resourceUri(); + } + + public MetricName name() { + return this.innerModel().name(); + } + + public MetricDefinitionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MetricImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MetricImpl.java new file mode 100644 index 0000000000000..5bc3bfac4391f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MetricImpl.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricInner; +import com.azure.resourcemanager.cosmos.generated.models.Metric; +import com.azure.resourcemanager.cosmos.generated.models.MetricName; +import com.azure.resourcemanager.cosmos.generated.models.MetricValue; +import com.azure.resourcemanager.cosmos.generated.models.UnitType; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class MetricImpl implements Metric { + private MetricInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + MetricImpl(MetricInner innerObject, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public OffsetDateTime endTime() { + return this.innerModel().endTime(); + } + + public String timeGrain() { + return this.innerModel().timeGrain(); + } + + public UnitType unit() { + return this.innerModel().unit(); + } + + public MetricName name() { + return this.innerModel().name(); + } + + public List metricValues() { + List inner = this.innerModel().metricValues(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public MetricInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MongoDBCollectionGetResultsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MongoDBCollectionGetResultsImpl.java new file mode 100644 index 0000000000000..b0bacc0c5ea9a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MongoDBCollectionGetResultsImpl.java @@ -0,0 +1,263 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.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 = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "mongodbDatabases"); + this.collectionName = Utils.getValueFromIdByName(innerObject.id(), "collections"); + } + + public MongoDBCollectionGetResults refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getMongoDBResources() + .getMongoDBCollectionWithResponse( + resourceGroupName, accountName, databaseName, collectionName, Context.NONE) + .getValue(); + return this; + } + + public MongoDBCollectionGetResults refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getMongoDBResources() + .getMongoDBCollectionWithResponse(resourceGroupName, accountName, databaseName, collectionName, context) + .getValue(); + return this; + } + + public 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..d4fc43937294b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MongoDBDatabaseGetResultsImpl.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.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 = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "mongodbDatabases"); + } + + public MongoDBDatabaseGetResults refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getMongoDBResources() + .getMongoDBDatabaseWithResponse(resourceGroupName, accountName, databaseName, Context.NONE) + .getValue(); + return this; + } + + public MongoDBDatabaseGetResults refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getMongoDBResources() + .getMongoDBDatabaseWithResponse(resourceGroupName, accountName, databaseName, context) + .getValue(); + return this; + } + + public MongoDBDatabaseGetResultsImpl withRegion(Region location) { + this.createCreateUpdateMongoDBDatabaseParameters.withLocation(location.toString()); + return this; + } + + public MongoDBDatabaseGetResultsImpl withRegion(String location) { + this.createCreateUpdateMongoDBDatabaseParameters.withLocation(location); + return this; + } + + public MongoDBDatabaseGetResultsImpl withResource(MongoDBDatabaseResource resource) { + if (isInCreateMode()) { + this.createCreateUpdateMongoDBDatabaseParameters.withResource(resource); + return this; + } else { + this.updateCreateUpdateMongoDBDatabaseParameters.withResource(resource); + return this; + } + } + + public MongoDBDatabaseGetResultsImpl withTags(Map tags) { + if (isInCreateMode()) { + this.createCreateUpdateMongoDBDatabaseParameters.withTags(tags); + return this; + } else { + this.updateCreateUpdateMongoDBDatabaseParameters.withTags(tags); + return this; + } + } + + public MongoDBDatabaseGetResultsImpl 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..45a4db27df2b1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MongoDBResourcesClientImpl.java @@ -0,0 +1,7029 @@ +// Copyright (c) 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..e2fac1fb4e6c1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MongoDBResourcesImpl.java @@ -0,0 +1,1067 @@ +// Copyright (c) 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 Utils.mapPage(inner, inner1 -> new MongoDBDatabaseGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listMongoDBDatabases( + String resourceGroupName, String accountName, Context context) { + PagedIterable inner = + this.serviceClient().listMongoDBDatabases(resourceGroupName, accountName, context); + return Utils.mapPage(inner, inner1 -> new MongoDBDatabaseGetResultsImpl(inner1, this.manager())); + } + + public 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 Utils.mapPage(inner, inner1 -> new MongoDBCollectionGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listMongoDBCollections( + String resourceGroupName, String accountName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listMongoDBCollections(resourceGroupName, accountName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new MongoDBCollectionGetResultsImpl(inner1, this.manager())); + } + + public 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 Utils.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 Utils.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 Utils.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 Utils.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 = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "mongodbDatabases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'mongodbDatabases'.", id))); + } + return this + .getMongoDBDatabaseWithResponse(resourceGroupName, accountName, databaseName, Context.NONE) + .getValue(); + } + + public Response getMongoDBDatabaseByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "mongodbDatabases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'mongodbDatabases'.", id))); + } + return this.getMongoDBDatabaseWithResponse(resourceGroupName, accountName, databaseName, context); + } + + public MongoDBCollectionGetResults getMongoDBCollectionById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "mongodbDatabases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'mongodbDatabases'.", id))); + } + String collectionName = Utils.getValueFromIdByName(id, "collections"); + if (collectionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'collections'.", id))); + } + return this + .getMongoDBCollectionWithResponse( + resourceGroupName, accountName, databaseName, collectionName, Context.NONE) + .getValue(); + } + + public Response getMongoDBCollectionByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "mongodbDatabases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'mongodbDatabases'.", id))); + } + String collectionName = Utils.getValueFromIdByName(id, "collections"); + if (collectionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'collections'.", id))); + } + return this + .getMongoDBCollectionWithResponse(resourceGroupName, accountName, databaseName, collectionName, context); + } + + public MongoRoleDefinitionGetResults getMongoRoleDefinitionById(String id) { + String mongoRoleDefinitionId = Utils.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 = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + return this + .getMongoRoleDefinitionWithResponse(mongoRoleDefinitionId, resourceGroupName, accountName, Context.NONE) + .getValue(); + } + + public Response getMongoRoleDefinitionByIdWithResponse(String id, Context context) { + String mongoRoleDefinitionId = Utils.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 = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + return this.getMongoRoleDefinitionWithResponse(mongoRoleDefinitionId, resourceGroupName, accountName, context); + } + + public MongoUserDefinitionGetResults getMongoUserDefinitionById(String id) { + String mongoUserDefinitionId = Utils.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 = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + return this + .getMongoUserDefinitionWithResponse(mongoUserDefinitionId, resourceGroupName, accountName, Context.NONE) + .getValue(); + } + + public Response getMongoUserDefinitionByIdWithResponse(String id, Context context) { + String mongoUserDefinitionId = Utils.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 = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + return this.getMongoUserDefinitionWithResponse(mongoUserDefinitionId, resourceGroupName, accountName, context); + } + + public void deleteMongoDBDatabaseById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "mongodbDatabases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'mongodbDatabases'.", id))); + } + this.deleteMongoDBDatabase(resourceGroupName, accountName, databaseName, Context.NONE); + } + + public void deleteMongoDBDatabaseByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "mongodbDatabases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'mongodbDatabases'.", id))); + } + this.deleteMongoDBDatabase(resourceGroupName, accountName, databaseName, context); + } + + public void deleteMongoDBCollectionById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "mongodbDatabases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'mongodbDatabases'.", id))); + } + String collectionName = Utils.getValueFromIdByName(id, "collections"); + if (collectionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'collections'.", id))); + } + this.deleteMongoDBCollection(resourceGroupName, accountName, databaseName, collectionName, Context.NONE); + } + + public void deleteMongoDBCollectionByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "mongodbDatabases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'mongodbDatabases'.", id))); + } + String collectionName = Utils.getValueFromIdByName(id, "collections"); + if (collectionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'collections'.", id))); + } + this.deleteMongoDBCollection(resourceGroupName, accountName, databaseName, collectionName, context); + } + + public void deleteMongoRoleDefinitionById(String id) { + String mongoRoleDefinitionId = Utils.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 = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + this.deleteMongoRoleDefinition(mongoRoleDefinitionId, resourceGroupName, accountName, Context.NONE); + } + + public void deleteMongoRoleDefinitionByIdWithResponse(String id, Context context) { + String mongoRoleDefinitionId = Utils.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 = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + this.deleteMongoRoleDefinition(mongoRoleDefinitionId, resourceGroupName, accountName, context); + } + + public void deleteMongoUserDefinitionById(String id) { + String mongoUserDefinitionId = Utils.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 = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + this.deleteMongoUserDefinition(mongoUserDefinitionId, resourceGroupName, accountName, Context.NONE); + } + + public void deleteMongoUserDefinitionByIdWithResponse(String id, Context context) { + String mongoUserDefinitionId = Utils.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 = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + this.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..010aeca84d1ca --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MongoRoleDefinitionGetResultsImpl.java @@ -0,0 +1,247 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.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 = Utils.getValueFromIdByName(innerObject.id(), "mongodbRoleDefinitions"); + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.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..4c0e108868c0d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MongoUserDefinitionGetResultsImpl.java @@ -0,0 +1,254 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.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 = Utils.getValueFromIdByName(innerObject.id(), "mongodbUserDefinitions"); + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.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..db8258369c3fb --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/NotebookWorkspaceConnectionInfoResultImpl.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.NotebookWorkspaceConnectionInfoResultInner; +import com.azure.resourcemanager.cosmos.generated.models.NotebookWorkspaceConnectionInfoResult; + +public final class NotebookWorkspaceConnectionInfoResultImpl implements NotebookWorkspaceConnectionInfoResult { + private NotebookWorkspaceConnectionInfoResultInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + NotebookWorkspaceConnectionInfoResultImpl( + NotebookWorkspaceConnectionInfoResultInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String authToken() { + return this.innerModel().authToken(); + } + + public String notebookServerEndpoint() { + return this.innerModel().notebookServerEndpoint(); + } + + public NotebookWorkspaceConnectionInfoResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/NotebookWorkspaceImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/NotebookWorkspaceImpl.java new file mode 100644 index 0000000000000..819533f44032a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/NotebookWorkspaceImpl.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.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 = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.notebookWorkspaceName = + NotebookWorkspaceName.fromString(Utils.getValueFromIdByName(innerObject.id(), "notebookWorkspaces")); + } + + public NotebookWorkspace refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getNotebookWorkspaces() + .getWithResponse(resourceGroupName, accountName, notebookWorkspaceName, Context.NONE) + .getValue(); + return this; + } + + public NotebookWorkspace refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getNotebookWorkspaces() + .getWithResponse(resourceGroupName, accountName, notebookWorkspaceName, context) + .getValue(); + return this; + } + + public 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..768fc425bcd5d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/NotebookWorkspacesClientImpl.java @@ -0,0 +1,1801 @@ +// Copyright (c) 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..e441a4419d4a0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/NotebookWorkspacesImpl.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.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 Utils.mapPage(inner, inner1 -> new NotebookWorkspaceImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabaseAccount( + String resourceGroupName, String accountName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabaseAccount(resourceGroupName, accountName, context); + return Utils.mapPage(inner, inner1 -> new NotebookWorkspaceImpl(inner1, this.manager())); + } + + public 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 = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String notebookWorkspaceNameLocal = Utils.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 = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String notebookWorkspaceNameLocal = Utils.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 = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String notebookWorkspaceNameLocal = Utils.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 = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String notebookWorkspaceNameLocal = Utils.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..202d50356b72d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/OperationImpl.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.OperationInner; +import com.azure.resourcemanager.cosmos.generated.models.Operation; +import com.azure.resourcemanager.cosmos.generated.models.OperationDisplay; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + OperationImpl( + OperationInner innerObject, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/OperationsClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..01c1c8152e99f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/OperationsClientImpl.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.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 + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Resource Provider operations 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 + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Resource Provider operations 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..73e530406d8c1 --- /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 Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionKeyRangeIdRegionsClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionKeyRangeIdRegionsClientImpl.java new file mode 100644 index 0000000000000..92954b6d69228 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionKeyRangeIdRegionsClientImpl.java @@ -0,0 +1,399 @@ +// Copyright (c) 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..7a7419a061d87 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionKeyRangeIdRegionsImpl.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.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 Utils.mapPage(inner, inner1 -> new PartitionMetricImpl(inner1, this.manager())); + } + + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listMetrics( + resourceGroupName, + accountName, + region, + databaseRid, + collectionRid, + partitionKeyRangeId, + filter, + context); + return Utils.mapPage(inner, inner1 -> new PartitionMetricImpl(inner1, this.manager())); + } + + private PartitionKeyRangeIdRegionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionKeyRangeIdsClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionKeyRangeIdsClientImpl.java new file mode 100644 index 0000000000000..2dcb915e3fc53 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionKeyRangeIdsClientImpl.java @@ -0,0 +1,362 @@ +// Copyright (c) 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..e6fce7b358015 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionKeyRangeIdsImpl.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.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 Utils.mapPage(inner, inner1 -> new PartitionMetricImpl(inner1, this.manager())); + } + + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listMetrics( + resourceGroupName, accountName, databaseRid, collectionRid, partitionKeyRangeId, filter, context); + return Utils.mapPage(inner, inner1 -> new PartitionMetricImpl(inner1, this.manager())); + } + + private PartitionKeyRangeIdsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionMetricImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionMetricImpl.java new file mode 100644 index 0000000000000..a0be4eaaa7ca9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionMetricImpl.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionMetricInner; +import com.azure.resourcemanager.cosmos.generated.models.MetricName; +import com.azure.resourcemanager.cosmos.generated.models.MetricValue; +import com.azure.resourcemanager.cosmos.generated.models.PartitionMetric; +import com.azure.resourcemanager.cosmos.generated.models.UnitType; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class PartitionMetricImpl implements PartitionMetric { + private PartitionMetricInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + PartitionMetricImpl( + PartitionMetricInner innerObject, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public OffsetDateTime endTime() { + return this.innerModel().endTime(); + } + + public String timeGrain() { + return this.innerModel().timeGrain(); + } + + public UnitType unit() { + return this.innerModel().unit(); + } + + public MetricName name() { + return this.innerModel().name(); + } + + public List metricValues() { + List inner = this.innerModel().metricValues(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String partitionId() { + return this.innerModel().partitionId(); + } + + public String partitionKeyRangeId() { + return this.innerModel().partitionKeyRangeId(); + } + + public PartitionMetricInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionUsageImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionUsageImpl.java new file mode 100644 index 0000000000000..ab62b6e3e8ef6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionUsageImpl.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionUsageInner; +import com.azure.resourcemanager.cosmos.generated.models.MetricName; +import com.azure.resourcemanager.cosmos.generated.models.PartitionUsage; +import com.azure.resourcemanager.cosmos.generated.models.UnitType; + +public final class PartitionUsageImpl implements PartitionUsage { + private PartitionUsageInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + PartitionUsageImpl( + PartitionUsageInner innerObject, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public UnitType unit() { + return this.innerModel().unit(); + } + + public MetricName name() { + return this.innerModel().name(); + } + + public String quotaPeriod() { + return this.innerModel().quotaPeriod(); + } + + public Long limit() { + return this.innerModel().limit(); + } + + public Long currentValue() { + return this.innerModel().currentValue(); + } + + public String partitionId() { + return this.innerModel().partitionId(); + } + + public String partitionKeyRangeId() { + return this.innerModel().partitionKeyRangeId(); + } + + public PartitionUsageInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileMetricImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileMetricImpl.java new file mode 100644 index 0000000000000..78b8913125f00 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileMetricImpl.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.PercentileMetricInner; +import com.azure.resourcemanager.cosmos.generated.models.MetricName; +import com.azure.resourcemanager.cosmos.generated.models.PercentileMetric; +import com.azure.resourcemanager.cosmos.generated.models.PercentileMetricValue; +import com.azure.resourcemanager.cosmos.generated.models.UnitType; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class PercentileMetricImpl implements PercentileMetric { + private PercentileMetricInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + PercentileMetricImpl( + PercentileMetricInner innerObject, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public OffsetDateTime endTime() { + return this.innerModel().endTime(); + } + + public String timeGrain() { + return this.innerModel().timeGrain(); + } + + public UnitType unit() { + return this.innerModel().unit(); + } + + public MetricName name() { + return this.innerModel().name(); + } + + public List metricValues() { + List inner = this.innerModel().metricValues(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public PercentileMetricInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileSourceTargetsClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileSourceTargetsClientImpl.java new file mode 100644 index 0000000000000..5f838b18b0d85 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileSourceTargetsClientImpl.java @@ -0,0 +1,342 @@ +// Copyright (c) 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..c49f359cea6a3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileSourceTargetsImpl.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.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 Utils.mapPage(inner, inner1 -> new PercentileMetricImpl(inner1, this.manager())); + } + + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String sourceRegion, + String targetRegion, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listMetrics(resourceGroupName, accountName, sourceRegion, targetRegion, filter, context); + return Utils.mapPage(inner, inner1 -> new PercentileMetricImpl(inner1, this.manager())); + } + + private PercentileSourceTargetsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileTargetsClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileTargetsClientImpl.java new file mode 100644 index 0000000000000..38497adcdddce --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileTargetsClientImpl.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.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..e7be53ee7fb50 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileTargetsImpl.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.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 Utils.mapPage(inner, inner1 -> new PercentileMetricImpl(inner1, this.manager())); + } + + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String targetRegion, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listMetrics(resourceGroupName, accountName, targetRegion, filter, context); + return Utils.mapPage(inner, inner1 -> new PercentileMetricImpl(inner1, this.manager())); + } + + private PercentileTargetsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentilesClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentilesClientImpl.java new file mode 100644 index 0000000000000..165e14b294aae --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentilesClientImpl.java @@ -0,0 +1,277 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.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..4c83e6df084c4 --- /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 Utils.mapPage(inner, inner1 -> new PercentileMetricImpl(inner1, this.manager())); + } + + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listMetrics(resourceGroupName, accountName, filter, context); + return Utils.mapPage(inner, inner1 -> new PercentileMetricImpl(inner1, this.manager())); + } + + private PercentilesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateEndpointConnectionImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateEndpointConnectionImpl.java new file mode 100644 index 0000000000000..12a319e1f9e3d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateEndpointConnectionImpl.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.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 = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.privateEndpointConnectionName = Utils.getValueFromIdByName(innerObject.id(), "privateEndpointConnections"); + } + + public PrivateEndpointConnection refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .getWithResponse(resourceGroupName, accountName, privateEndpointConnectionName, Context.NONE) + .getValue(); + return this; + } + + public PrivateEndpointConnection refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .getWithResponse(resourceGroupName, accountName, privateEndpointConnectionName, context) + .getValue(); + return this; + } + + public PrivateEndpointConnectionImpl withPrivateEndpoint(PrivateEndpointProperty privateEndpoint) { + this.innerModel().withPrivateEndpoint(privateEndpoint); + return this; + } + + public PrivateEndpointConnectionImpl withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState) { + this.innerModel().withPrivateLinkServiceConnectionState(privateLinkServiceConnectionState); + return this; + } + + public PrivateEndpointConnectionImpl withGroupId(String groupId) { + this.innerModel().withGroupId(groupId); + return this; + } + + public PrivateEndpointConnectionImpl withProvisioningState(String provisioningState) { + this.innerModel().withProvisioningState(provisioningState); + return this; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateEndpointConnectionsClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateEndpointConnectionsClientImpl.java new file mode 100644 index 0000000000000..c4161db3184aa --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateEndpointConnectionsClientImpl.java @@ -0,0 +1,1068 @@ +// Copyright (c) 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 A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection 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 A private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection 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 A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 A private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 A private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection 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 A private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection 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 A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner createOrUpdate( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + return createOrUpdateAsync(resourceGroupName, accountName, privateEndpointConnectionName, parameters).block(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters A private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner createOrUpdate( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, accountName, privateEndpointConnectionName, parameters, context) + .block(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@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..fb9221d684c89 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateEndpointConnectionsImpl.java @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.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 Utils.mapPage(inner, inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabaseAccount( + String resourceGroupName, String accountName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabaseAccount(resourceGroupName, accountName, context); + return Utils.mapPage(inner, inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())); + } + + public 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 = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + return this + .getWithResponse(resourceGroupName, accountName, privateEndpointConnectionName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + return this.getWithResponse(resourceGroupName, accountName, privateEndpointConnectionName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + this.delete(resourceGroupName, accountName, privateEndpointConnectionName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + this.delete(resourceGroupName, accountName, privateEndpointConnectionName, context); + } + + private PrivateEndpointConnectionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + public PrivateEndpointConnectionImpl define(String name) { + return new PrivateEndpointConnectionImpl(name, this.manager()); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateLinkResourceImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateLinkResourceImpl.java new file mode 100644 index 0000000000000..7c35846d0da78 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateLinkResourceImpl.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.cosmos.generated.models.PrivateLinkResource; +import java.util.Collections; +import java.util.List; + +public final class PrivateLinkResourceImpl implements PrivateLinkResource { + private PrivateLinkResourceInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + PrivateLinkResourceImpl( + PrivateLinkResourceInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String groupId() { + return this.innerModel().groupId(); + } + + public List requiredMembers() { + List inner = this.innerModel().requiredMembers(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List requiredZoneNames() { + List inner = this.innerModel().requiredZoneNames(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public PrivateLinkResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateLinkResourcesClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateLinkResourcesClientImpl.java new file mode 100644 index 0000000000000..397d75b117b3e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateLinkResourcesClientImpl.java @@ -0,0 +1,422 @@ +// Copyright (c) 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..45d09ae30888b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateLinkResourcesImpl.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.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 Utils.mapPage(inner, inner1 -> new PrivateLinkResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabaseAccount( + String resourceGroupName, String accountName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabaseAccount(resourceGroupName, accountName, context); + return Utils.mapPage(inner, inner1 -> new PrivateLinkResourceImpl(inner1, this.manager())); + } + + public 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/RestorableDatabaseAccountGetResultImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableDatabaseAccountGetResultImpl.java new file mode 100644 index 0000000000000..5d201b80c7fb8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableDatabaseAccountGetResultImpl.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableDatabaseAccountGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.ApiType; +import com.azure.resourcemanager.cosmos.generated.models.RestorableDatabaseAccountGetResult; +import com.azure.resourcemanager.cosmos.generated.models.RestorableLocationResource; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class RestorableDatabaseAccountGetResultImpl implements RestorableDatabaseAccountGetResult { + private RestorableDatabaseAccountGetResultInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + RestorableDatabaseAccountGetResultImpl( + RestorableDatabaseAccountGetResultInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public String accountName() { + return this.innerModel().accountName(); + } + + public OffsetDateTime creationTime() { + return this.innerModel().creationTime(); + } + + public OffsetDateTime deletionTime() { + return this.innerModel().deletionTime(); + } + + public ApiType apiType() { + return this.innerModel().apiType(); + } + + public List restorableLocations() { + List inner = this.innerModel().restorableLocations(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public RestorableDatabaseAccountGetResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableDatabaseAccountsClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableDatabaseAccountsClientImpl.java new file mode 100644 index 0000000000000..6da34c0968b38 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableDatabaseAccountsClientImpl.java @@ -0,0 +1,548 @@ +// Copyright (c) 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..096634e03abc0 --- /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 Utils.mapPage(inner, inner1 -> new RestorableDatabaseAccountGetResultImpl(inner1, this.manager())); + } + + public PagedIterable listByLocation(String location, Context context) { + PagedIterable inner = + this.serviceClient().listByLocation(location, context); + return Utils.mapPage(inner, inner1 -> new RestorableDatabaseAccountGetResultImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new RestorableDatabaseAccountGetResultImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new RestorableDatabaseAccountGetResultImpl(inner1, this.manager())); + } + + public 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..26d40f917f962 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableGremlinDatabaseGetResultImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.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..61520e004dbb6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableGremlinDatabasesClientImpl.java @@ -0,0 +1,258 @@ +// Copyright (c) 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..52ce836e62124 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableGremlinDatabasesImpl.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.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 Utils.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 Utils.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..dedb20b791792 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableGremlinGraphGetResultImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.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..3b307a99a24e9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableGremlinGraphsClientImpl.java @@ -0,0 +1,325 @@ +// Copyright (c) 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..491e76353676c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableGremlinGraphsImpl.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.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 Utils.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 Utils.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..3035986f6d031 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableGremlinResourcesClientImpl.java @@ -0,0 +1,298 @@ +// Copyright (c) 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..f8f2c2d6d1801 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableGremlinResourcesGetResultImpl.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.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..fbab65e0bfdbc --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableGremlinResourcesImpl.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.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 Utils.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 Utils.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..9ce2a7c08c85c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbCollectionGetResultImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableMongodbCollectionGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbCollectionGetResult; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbCollectionPropertiesResource; + +public final class RestorableMongodbCollectionGetResultImpl implements RestorableMongodbCollectionGetResult { + private RestorableMongodbCollectionGetResultInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + RestorableMongodbCollectionGetResultImpl( + RestorableMongodbCollectionGetResultInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public RestorableMongodbCollectionPropertiesResource resource() { + return this.innerModel().resource(); + } + + public RestorableMongodbCollectionGetResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbCollectionsClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbCollectionsClientImpl.java new file mode 100644 index 0000000000000..27a1224a984cb --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbCollectionsClientImpl.java @@ -0,0 +1,326 @@ +// Copyright (c) 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..eb87828846a5d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbCollectionsImpl.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.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 Utils.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 Utils.mapPage(inner, inner1 -> new RestorableMongodbCollectionGetResultImpl(inner1, this.manager())); + } + + private RestorableMongodbCollectionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbDatabaseGetResultImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbDatabaseGetResultImpl.java new file mode 100644 index 0000000000000..73b1aee282d2a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbDatabaseGetResultImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableMongodbDatabaseGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbDatabaseGetResult; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbDatabasePropertiesResource; + +public final class RestorableMongodbDatabaseGetResultImpl implements RestorableMongodbDatabaseGetResult { + private RestorableMongodbDatabaseGetResultInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + RestorableMongodbDatabaseGetResultImpl( + RestorableMongodbDatabaseGetResultInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public RestorableMongodbDatabasePropertiesResource resource() { + return this.innerModel().resource(); + } + + public RestorableMongodbDatabaseGetResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbDatabasesClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbDatabasesClientImpl.java new file mode 100644 index 0000000000000..b37f1a58efb15 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbDatabasesClientImpl.java @@ -0,0 +1,258 @@ +// Copyright (c) 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..a2b60d756ee1b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbDatabasesImpl.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.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 Utils.mapPage(inner, inner1 -> new RestorableMongodbDatabaseGetResultImpl(inner1, this.manager())); + } + + public PagedIterable list(String location, String instanceId, Context context) { + PagedIterable inner = + this.serviceClient().list(location, instanceId, context); + return Utils.mapPage(inner, inner1 -> new RestorableMongodbDatabaseGetResultImpl(inner1, this.manager())); + } + + private RestorableMongodbDatabasesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbResourcesClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbResourcesClientImpl.java new file mode 100644 index 0000000000000..944192fe4d511 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbResourcesClientImpl.java @@ -0,0 +1,298 @@ +// Copyright (c) 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..e94ca9965ea04 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbResourcesGetResultImpl.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.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..ab653c60c8ea2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbResourcesImpl.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.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 Utils.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 Utils.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..7a0629d1d88c2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlContainerGetResultImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableSqlContainerGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlContainerGetResult; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlContainerPropertiesResource; + +public final class RestorableSqlContainerGetResultImpl implements RestorableSqlContainerGetResult { + private RestorableSqlContainerGetResultInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + RestorableSqlContainerGetResultImpl( + RestorableSqlContainerGetResultInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public RestorableSqlContainerPropertiesResource resource() { + return this.innerModel().resource(); + } + + public RestorableSqlContainerGetResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlContainersClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlContainersClientImpl.java new file mode 100644 index 0000000000000..b587475265ea9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlContainersClientImpl.java @@ -0,0 +1,325 @@ +// Copyright (c) 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..d0aa899a85821 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlContainersImpl.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.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 Utils.mapPage(inner, inner1 -> new RestorableSqlContainerGetResultImpl(inner1, this.manager())); + } + + public PagedIterable list( + String location, + String instanceId, + String restorableSqlDatabaseRid, + String startTime, + String endTime, + Context context) { + PagedIterable inner = + this.serviceClient().list(location, instanceId, restorableSqlDatabaseRid, startTime, endTime, context); + return Utils.mapPage(inner, inner1 -> new RestorableSqlContainerGetResultImpl(inner1, this.manager())); + } + + private RestorableSqlContainersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlDatabaseGetResultImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlDatabaseGetResultImpl.java new file mode 100644 index 0000000000000..1bf685340975e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlDatabaseGetResultImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableSqlDatabaseGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlDatabaseGetResult; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlDatabasePropertiesResource; + +public final class RestorableSqlDatabaseGetResultImpl implements RestorableSqlDatabaseGetResult { + private RestorableSqlDatabaseGetResultInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + RestorableSqlDatabaseGetResultImpl( + RestorableSqlDatabaseGetResultInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public RestorableSqlDatabasePropertiesResource resource() { + return this.innerModel().resource(); + } + + public RestorableSqlDatabaseGetResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlDatabasesClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlDatabasesClientImpl.java new file mode 100644 index 0000000000000..6622d2d4eb839 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlDatabasesClientImpl.java @@ -0,0 +1,257 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.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..47ff3d8a1818d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlDatabasesImpl.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.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 Utils.mapPage(inner, inner1 -> new RestorableSqlDatabaseGetResultImpl(inner1, this.manager())); + } + + public PagedIterable list(String location, String instanceId, Context context) { + PagedIterable inner = + this.serviceClient().list(location, instanceId, context); + return Utils.mapPage(inner, inner1 -> new RestorableSqlDatabaseGetResultImpl(inner1, this.manager())); + } + + private RestorableSqlDatabasesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlResourcesClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlResourcesClientImpl.java new file mode 100644 index 0000000000000..007675901ea65 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlResourcesClientImpl.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.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..dc4d80c866d0e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlResourcesGetResultImpl.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.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..4790b943ccbf7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlResourcesImpl.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.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 Utils.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 Utils.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..64e72291dbe46 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableTableGetResultImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.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..d4109aefbbbe7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableTableResourcesClientImpl.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.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..6206ae9c898b5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableTableResourcesGetResultImpl.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.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..709764cd5450c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableTableResourcesImpl.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.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 Utils.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 Utils.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..2afed2ca913b8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableTablesClientImpl.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.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..a3c6d34cfacd3 --- /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 Utils.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 Utils.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..f7d94528cfd11 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/ServiceResourceImpl.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ServiceResourceInner; +import com.azure.resourcemanager.cosmos.generated.models.ServiceResource; +import com.azure.resourcemanager.cosmos.generated.models.ServiceResourceCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.ServiceResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.ServiceSize; +import com.azure.resourcemanager.cosmos.generated.models.ServiceType; + +public final class ServiceResourceImpl implements ServiceResource, ServiceResource.Definition { + private ServiceResourceInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + ServiceResourceImpl( + ServiceResourceInner innerObject, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public ServiceResourceProperties properties() { + return this.innerModel().properties(); + } + + public ServiceResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String accountName; + + private String serviceName; + + private ServiceResourceCreateUpdateParameters createCreateUpdateParameters; + + public ServiceResourceImpl withExistingDatabaseAccount(String resourceGroupName, String accountName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + return this; + } + + public ServiceResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getServices() + .create(resourceGroupName, accountName, serviceName, createCreateUpdateParameters, Context.NONE); + return this; + } + + public ServiceResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServices() + .create(resourceGroupName, accountName, serviceName, createCreateUpdateParameters, context); + return this; + } + + ServiceResourceImpl(String name, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = new ServiceResourceInner(); + this.serviceManager = serviceManager; + this.serviceName = name; + this.createCreateUpdateParameters = new ServiceResourceCreateUpdateParameters(); + } + + public ServiceResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getServices() + .getWithResponse(resourceGroupName, accountName, serviceName, Context.NONE) + .getValue(); + return this; + } + + public ServiceResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServices() + .getWithResponse(resourceGroupName, accountName, serviceName, context) + .getValue(); + return this; + } + + public ServiceResourceImpl withInstanceSize(ServiceSize instanceSize) { + this.createCreateUpdateParameters.withInstanceSize(instanceSize); + return this; + } + + public ServiceResourceImpl withInstanceCount(Integer instanceCount) { + this.createCreateUpdateParameters.withInstanceCount(instanceCount); + return this; + } + + public ServiceResourceImpl withServiceType(ServiceType serviceType) { + this.createCreateUpdateParameters.withServiceType(serviceType); + return this; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/ServicesClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/ServicesClientImpl.java new file mode 100644 index 0000000000000..b2f2f0b3e08b0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/ServicesClientImpl.java @@ -0,0 +1,1029 @@ +// Copyright (c) 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..846594f069f64 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/ServicesImpl.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.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 Utils.mapPage(inner, inner1 -> new ServiceResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String accountName, Context context) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, accountName, context); + return Utils.mapPage(inner, inner1 -> new ServiceResourceImpl(inner1, this.manager())); + } + + public 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 = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String serviceName = Utils.getValueFromIdByName(id, "services"); + if (serviceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + return this.getWithResponse(resourceGroupName, accountName, serviceName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String serviceName = Utils.getValueFromIdByName(id, "services"); + if (serviceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + return this.getWithResponse(resourceGroupName, accountName, serviceName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String serviceName = Utils.getValueFromIdByName(id, "services"); + if (serviceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + this.delete(resourceGroupName, accountName, serviceName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String serviceName = Utils.getValueFromIdByName(id, "services"); + if (serviceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + this.delete(resourceGroupName, accountName, serviceName, context); + } + + private ServicesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + public ServiceResourceImpl define(String name) { + return new ServiceResourceImpl(name, this.manager()); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlContainerGetResultsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlContainerGetResultsImpl.java new file mode 100644 index 0000000000000..ab3595d9a2f4e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlContainerGetResultsImpl.java @@ -0,0 +1,260 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.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 = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "sqlDatabases"); + this.containerName = Utils.getValueFromIdByName(innerObject.id(), "containers"); + } + + public SqlContainerGetResults refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .getSqlContainerWithResponse(resourceGroupName, accountName, databaseName, containerName, Context.NONE) + .getValue(); + return this; + } + + public SqlContainerGetResults refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .getSqlContainerWithResponse(resourceGroupName, accountName, databaseName, containerName, context) + .getValue(); + return this; + } + + public BackupInformation retrieveContinuousBackupInformation(ContinuousBackupRestoreLocation location) { + return serviceManager + .sqlResources() + .retrieveContinuousBackupInformation(resourceGroupName, accountName, databaseName, containerName, location); + } + + public BackupInformation retrieveContinuousBackupInformation( + ContinuousBackupRestoreLocation location, Context context) { + return serviceManager + .sqlResources() + .retrieveContinuousBackupInformation( + resourceGroupName, accountName, databaseName, containerName, location, context); + } + + public SqlContainerGetResultsImpl withRegion(Region location) { + this.createCreateUpdateSqlContainerParameters.withLocation(location.toString()); + return this; + } + + public SqlContainerGetResultsImpl withRegion(String location) { + this.createCreateUpdateSqlContainerParameters.withLocation(location); + return this; + } + + public SqlContainerGetResultsImpl withResource(SqlContainerResource resource) { + if (isInCreateMode()) { + this.createCreateUpdateSqlContainerParameters.withResource(resource); + return this; + } else { + this.updateCreateUpdateSqlContainerParameters.withResource(resource); + return this; + } + } + + public SqlContainerGetResultsImpl withTags(Map tags) { + if (isInCreateMode()) { + this.createCreateUpdateSqlContainerParameters.withTags(tags); + return this; + } else { + this.updateCreateUpdateSqlContainerParameters.withTags(tags); + return this; + } + } + + public SqlContainerGetResultsImpl 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..f5c2f77b0a344 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlDatabaseGetResultsImpl.java @@ -0,0 +1,227 @@ +// Copyright (c) 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 = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "sqlDatabases"); + } + + public SqlDatabaseGetResults refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .getSqlDatabaseWithResponse(resourceGroupName, accountName, databaseName, Context.NONE) + .getValue(); + return this; + } + + public SqlDatabaseGetResults refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .getSqlDatabaseWithResponse(resourceGroupName, accountName, databaseName, context) + .getValue(); + return this; + } + + public SqlDatabaseGetResultsImpl withRegion(Region location) { + this.createCreateUpdateSqlDatabaseParameters.withLocation(location.toString()); + return this; + } + + public SqlDatabaseGetResultsImpl withRegion(String location) { + this.createCreateUpdateSqlDatabaseParameters.withLocation(location); + return this; + } + + public SqlDatabaseGetResultsImpl withResource(SqlDatabaseResource resource) { + if (isInCreateMode()) { + this.createCreateUpdateSqlDatabaseParameters.withResource(resource); + return this; + } else { + this.updateCreateUpdateSqlDatabaseParameters.withResource(resource); + return this; + } + } + + public SqlDatabaseGetResultsImpl withTags(Map tags) { + if (isInCreateMode()) { + this.createCreateUpdateSqlDatabaseParameters.withTags(tags); + return this; + } else { + this.updateCreateUpdateSqlDatabaseParameters.withTags(tags); + return this; + } + } + + public SqlDatabaseGetResultsImpl 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..42bf56df53a95 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlResourcesClientImpl.java @@ -0,0 +1,11676 @@ +// Copyright (c) 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..1a60818e8ae03 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlResourcesImpl.java @@ -0,0 +1,1961 @@ +// Copyright (c) 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 Utils.mapPage(inner, inner1 -> new SqlDatabaseGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listSqlDatabases( + String resourceGroupName, String accountName, Context context) { + PagedIterable inner = + this.serviceClient().listSqlDatabases(resourceGroupName, accountName, context); + return Utils.mapPage(inner, inner1 -> new SqlDatabaseGetResultsImpl(inner1, this.manager())); + } + + public 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 Utils.mapPage(inner, inner1 -> new SqlContainerGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listSqlContainers( + String resourceGroupName, String accountName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listSqlContainers(resourceGroupName, accountName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new SqlContainerGetResultsImpl(inner1, this.manager())); + } + + public 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 Utils.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 Utils.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 Utils.mapPage(inner, inner1 -> new SqlStoredProcedureGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listSqlStoredProcedures( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + PagedIterable inner = + this + .serviceClient() + .listSqlStoredProcedures(resourceGroupName, accountName, databaseName, containerName, context); + return Utils.mapPage(inner, inner1 -> new SqlStoredProcedureGetResultsImpl(inner1, this.manager())); + } + + public 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 Utils.mapPage(inner, inner1 -> new SqlUserDefinedFunctionGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listSqlUserDefinedFunctions( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + PagedIterable inner = + this + .serviceClient() + .listSqlUserDefinedFunctions(resourceGroupName, accountName, databaseName, containerName, context); + return Utils.mapPage(inner, inner1 -> new SqlUserDefinedFunctionGetResultsImpl(inner1, this.manager())); + } + + public 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 Utils.mapPage(inner, inner1 -> new SqlTriggerGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listSqlTriggers( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + PagedIterable inner = + this.serviceClient().listSqlTriggers(resourceGroupName, accountName, databaseName, containerName, context); + return Utils.mapPage(inner, inner1 -> new SqlTriggerGetResultsImpl(inner1, this.manager())); + } + + public 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 Utils.mapPage(inner, inner1 -> new SqlRoleDefinitionGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listSqlRoleDefinitions( + String resourceGroupName, String accountName, Context context) { + PagedIterable inner = + this.serviceClient().listSqlRoleDefinitions(resourceGroupName, accountName, context); + return Utils.mapPage(inner, inner1 -> new SqlRoleDefinitionGetResultsImpl(inner1, this.manager())); + } + + public 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 Utils.mapPage(inner, inner1 -> new SqlRoleAssignmentGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listSqlRoleAssignments( + String resourceGroupName, String accountName, Context context) { + PagedIterable inner = + this.serviceClient().listSqlRoleAssignments(resourceGroupName, accountName, context); + return Utils.mapPage(inner, inner1 -> new SqlRoleAssignmentGetResultsImpl(inner1, this.manager())); + } + + public BackupInformation retrieveContinuousBackupInformation( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ContinuousBackupRestoreLocation location) { + BackupInformationInner inner = + this + .serviceClient() + .retrieveContinuousBackupInformation( + resourceGroupName, accountName, databaseName, containerName, location); + if (inner != null) { + return new BackupInformationImpl(inner, this.manager()); + } else { + return null; + } + } + + public BackupInformation retrieveContinuousBackupInformation( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ContinuousBackupRestoreLocation location, + Context context) { + BackupInformationInner inner = + this + .serviceClient() + .retrieveContinuousBackupInformation( + resourceGroupName, accountName, databaseName, containerName, location, context); + if (inner != null) { + return new BackupInformationImpl(inner, this.manager()); + } else { + return null; + } + } + + public SqlDatabaseGetResults getSqlDatabaseById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + return this.getSqlDatabaseWithResponse(resourceGroupName, accountName, databaseName, Context.NONE).getValue(); + } + + public Response getSqlDatabaseByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + return this.getSqlDatabaseWithResponse(resourceGroupName, accountName, databaseName, context); + } + + public SqlContainerGetResults getSqlContainerById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + return this + .getSqlContainerWithResponse(resourceGroupName, accountName, databaseName, containerName, Context.NONE) + .getValue(); + } + + public Response getSqlContainerByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + return this.getSqlContainerWithResponse(resourceGroupName, accountName, databaseName, containerName, context); + } + + public ClientEncryptionKeyGetResults getClientEncryptionKeyById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String clientEncryptionKeyName = Utils.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 = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String clientEncryptionKeyName = Utils.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 = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + String storedProcedureName = Utils.getValueFromIdByName(id, "storedProcedures"); + if (storedProcedureName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'storedProcedures'.", id))); + } + return this + .getSqlStoredProcedureWithResponse( + resourceGroupName, accountName, databaseName, containerName, storedProcedureName, Context.NONE) + .getValue(); + } + + public Response getSqlStoredProcedureByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + String storedProcedureName = Utils.getValueFromIdByName(id, "storedProcedures"); + if (storedProcedureName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'storedProcedures'.", id))); + } + return this + .getSqlStoredProcedureWithResponse( + resourceGroupName, accountName, databaseName, containerName, storedProcedureName, context); + } + + public SqlUserDefinedFunctionGetResults getSqlUserDefinedFunctionById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + String userDefinedFunctionName = Utils.getValueFromIdByName(id, "userDefinedFunctions"); + if (userDefinedFunctionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'userDefinedFunctions'.", + id))); + } + return this + .getSqlUserDefinedFunctionWithResponse( + resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, Context.NONE) + .getValue(); + } + + public Response getSqlUserDefinedFunctionByIdWithResponse( + String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + String userDefinedFunctionName = Utils.getValueFromIdByName(id, "userDefinedFunctions"); + if (userDefinedFunctionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'userDefinedFunctions'.", + id))); + } + return this + .getSqlUserDefinedFunctionWithResponse( + resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, context); + } + + public SqlTriggerGetResults getSqlTriggerById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + String triggerName = Utils.getValueFromIdByName(id, "triggers"); + if (triggerName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'triggers'.", id))); + } + return this + .getSqlTriggerWithResponse( + resourceGroupName, accountName, databaseName, containerName, triggerName, Context.NONE) + .getValue(); + } + + public Response getSqlTriggerByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + String triggerName = Utils.getValueFromIdByName(id, "triggers"); + if (triggerName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'triggers'.", id))); + } + return this + .getSqlTriggerWithResponse( + resourceGroupName, accountName, databaseName, containerName, triggerName, context); + } + + public SqlRoleDefinitionGetResults getSqlRoleDefinitionById(String id) { + String roleDefinitionId = Utils.getValueFromIdByName(id, "sqlRoleDefinitions"); + if (roleDefinitionId == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlRoleDefinitions'.", id))); + } + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + return this + .getSqlRoleDefinitionWithResponse(roleDefinitionId, resourceGroupName, accountName, Context.NONE) + .getValue(); + } + + public Response getSqlRoleDefinitionByIdWithResponse(String id, Context context) { + String roleDefinitionId = Utils.getValueFromIdByName(id, "sqlRoleDefinitions"); + if (roleDefinitionId == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlRoleDefinitions'.", id))); + } + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + return this.getSqlRoleDefinitionWithResponse(roleDefinitionId, resourceGroupName, accountName, context); + } + + public SqlRoleAssignmentGetResults getSqlRoleAssignmentById(String id) { + String roleAssignmentId = Utils.getValueFromIdByName(id, "sqlRoleAssignments"); + if (roleAssignmentId == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlRoleAssignments'.", id))); + } + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + return this + .getSqlRoleAssignmentWithResponse(roleAssignmentId, resourceGroupName, accountName, Context.NONE) + .getValue(); + } + + public Response getSqlRoleAssignmentByIdWithResponse(String id, Context context) { + String roleAssignmentId = Utils.getValueFromIdByName(id, "sqlRoleAssignments"); + if (roleAssignmentId == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlRoleAssignments'.", id))); + } + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + return this.getSqlRoleAssignmentWithResponse(roleAssignmentId, resourceGroupName, accountName, context); + } + + public void deleteSqlDatabaseById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + this.deleteSqlDatabase(resourceGroupName, accountName, databaseName, Context.NONE); + } + + public void deleteSqlDatabaseByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + this.deleteSqlDatabase(resourceGroupName, accountName, databaseName, context); + } + + public void deleteSqlContainerById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + this.deleteSqlContainer(resourceGroupName, accountName, databaseName, containerName, Context.NONE); + } + + public void deleteSqlContainerByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + this.deleteSqlContainer(resourceGroupName, accountName, databaseName, containerName, context); + } + + public void deleteSqlStoredProcedureById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + String storedProcedureName = Utils.getValueFromIdByName(id, "storedProcedures"); + if (storedProcedureName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'storedProcedures'.", id))); + } + this + .deleteSqlStoredProcedure( + resourceGroupName, accountName, databaseName, containerName, storedProcedureName, Context.NONE); + } + + public void deleteSqlStoredProcedureByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + String storedProcedureName = Utils.getValueFromIdByName(id, "storedProcedures"); + if (storedProcedureName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'storedProcedures'.", id))); + } + this + .deleteSqlStoredProcedure( + resourceGroupName, accountName, databaseName, containerName, storedProcedureName, context); + } + + public void deleteSqlUserDefinedFunctionById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + String userDefinedFunctionName = Utils.getValueFromIdByName(id, "userDefinedFunctions"); + if (userDefinedFunctionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'userDefinedFunctions'.", + id))); + } + this + .deleteSqlUserDefinedFunction( + resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, Context.NONE); + } + + public void deleteSqlUserDefinedFunctionByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + String userDefinedFunctionName = Utils.getValueFromIdByName(id, "userDefinedFunctions"); + if (userDefinedFunctionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'userDefinedFunctions'.", + id))); + } + this + .deleteSqlUserDefinedFunction( + resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, context); + } + + public void deleteSqlTriggerById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + String triggerName = Utils.getValueFromIdByName(id, "triggers"); + if (triggerName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'triggers'.", id))); + } + this.deleteSqlTrigger(resourceGroupName, accountName, databaseName, containerName, triggerName, Context.NONE); + } + + public void deleteSqlTriggerByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + String triggerName = Utils.getValueFromIdByName(id, "triggers"); + if (triggerName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'triggers'.", id))); + } + this.deleteSqlTrigger(resourceGroupName, accountName, databaseName, containerName, triggerName, context); + } + + public void deleteSqlRoleDefinitionById(String id) { + String roleDefinitionId = Utils.getValueFromIdByName(id, "sqlRoleDefinitions"); + if (roleDefinitionId == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlRoleDefinitions'.", id))); + } + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + this.deleteSqlRoleDefinition(roleDefinitionId, resourceGroupName, accountName, Context.NONE); + } + + public void deleteSqlRoleDefinitionByIdWithResponse(String id, Context context) { + String roleDefinitionId = Utils.getValueFromIdByName(id, "sqlRoleDefinitions"); + if (roleDefinitionId == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlRoleDefinitions'.", id))); + } + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + this.deleteSqlRoleDefinition(roleDefinitionId, resourceGroupName, accountName, context); + } + + public void deleteSqlRoleAssignmentById(String id) { + String roleAssignmentId = Utils.getValueFromIdByName(id, "sqlRoleAssignments"); + if (roleAssignmentId == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlRoleAssignments'.", id))); + } + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + this.deleteSqlRoleAssignment(roleAssignmentId, resourceGroupName, accountName, Context.NONE); + } + + public void deleteSqlRoleAssignmentByIdWithResponse(String id, Context context) { + String roleAssignmentId = Utils.getValueFromIdByName(id, "sqlRoleAssignments"); + if (roleAssignmentId == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlRoleAssignments'.", id))); + } + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + this.deleteSqlRoleAssignment(roleAssignmentId, resourceGroupName, accountName, context); + } + + private SqlResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + public SqlDatabaseGetResultsImpl defineUpdateSqlDatabase(String name) { + return new SqlDatabaseGetResultsImpl(name, this.manager()); + } + + public SqlContainerGetResultsImpl defineUpdateSqlContainer(String name) { + return new SqlContainerGetResultsImpl(name, this.manager()); + } + + public 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..d484c369b5830 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlRoleAssignmentGetResultsImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.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 = Utils.getValueFromIdByName(innerObject.id(), "sqlRoleAssignments"); + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + } + + public SqlRoleAssignmentGetResults refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .getSqlRoleAssignmentWithResponse(roleAssignmentId, resourceGroupName, accountName, Context.NONE) + .getValue(); + return this; + } + + public SqlRoleAssignmentGetResults refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .getSqlRoleAssignmentWithResponse(roleAssignmentId, resourceGroupName, accountName, context) + .getValue(); + return this; + } + + public SqlRoleAssignmentGetResultsImpl withRoleDefinitionId(String roleDefinitionId) { + if (isInCreateMode()) { + this.createCreateUpdateSqlRoleAssignmentParameters.withRoleDefinitionId(roleDefinitionId); + return this; + } else { + this.updateCreateUpdateSqlRoleAssignmentParameters.withRoleDefinitionId(roleDefinitionId); + return this; + } + } + + public SqlRoleAssignmentGetResultsImpl withScope(String scope) { + if (isInCreateMode()) { + this.createCreateUpdateSqlRoleAssignmentParameters.withScope(scope); + return this; + } else { + this.updateCreateUpdateSqlRoleAssignmentParameters.withScope(scope); + return this; + } + } + + public SqlRoleAssignmentGetResultsImpl withPrincipalId(String principalId) { + if (isInCreateMode()) { + this.createCreateUpdateSqlRoleAssignmentParameters.withPrincipalId(principalId); + return this; + } else { + this.updateCreateUpdateSqlRoleAssignmentParameters.withPrincipalId(principalId); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlRoleDefinitionGetResultsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlRoleDefinitionGetResultsImpl.java new file mode 100644 index 0000000000000..3d04261f43273 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlRoleDefinitionGetResultsImpl.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.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 = Utils.getValueFromIdByName(innerObject.id(), "sqlRoleDefinitions"); + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + } + + public SqlRoleDefinitionGetResults refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .getSqlRoleDefinitionWithResponse(roleDefinitionId, resourceGroupName, accountName, Context.NONE) + .getValue(); + return this; + } + + public SqlRoleDefinitionGetResults refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .getSqlRoleDefinitionWithResponse(roleDefinitionId, resourceGroupName, accountName, context) + .getValue(); + return this; + } + + public SqlRoleDefinitionGetResultsImpl withRoleName(String roleName) { + if (isInCreateMode()) { + this.createCreateUpdateSqlRoleDefinitionParameters.withRoleName(roleName); + return this; + } else { + this.updateCreateUpdateSqlRoleDefinitionParameters.withRoleName(roleName); + return this; + } + } + + public SqlRoleDefinitionGetResultsImpl withType(RoleDefinitionType type) { + if (isInCreateMode()) { + this.createCreateUpdateSqlRoleDefinitionParameters.withType(type); + return this; + } else { + this.updateCreateUpdateSqlRoleDefinitionParameters.withType(type); + return this; + } + } + + public SqlRoleDefinitionGetResultsImpl withAssignableScopes(List assignableScopes) { + if (isInCreateMode()) { + this.createCreateUpdateSqlRoleDefinitionParameters.withAssignableScopes(assignableScopes); + return this; + } else { + this.updateCreateUpdateSqlRoleDefinitionParameters.withAssignableScopes(assignableScopes); + return this; + } + } + + public SqlRoleDefinitionGetResultsImpl withPermissions(List permissions) { + if (isInCreateMode()) { + this.createCreateUpdateSqlRoleDefinitionParameters.withPermissions(permissions); + return this; + } else { + this.updateCreateUpdateSqlRoleDefinitionParameters.withPermissions(permissions); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlStoredProcedureGetResultsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlStoredProcedureGetResultsImpl.java new file mode 100644 index 0000000000000..8e3549e4787a8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlStoredProcedureGetResultsImpl.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.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 = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "sqlDatabases"); + this.containerName = Utils.getValueFromIdByName(innerObject.id(), "containers"); + this.storedProcedureName = Utils.getValueFromIdByName(innerObject.id(), "storedProcedures"); + } + + public SqlStoredProcedureGetResults refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .getSqlStoredProcedureWithResponse( + resourceGroupName, accountName, databaseName, containerName, storedProcedureName, Context.NONE) + .getValue(); + return this; + } + + public SqlStoredProcedureGetResults refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .getSqlStoredProcedureWithResponse( + resourceGroupName, accountName, databaseName, containerName, storedProcedureName, context) + .getValue(); + return this; + } + + public SqlStoredProcedureGetResultsImpl withRegion(Region location) { + this.createCreateUpdateSqlStoredProcedureParameters.withLocation(location.toString()); + return this; + } + + public SqlStoredProcedureGetResultsImpl withRegion(String location) { + this.createCreateUpdateSqlStoredProcedureParameters.withLocation(location); + return this; + } + + public SqlStoredProcedureGetResultsImpl withResource(SqlStoredProcedureResource resource) { + if (isInCreateMode()) { + this.createCreateUpdateSqlStoredProcedureParameters.withResource(resource); + return this; + } else { + this.updateCreateUpdateSqlStoredProcedureParameters.withResource(resource); + return this; + } + } + + public SqlStoredProcedureGetResultsImpl withTags(Map tags) { + if (isInCreateMode()) { + this.createCreateUpdateSqlStoredProcedureParameters.withTags(tags); + return this; + } else { + this.updateCreateUpdateSqlStoredProcedureParameters.withTags(tags); + return this; + } + } + + public SqlStoredProcedureGetResultsImpl 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..80849a24d5672 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlTriggerGetResultsImpl.java @@ -0,0 +1,249 @@ +// Copyright (c) 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 = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "sqlDatabases"); + this.containerName = Utils.getValueFromIdByName(innerObject.id(), "containers"); + this.triggerName = Utils.getValueFromIdByName(innerObject.id(), "triggers"); + } + + public SqlTriggerGetResults refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .getSqlTriggerWithResponse( + resourceGroupName, accountName, databaseName, containerName, triggerName, Context.NONE) + .getValue(); + return this; + } + + public SqlTriggerGetResults refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .getSqlTriggerWithResponse( + resourceGroupName, accountName, databaseName, containerName, triggerName, context) + .getValue(); + return this; + } + + public SqlTriggerGetResultsImpl withRegion(Region location) { + this.createCreateUpdateSqlTriggerParameters.withLocation(location.toString()); + return this; + } + + public SqlTriggerGetResultsImpl withRegion(String location) { + this.createCreateUpdateSqlTriggerParameters.withLocation(location); + return this; + } + + public SqlTriggerGetResultsImpl withResource(SqlTriggerResource resource) { + if (isInCreateMode()) { + this.createCreateUpdateSqlTriggerParameters.withResource(resource); + return this; + } else { + this.updateCreateUpdateSqlTriggerParameters.withResource(resource); + return this; + } + } + + public SqlTriggerGetResultsImpl withTags(Map tags) { + if (isInCreateMode()) { + this.createCreateUpdateSqlTriggerParameters.withTags(tags); + return this; + } else { + this.updateCreateUpdateSqlTriggerParameters.withTags(tags); + return this; + } + } + + public SqlTriggerGetResultsImpl 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..ac0adfe1c7bf0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlUserDefinedFunctionGetResultsImpl.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.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 = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "sqlDatabases"); + this.containerName = Utils.getValueFromIdByName(innerObject.id(), "containers"); + this.userDefinedFunctionName = Utils.getValueFromIdByName(innerObject.id(), "userDefinedFunctions"); + } + + public SqlUserDefinedFunctionGetResults refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .getSqlUserDefinedFunctionWithResponse( + resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, Context.NONE) + .getValue(); + return this; + } + + public SqlUserDefinedFunctionGetResults refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .getSqlUserDefinedFunctionWithResponse( + resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, context) + .getValue(); + return this; + } + + public SqlUserDefinedFunctionGetResultsImpl withRegion(Region location) { + this.createCreateUpdateSqlUserDefinedFunctionParameters.withLocation(location.toString()); + return this; + } + + public SqlUserDefinedFunctionGetResultsImpl withRegion(String location) { + this.createCreateUpdateSqlUserDefinedFunctionParameters.withLocation(location); + return this; + } + + public SqlUserDefinedFunctionGetResultsImpl withResource(SqlUserDefinedFunctionResource resource) { + if (isInCreateMode()) { + this.createCreateUpdateSqlUserDefinedFunctionParameters.withResource(resource); + return this; + } else { + this.updateCreateUpdateSqlUserDefinedFunctionParameters.withResource(resource); + return this; + } + } + + public SqlUserDefinedFunctionGetResultsImpl withTags(Map tags) { + if (isInCreateMode()) { + this.createCreateUpdateSqlUserDefinedFunctionParameters.withTags(tags); + return this; + } else { + this.updateCreateUpdateSqlUserDefinedFunctionParameters.withTags(tags); + return this; + } + } + + public SqlUserDefinedFunctionGetResultsImpl 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..58741f5653550 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/TableGetResultsImpl.java @@ -0,0 +1,232 @@ +// Copyright (c) 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 = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.tableName = Utils.getValueFromIdByName(innerObject.id(), "tables"); + } + + public TableGetResults refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getTableResources() + .getTableWithResponse(resourceGroupName, accountName, tableName, Context.NONE) + .getValue(); + return this; + } + + public TableGetResults refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getTableResources() + .getTableWithResponse(resourceGroupName, accountName, tableName, context) + .getValue(); + return this; + } + + public 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..64daaa8d4a1ee --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/TableResourcesClientImpl.java @@ -0,0 +1,2506 @@ +// Copyright (c) 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..dfe8d1caeb707 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/TableResourcesImpl.java @@ -0,0 +1,335 @@ +// Copyright (c) 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 Utils.mapPage(inner, inner1 -> new TableGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listTables(String resourceGroupName, String accountName, Context context) { + PagedIterable inner = + this.serviceClient().listTables(resourceGroupName, accountName, context); + return Utils.mapPage(inner, inner1 -> new TableGetResultsImpl(inner1, this.manager())); + } + + public 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 = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String tableName = Utils.getValueFromIdByName(id, "tables"); + if (tableName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tables'.", id))); + } + return this.getTableWithResponse(resourceGroupName, accountName, tableName, Context.NONE).getValue(); + } + + public Response getTableByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String tableName = Utils.getValueFromIdByName(id, "tables"); + if (tableName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tables'.", id))); + } + return this.getTableWithResponse(resourceGroupName, accountName, tableName, context); + } + + public void deleteTableById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String tableName = Utils.getValueFromIdByName(id, "tables"); + if (tableName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tables'.", id))); + } + this.deleteTable(resourceGroupName, accountName, tableName, Context.NONE); + } + + public void deleteTableByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String tableName = Utils.getValueFromIdByName(id, "tables"); + if (tableName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tables'.", id))); + } + this.deleteTable(resourceGroupName, accountName, tableName, context); + } + + private TableResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + public TableGetResultsImpl define(String name) { + return new TableGetResultsImpl(name, this.manager()); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/ThroughputSettingsGetResultsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/ThroughputSettingsGetResultsImpl.java new file mode 100644 index 0000000000000..531af19f9a919 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/ThroughputSettingsGetResultsImpl.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.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/Utils.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/Utils.java new file mode 100644 index 0000000000000..53dcdaab87f69 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/Utils.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class Utils { + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (segments.size() > 0 && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super( + PagedFlux + .create( + () -> + (continuationToken, pageSize) -> + Flux.fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> + new PagedResponseBase( + page.getRequest(), + page.getStatusCode(), + page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), + page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/package-info.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/package-info.java new file mode 100644 index 0000000000000..a96d554f105df --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the implementations for CosmosDBManagementClient. Azure Cosmos DB Database Service Resource + * Provider REST API. + */ +package com.azure.resourcemanager.cosmos.generated.implementation; diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/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..8d4a5505356fc --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AccountKeyMetadata.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The metadata related to an access key for a given database account. */ +@Immutable +public final class AccountKeyMetadata { + /* + * 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. + */ + @JsonProperty(value = "generationTime", access = JsonProperty.Access.WRITE_ONLY) + 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() { + } +} 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..ec45bb9168397 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AnalyticalStorageConfiguration.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Analytical storage specific properties. */ +@Fluent +public final class AnalyticalStorageConfiguration { + /* + * Describes the types of schema for analytical storage. + */ + @JsonProperty(value = "schemaType") + 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() { + } +} 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..996f5bf34742a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AnalyticalStorageSchemaType.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.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +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. + */ + @JsonCreator + 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..afb3eecb63ebb --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ApiProperties.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ApiProperties model. */ +@Fluent +public final class ApiProperties { + /* + * Describes the ServerVersion of an a MongoDB account. + */ + @JsonProperty(value = "serverVersion") + private ServerVersion serverVersion; + + /** Creates an instance of ApiProperties class. */ + public ApiProperties() { + } + + /** + * Get the serverVersion property: Describes the ServerVersion of an a MongoDB account. + * + * @return the serverVersion value. + */ + public ServerVersion serverVersion() { + return this.serverVersion; + } + + /** + * Set the serverVersion property: Describes the ServerVersion of an a MongoDB account. + * + * @param serverVersion the serverVersion value to set. + * @return the ApiProperties object itself. + */ + public ApiProperties withServerVersion(ServerVersion serverVersion) { + this.serverVersion = serverVersion; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ApiType.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ApiType.java new file mode 100644 index 0000000000000..35f9b80638f2e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ApiType.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.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +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. + */ + @JsonCreator + 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..0b190bcd0347d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ArmProxyResource.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; + +/** + * 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 { + /** Creates an instance of ArmProxyResource class. */ + public ArmProxyResource() { + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ArmResourceProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ArmResourceProperties.java new file mode 100644 index 0000000000000..cd146bf7e61d6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ArmResourceProperties.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import java.util.Map; + +/** The core properties of ARM resources. */ +@Fluent +public class ArmResourceProperties extends Resource { + /** Creates an instance of ArmResourceProperties class. */ + public ArmResourceProperties() { + } + + /** {@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() { + } +} 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..76a91e5048f09 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AuthenticationMethod.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 com.fasterxml.jackson.annotation.JsonCreator; +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"); + + /** + * 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. + */ + @JsonCreator + 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/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..4262efb2bc0e1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AutoUpgradePolicyResource.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB resource auto-upgrade policy. */ +@Fluent +public final class AutoUpgradePolicyResource { + /* + * Represents throughput policy which service must adhere to for auto-upgrade + */ + @JsonProperty(value = "throughputPolicy") + 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(); + } + } +} 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..db645a4783474 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AutoscaleSettings.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The AutoscaleSettings model. */ +@Fluent +public final class AutoscaleSettings { + /* + * Represents maximum throughput, the resource can scale up to. + */ + @JsonProperty(value = "maxThroughput") + 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() { + } +} 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..52e9621c14a55 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AutoscaleSettingsResource.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.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB provisioned throughput settings object. */ +@Fluent +public final class AutoscaleSettingsResource { + /* + * Represents maximum throughput container can scale up to. + */ + @JsonProperty(value = "maxThroughput", required = true) + private int maxThroughput; + + /* + * Cosmos DB resource auto-upgrade policy + */ + @JsonProperty(value = "autoUpgradePolicy") + private AutoUpgradePolicyResource autoUpgradePolicy; + + /* + * Represents target maximum throughput container can scale up to once offer is no longer in pending state. + */ + @JsonProperty(value = "targetMaxThroughput", access = JsonProperty.Access.WRITE_ONLY) + private Integer targetMaxThroughput; + + /** 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(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupInformation.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupInformation.java new file mode 100644 index 0000000000000..3010af64800e6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupInformation.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.BackupInformationInner; + +/** An immutable client-side representation of BackupInformation. */ +public interface BackupInformation { + /** + * Gets the continuousBackupInformation property: Information about the status of continuous backups. + * + * @return the continuousBackupInformation value. + */ + ContinuousBackupInformation continuousBackupInformation(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.BackupInformationInner object. + * + * @return the inner object. + */ + BackupInformationInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupPolicy.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupPolicy.java new file mode 100644 index 0000000000000..0ce5b6bb9037c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupPolicy.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The object representing the policy for taking backups on an account. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "type", + defaultImpl = BackupPolicy.class) +@JsonTypeName("BackupPolicy") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "Periodic", value = PeriodicModeBackupPolicy.class), + @JsonSubTypes.Type(name = "Continuous", value = ContinuousModeBackupPolicy.class) +}) +@Fluent +public class BackupPolicy { + /* + * The object representing the state of the migration between the backup policies. + */ + @JsonProperty(value = "migrationState") + private BackupPolicyMigrationState migrationState; + + /** Creates an instance of BackupPolicy class. */ + public BackupPolicy() { + } + + /** + * Get the migrationState property: The object representing the state of the migration between the backup policies. + * + * @return the migrationState value. + */ + public BackupPolicyMigrationState migrationState() { + return this.migrationState; + } + + /** + * Set the migrationState property: The object representing the state of the migration between the backup policies. + * + * @param migrationState the migrationState value to set. + * @return the BackupPolicy object itself. + */ + public BackupPolicy withMigrationState(BackupPolicyMigrationState migrationState) { + this.migrationState = migrationState; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (migrationState() != null) { + migrationState().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupPolicyMigrationState.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupPolicyMigrationState.java new file mode 100644 index 0000000000000..38674ecda664d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupPolicyMigrationState.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The object representing the state of the migration between the backup policies. */ +@Fluent +public final class BackupPolicyMigrationState { + /* + * Describes the status of migration between backup policy types. + */ + @JsonProperty(value = "status") + private BackupPolicyMigrationStatus status; + + /* + * Describes the target backup policy type of the backup policy migration. + */ + @JsonProperty(value = "targetType") + private BackupPolicyType targetType; + + /* + * Time at which the backup policy migration started (ISO-8601 format). + */ + @JsonProperty(value = "startTime") + private OffsetDateTime startTime; + + /** 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() { + } +} 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..5d95dc49704d0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupPolicyMigrationStatus.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +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. + */ + @JsonCreator + 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..34fc1cc526d2e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupPolicyType.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.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +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. + */ + @JsonCreator + 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..dfc0482c60674 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupStorageRedundancy.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +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. + */ + @JsonCreator + 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..77c32e0bf0612 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Capability.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB capability object. */ +@Fluent +public final class Capability { + /* + * Name of the Cosmos DB capability. For example, "name": "EnableCassandra". Current values also include + * "EnableTable" and "EnableGremlin". + */ + @JsonProperty(value = "name") + 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() { + } +} 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..c9549f66b3d47 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Capacity.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The object that represents all properties related to capacity enforcement on an account. */ +@Fluent +public final class Capacity { + /* + * 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. + */ + @JsonProperty(value = "totalThroughputLimit") + 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() { + } +} 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..ff0d66a14bf43 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraClusterPublicStatus.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.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 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..ab311c0cfb859 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraClusterPublicStatusDataCentersItem.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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The CassandraClusterPublicStatusDataCentersItem model. */ +@Fluent +public final class CassandraClusterPublicStatusDataCentersItem { + /* + * The name of this Datacenter. + */ + @JsonProperty(value = "name") + private String name; + + /* + * A list of all seed nodes in the cluster, managed and unmanaged. + */ + @JsonProperty(value = "seedNodes") + private List seedNodes; + + /* + * The nodes property. + */ + @JsonProperty(value = "nodes") + 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()); + } + } +} 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..9fc0d4baa1c4c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraClusterPublicStatusDataCentersItemNode.java @@ -0,0 +1,450 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The CassandraClusterPublicStatusDataCentersItemNode model. */ +@Fluent +public final class CassandraClusterPublicStatusDataCentersItemNode { + /* + * The node's IP address. + */ + @JsonProperty(value = "address") + private String address; + + /* + * The state of the node in Cassandra ring. + */ + @JsonProperty(value = "state") + private NodeState state; + + /* + * The status property. + */ + @JsonProperty(value = "status") + private String status; + + /* + * 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. + */ + @JsonProperty(value = "load") + private String load; + + /* + * List of tokens this node covers. + */ + @JsonProperty(value = "tokens") + private List tokens; + + /* + * The size property. + */ + @JsonProperty(value = "size") + private Integer size; + + /* + * The network ID of the node. + */ + @JsonProperty(value = "hostID") + private String hostId; + + /* + * The rack this node is part of. + */ + @JsonProperty(value = "rack") + private String rack; + + /* + * The timestamp when these statistics were captured. + */ + @JsonProperty(value = "timestamp") + private String timestamp; + + /* + * The amount of disk used, in kB, of the directory /var/lib/cassandra. + */ + @JsonProperty(value = "diskUsedKB") + private Long diskUsedKB; + + /* + * The amount of disk free, in kB, of the directory /var/lib/cassandra. + */ + @JsonProperty(value = "diskFreeKB") + private Long diskFreeKB; + + /* + * Used memory (calculated as total - free - buffers - cache), in kB. + */ + @JsonProperty(value = "memoryUsedKB") + 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. + */ + @JsonProperty(value = "memoryBuffersAndCachedKB") + private Long memoryBuffersAndCachedKB; + + /* + * Unused memory (MemFree and SwapFree in /proc/meminfo), in kB. + */ + @JsonProperty(value = "memoryFreeKB") + private Long memoryFreeKB; + + /* + * Total installed memory (MemTotal and SwapTotal in /proc/meminfo), in kB. + */ + @JsonProperty(value = "memoryTotalKB") + private Long memoryTotalKB; + + /* + * A float representing the current system-wide CPU utilization as a percentage. + */ + @JsonProperty(value = "cpuUsage") + 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 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() { + } +} 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..9106593fa34f4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraClusters.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.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..f2e6cbb6840f3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraDataCenters.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 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/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..e11ab20a4cdd4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceCreateUpdateParameters.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.CassandraKeyspaceCreateUpdateProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +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. + */ + @JsonProperty(value = "properties", required = true) + private CassandraKeyspaceCreateUpdateProperties innerProperties = new CassandraKeyspaceCreateUpdateProperties(); + + /** 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; + } + + /** {@inheritDoc} */ + @Override + public CassandraKeyspaceCreateUpdateParameters withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public CassandraKeyspaceCreateUpdateParameters withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The standard JSON format of a Cassandra keyspace. + * + * @return the resource value. + */ + public CassandraKeyspaceResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The standard JSON format of a Cassandra keyspace. + * + * @param resource the resource value to set. + * @return the CassandraKeyspaceCreateUpdateParameters object itself. + */ + public CassandraKeyspaceCreateUpdateParameters withResource(CassandraKeyspaceResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new CassandraKeyspaceCreateUpdateProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Get the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @return the options value. + */ + public CreateUpdateOptions options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @param options the options value to set. + * @return the CassandraKeyspaceCreateUpdateParameters object itself. + */ + public CassandraKeyspaceCreateUpdateParameters withOptions(CreateUpdateOptions options) { + if (this.innerProperties() == null) { + this.innerProperties = new CassandraKeyspaceCreateUpdateProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model CassandraKeyspaceCreateUpdateParameters")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CassandraKeyspaceCreateUpdateParameters.class); +} 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..08e4de3837a98 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceGetPropertiesOptions.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; + +/** 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() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceGetPropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceGetPropertiesResource.java new file mode 100644 index 0000000000000..df377c9bf1862 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceGetPropertiesResource.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The CassandraKeyspaceGetPropertiesResource model. */ +@Fluent +public final class CassandraKeyspaceGetPropertiesResource extends CassandraKeyspaceResource { + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** 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() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceGetResults.java new file mode 100644 index 0000000000000..2970bbcec7bfc --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceGetResults.java @@ -0,0 +1,259 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.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..2d2996057d995 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.cosmos.generated.fluent.models.CassandraKeyspaceGetResultsInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the Cassandra keyspaces and their properties. */ +@Immutable +public final class CassandraKeyspaceListResult { + /* + * List of Cassandra keyspaces and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + 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()); + } + } +} 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..8b638484b2e86 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceResource.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.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB Cassandra keyspace resource object. */ +@Fluent +public class CassandraKeyspaceResource { + /* + * Name of the Cosmos DB Cassandra keyspace + */ + @JsonProperty(value = "id", required = true) + 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 + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model CassandraKeyspaceResource")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CassandraKeyspaceResource.class); +} 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..cfc250980d179 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraPartitionKey.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB Cassandra table partition key. */ +@Fluent +public final class CassandraPartitionKey { + /* + * Name of the Cosmos DB Cassandra table partition key + */ + @JsonProperty(value = "name") + 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() { + } +} 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..3ff73c27b9180 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraResources.java @@ -0,0 +1,562 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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..deff31ae200f2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraSchema.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Cosmos DB Cassandra table schema. */ +@Fluent +public final class CassandraSchema { + /* + * List of Cassandra table columns. + */ + @JsonProperty(value = "columns") + private List columns; + + /* + * List of partition key. + */ + @JsonProperty(value = "partitionKeys") + private List partitionKeys; + + /* + * List of cluster key. + */ + @JsonProperty(value = "clusterKeys") + private List clusterKeys; + + /** 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()); + } + } +} 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..7118acb2eb478 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableCreateUpdateParameters.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.CassandraTableCreateUpdateProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +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. + */ + @JsonProperty(value = "properties", required = true) + private CassandraTableCreateUpdateProperties innerProperties = new CassandraTableCreateUpdateProperties(); + + /** 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; + } + + /** {@inheritDoc} */ + @Override + public CassandraTableCreateUpdateParameters withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public CassandraTableCreateUpdateParameters withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The standard JSON format of a Cassandra table. + * + * @return the resource value. + */ + public CassandraTableResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The standard JSON format of a Cassandra table. + * + * @param resource the resource value to set. + * @return the CassandraTableCreateUpdateParameters object itself. + */ + public CassandraTableCreateUpdateParameters withResource(CassandraTableResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new CassandraTableCreateUpdateProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Get the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @return the options value. + */ + public CreateUpdateOptions options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @param options the options value to set. + * @return the CassandraTableCreateUpdateParameters object itself. + */ + public CassandraTableCreateUpdateParameters withOptions(CreateUpdateOptions options) { + if (this.innerProperties() == null) { + this.innerProperties = new CassandraTableCreateUpdateProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model CassandraTableCreateUpdateParameters")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CassandraTableCreateUpdateParameters.class); +} 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..7320686ac8fd9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableGetPropertiesOptions.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; + +/** 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() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableGetPropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableGetPropertiesResource.java new file mode 100644 index 0000000000000..f211186e78e60 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableGetPropertiesResource.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.fasterxml.jackson.annotation.JsonProperty; + +/** The CassandraTableGetPropertiesResource model. */ +@Fluent +public final class CassandraTableGetPropertiesResource extends CassandraTableResource { + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** 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() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableGetResults.java new file mode 100644 index 0000000000000..4fcc676b42d00 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableGetResults.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.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..19e98c4642400 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.cosmos.generated.fluent.models.CassandraTableGetResultsInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the Cassandra tables and their properties. */ +@Immutable +public final class CassandraTableListResult { + /* + * List of Cassandra tables and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + 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()); + } + } +} 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..027ad2813cfaa --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableResource.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB Cassandra table resource object. */ +@Fluent +public class CassandraTableResource { + /* + * Name of the Cosmos DB Cassandra table + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * Time to live of the Cosmos DB Cassandra table + */ + @JsonProperty(value = "defaultTtl") + private Integer defaultTtl; + + /* + * Schema of the Cosmos DB Cassandra table + */ + @JsonProperty(value = "schema") + private CassandraSchema schema; + + /* + * Analytical TTL. + */ + @JsonProperty(value = "analyticalStorageTtl") + private Integer analyticalStorageTtl; + + /** 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 + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model CassandraTableResource")); + } + if (schema() != null) { + schema().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CassandraTableResource.class); +} 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..24c91516c2cda --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Certificate.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The Certificate model. */ +@Fluent +public final class Certificate { + /* + * PEM formatted public key. + */ + @JsonProperty(value = "pem") + 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() { + } +} 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..aae6a36825220 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClientEncryptionIncludedPath.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** . */ +@Fluent +public final class ClientEncryptionIncludedPath { + /* + * Path that needs to be encrypted. + */ + @JsonProperty(value = "path", required = true) + private String path; + + /* + * The identifier of the Client Encryption Key to be used to encrypt the path. + */ + @JsonProperty(value = "clientEncryptionKeyId", required = true) + private String clientEncryptionKeyId; + + /* + * The type of encryption to be performed. Eg - Deterministic, Randomized. + */ + @JsonProperty(value = "encryptionType", required = true) + private String encryptionType; + + /* + * The encryption algorithm which will be used. Eg - AEAD_AES_256_CBC_HMAC_SHA256. + */ + @JsonProperty(value = "encryptionAlgorithm", required = true) + 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 + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property path in model ClientEncryptionIncludedPath")); + } + if (clientEncryptionKeyId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property clientEncryptionKeyId in model ClientEncryptionIncludedPath")); + } + if (encryptionType() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property encryptionType in model ClientEncryptionIncludedPath")); + } + if (encryptionAlgorithm() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property encryptionAlgorithm in model ClientEncryptionIncludedPath")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ClientEncryptionIncludedPath.class); +} 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..026da5b04d737 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClientEncryptionKeyCreateUpdateParameters.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ClientEncryptionKeyCreateUpdateProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Parameters to create and update ClientEncryptionKey. */ +@Fluent +public final class ClientEncryptionKeyCreateUpdateParameters { + /* + * Properties to create and update ClientEncryptionKey. + */ + @JsonProperty(value = "properties", required = true) + 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 + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model" + + " ClientEncryptionKeyCreateUpdateParameters")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ClientEncryptionKeyCreateUpdateParameters.class); +} 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..a757b336c0fda --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClientEncryptionKeyGetPropertiesResource.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.fasterxml.jackson.annotation.JsonProperty; + +/** The ClientEncryptionKeyGetPropertiesResource model. */ +@Fluent +public final class ClientEncryptionKeyGetPropertiesResource extends ClientEncryptionKeyResource { + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** 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() { + super.validate(); + } +} 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..36109e7cdccc9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClientEncryptionKeyGetResults.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.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..d9650d95b2987 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClientEncryptionKeyResource.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.CoreUtils; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB client encryption key resource object. */ +@Fluent +public class ClientEncryptionKeyResource { + /* + * Name of the ClientEncryptionKey + */ + @JsonProperty(value = "id") + private String id; + + /* + * Encryption algorithm that will be used along with this client encryption key to encrypt/decrypt data. + */ + @JsonProperty(value = "encryptionAlgorithm") + private String encryptionAlgorithm; + + /* + * Wrapped (encrypted) form of the key represented as a byte array. + */ + @JsonProperty(value = "wrappedDataEncryptionKey") + private byte[] wrappedDataEncryptionKey; + + /* + * Metadata for the wrapping provider that can be used to unwrap the wrapped client encryption key. + */ + @JsonProperty(value = "keyWrapMetadata") + 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(); + } + } +} 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..66a58e54950d4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClientEncryptionKeysListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ClientEncryptionKeyGetResultsInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the client encryption keys and their properties. */ +@Immutable +public final class ClientEncryptionKeysListResult { + /* + * List of client encryption keys and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + 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()); + } + } +} 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..89767577ab337 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClientEncryptionPolicy.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Cosmos DB client encryption policy. */ +@Fluent +public final class ClientEncryptionPolicy { + /* + * Paths of the item that need encryption along with path-specific settings. + */ + @JsonProperty(value = "includedPaths", required = true) + 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. + */ + @JsonProperty(value = "policyFormatVersion", required = true) + 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 + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property includedPaths in model ClientEncryptionPolicy")); + } else { + includedPaths().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ClientEncryptionPolicy.class); +} 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..bdb2e3f5b5172 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClusterKey.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB Cassandra table cluster key. */ +@Fluent +public final class ClusterKey { + /* + * Name of the Cosmos DB Cassandra table cluster key + */ + @JsonProperty(value = "name") + private String name; + + /* + * Order of the Cosmos DB Cassandra table cluster key, only support "Asc" and "Desc" + */ + @JsonProperty(value = "orderBy") + private String orderBy; + + /** 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() { + } +} 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..42e0de9d013ea --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClusterResource.java @@ -0,0 +1,321 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.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..83c999eefb2d1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClusterResourceProperties.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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of a managed Cassandra cluster. */ +@Fluent +public final class ClusterResourceProperties { + /* + * The status of the resource at the time the operation was called. + */ + @JsonProperty(value = "provisioningState") + private ManagedCassandraProvisioningState provisioningState; + + /* + * To create an empty cluster, omit this field or set it to null. To restore a backup into a new cluster, set this + * field to the resource id of the backup. + */ + @JsonProperty(value = "restoreFromBackupId") + private String restoreFromBackupId; + + /* + * Resource id of a subnet that this cluster's management service should have its network interface attached to. + * The subnet must be routable to all subnets that will be delegated to data centers. The resource id must be of + * the form '/subscriptions//resourceGroups//providers/Microsoft.Network/virtualNetworks//subnets/' + */ + @JsonProperty(value = "delegatedManagementSubnetId") + private String delegatedManagementSubnetId; + + /* + * Which version of Cassandra should this cluster converge to running (e.g., 3.11). When updated, the cluster may + * take some time to migrate to the new version. + */ + @JsonProperty(value = "cassandraVersion") + private String cassandraVersion; + + /* + * If you need to set the clusterName property in cassandra.yaml to something besides the resource name of the + * cluster, set the value to use on this property. + */ + @JsonProperty(value = "clusterNameOverride") + private String clusterNameOverride; + + /* + * Which authentication method Cassandra should use to authenticate clients. 'None' turns off authentication, so + * should not be used except in emergencies. 'Cassandra' is the default password based authentication. The default + * is 'Cassandra'. + */ + @JsonProperty(value = "authenticationMethod") + private AuthenticationMethod authenticationMethod; + + /* + * Initial password for clients connecting as admin to the cluster. Should be changed after cluster creation. + * Returns null on GET. This field only applies when the authenticationMethod field is 'Cassandra'. + */ + @JsonProperty(value = "initialCassandraAdminPassword") + private String initialCassandraAdminPassword; + + /* + * Hostname or IP address where the Prometheus endpoint containing data about the managed Cassandra nodes can be + * reached. + */ + @JsonProperty(value = "prometheusEndpoint") + private SeedNode prometheusEndpoint; + + /* + * Should automatic repairs run on this cluster? If omitted, this is true, and should stay true unless you are + * running a hybrid cluster where you are already doing your own repairs. + */ + @JsonProperty(value = "repairEnabled") + private Boolean repairEnabled; + + /* + * List of TLS certificates used to authorize clients connecting to the cluster. All connections are TLS encrypted + * whether clientCertificates is set or not, but if clientCertificates is set, the managed Cassandra cluster will + * reject all connections not bearing a TLS client certificate that can be validated from one or more of the public + * certificates in this property. + */ + @JsonProperty(value = "clientCertificates") + private List clientCertificates; + + /* + * List of TLS certificates used to authorize gossip from unmanaged data centers. The TLS certificates of all nodes + * in unmanaged data centers must be verifiable using one of the certificates provided in this property. + */ + @JsonProperty(value = "externalGossipCertificates") + private List externalGossipCertificates; + + /* + * List of TLS certificates that unmanaged nodes must trust for gossip with managed nodes. All managed nodes will + * present TLS client certificates that are verifiable using one of the certificates provided in this property. + */ + @JsonProperty(value = "gossipCertificates", access = JsonProperty.Access.WRITE_ONLY) + private List gossipCertificates; + + /* + * List of IP addresses of seed nodes in unmanaged data centers. These will be added to the seed node lists of all + * managed nodes. + */ + @JsonProperty(value = "externalSeedNodes") + private List externalSeedNodes; + + /* + * List of IP addresses of seed nodes in the managed data centers. These should be added to the seed node lists of + * all unmanaged nodes. + */ + @JsonProperty(value = "seedNodes", access = JsonProperty.Access.WRITE_ONLY) + private List seedNodes; + + /* + * Number of hours to wait between taking a backup of the cluster. To disable backups, set this property to 0. + */ + @JsonProperty(value = "hoursBetweenBackups") + private Integer hoursBetweenBackups; + + /* + * Whether the cluster and associated data centers has been deallocated. + */ + @JsonProperty(value = "deallocated") + private Boolean deallocated; + + /* + * Whether Cassandra audit logging is enabled + */ + @JsonProperty(value = "cassandraAuditLoggingEnabled") + private Boolean cassandraAuditLoggingEnabled; + + /** 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: Number of hours to wait between taking a backup of the cluster. To disable + * backups, set this property to 0. + * + * @return the hoursBetweenBackups value. + */ + public Integer hoursBetweenBackups() { + return this.hoursBetweenBackups; + } + + /** + * Set the hoursBetweenBackups property: Number of hours to wait between taking a backup of the cluster. To disable + * backups, set this property to 0. + * + * @param hoursBetweenBackups the hoursBetweenBackups value to set. + * @return the ClusterResourceProperties object itself. + */ + public ClusterResourceProperties withHoursBetweenBackups(Integer hoursBetweenBackups) { + this.hoursBetweenBackups = hoursBetweenBackups; + return this; + } + + /** + * Get the 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (prometheusEndpoint() != null) { + prometheusEndpoint().validate(); + } + if (clientCertificates() != null) { + clientCertificates().forEach(e -> e.validate()); + } + if (externalGossipCertificates() != null) { + externalGossipCertificates().forEach(e -> e.validate()); + } + if (gossipCertificates() != null) { + gossipCertificates().forEach(e -> e.validate()); + } + if (externalSeedNodes() != null) { + externalSeedNodes().forEach(e -> e.validate()); + } + if (seedNodes() != null) { + seedNodes().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CollectionPartitionRegions.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CollectionPartitionRegions.java new file mode 100644 index 0000000000000..3ce5631c5ce12 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CollectionPartitionRegions.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of CollectionPartitionRegions. */ +public interface CollectionPartitionRegions { + /** + * Retrieves the metrics determined by the given filter for the given collection and region, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request 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..7a05a90c9f96c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CollectionPartitions.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of CollectionPartitions. */ +public interface CollectionPartitions { + /** + * Retrieves the metrics determined by the given filter for the given collection, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request 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..39ac9914309a5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CollectionRegions.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of CollectionRegions. */ +public interface CollectionRegions { + /** + * Retrieves the metrics determined by the given filter for the given database account, collection and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request 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..520b77459c3b0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Collections.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Collections. */ +public interface Collections { + /** + * Retrieves the metrics determined by the given filter for the given database account and collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request 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..4897467679041 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Column.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB Cassandra table column. */ +@Fluent +public final class Column { + /* + * Name of the Cosmos DB Cassandra table column + */ + @JsonProperty(value = "name") + private String name; + + /* + * Type of the Cosmos DB Cassandra table column + */ + @JsonProperty(value = "type") + private String type; + + /** 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() { + } +} 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..5bb1d99574037 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CommandOutput.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.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..d29320ecdc78e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CommandPostBody.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.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Specification of which command to run where. */ +@Fluent +public final class CommandPostBody { + /* + * The command which should be run + */ + @JsonProperty(value = "command", required = true) + private String command; + + /* + * The arguments for the command to be run + */ + @JsonProperty(value = "arguments") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map arguments; + + /* + * IP address of the cassandra host to run the command on + */ + @JsonProperty(value = "host", required = true) + private String host; + + /* + * If true, stops cassandra before executing the command and then start it again + */ + @JsonProperty(value = "cassandra-stop-start") + private Boolean cassandraStopStart; + + /* + * If true, allows the command to *write* to the cassandra directory, otherwise read-only. + */ + @JsonProperty(value = "readwrite") + 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 + .logExceptionAsError( + new IllegalArgumentException("Missing required property command in model CommandPostBody")); + } + if (host() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property host in model CommandPostBody")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CommandPostBody.class); +} 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..539fea0743cff --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CompositePath.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The CompositePath model. */ +@Fluent +public final class CompositePath { + /* + * The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard + * (/path/*) + */ + @JsonProperty(value = "path") + private String path; + + /* + * Sort order for composite paths. + */ + @JsonProperty(value = "order") + private CompositePathSortOrder order; + + /** 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() { + } +} 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..7be46469d46a1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CompositePathSortOrder.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.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +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. + */ + @JsonCreator + 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/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..614e67caf25d0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ConflictResolutionMode.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.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +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. + */ + @JsonCreator + 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..21ca75ff120f9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ConflictResolutionPolicy.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The conflict resolution policy for the container. */ +@Fluent +public final class ConflictResolutionPolicy { + /* + * Indicates the conflict resolution mode. + */ + @JsonProperty(value = "mode") + private ConflictResolutionMode mode; + + /* + * The conflict resolution path in the case of LastWriterWins mode. + */ + @JsonProperty(value = "conflictResolutionPath") + private String conflictResolutionPath; + + /* + * The procedure to resolve conflicts in the case of custom mode. + */ + @JsonProperty(value = "conflictResolutionProcedure") + private String conflictResolutionProcedure; + + /** 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() { + } +} 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..11c60acd7920c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ConnectionError.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.fasterxml.jackson.annotation.JsonProperty; + +/** The ConnectionError model. */ +@Fluent +public final class ConnectionError { + /* + * The kind of connection error that occurred. + */ + @JsonProperty(value = "connectionState") + private ConnectionState connectionState; + + /* + * The IP of host that originated the failed connection. + */ + @JsonProperty(value = "iPFrom") + private String iPFrom; + + /* + * The IP that the connection attempted to reach. + */ + @JsonProperty(value = "iPTo") + private String iPTo; + + /* + * The TCP port the connection was attempted on. + */ + @JsonProperty(value = "port") + private Integer port; + + /* + * Detailed error message about the failed connection. + */ + @JsonProperty(value = "exception") + 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() { + } +} 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..f968d3f801f8d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ConnectionState.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.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +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. + */ + @JsonCreator + 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..6a78fb4f3a884 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ConnectorOffer.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.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +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. + */ + @JsonCreator + 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..17b4c05a8a4d6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ConsistencyPolicy.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The consistency policy for the Cosmos DB database account. */ +@Fluent +public final class ConsistencyPolicy { + /* + * The default consistency level and configuration settings of the Cosmos DB account. + */ + @JsonProperty(value = "defaultConsistencyLevel", required = true) + private DefaultConsistencyLevel defaultConsistencyLevel; + + /* + * When used with the Bounded Staleness consistency level, this value represents the number of stale requests + * tolerated. Accepted range for this value is 1 – 2,147,483,647. Required when defaultConsistencyPolicy is set to + * 'BoundedStaleness'. + */ + @JsonProperty(value = "maxStalenessPrefix") + private Long maxStalenessPrefix; + + /* + * When used with the Bounded Staleness consistency level, this value represents the time amount of staleness (in + * seconds) tolerated. Accepted range for this value is 5 - 86400. Required when defaultConsistencyPolicy is set to + * 'BoundedStaleness'. + */ + @JsonProperty(value = "maxIntervalInSeconds") + private Integer maxIntervalInSeconds; + + /** 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 + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property defaultConsistencyLevel in model ConsistencyPolicy")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ConsistencyPolicy.class); +} 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..ba49a1d371f90 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ContainerPartitionKey.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.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The configuration of the partition key to be used for partitioning data into multiple partitions. */ +@Fluent +public final class ContainerPartitionKey { + /* + * List of paths using which data within the container can be partitioned + */ + @JsonProperty(value = "paths") + private List paths; + + /* + * Indicates the kind of algorithm used for partitioning. For MultiHash, multiple partition keys (upto three + * maximum) are supported for container create + */ + @JsonProperty(value = "kind") + private PartitionKind kind; + + /* + * Indicates the version of the partition key definition + */ + @JsonProperty(value = "version") + private Integer version; + + /* + * Indicates if the container is using a system generated partition key + */ + @JsonProperty(value = "systemKey", access = JsonProperty.Access.WRITE_ONLY) + private Boolean systemKey; + + /** 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() { + } +} 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..c79f18379e664 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ContinuousBackupInformation.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Information about the status of continuous backups. */ +@Fluent +public final class ContinuousBackupInformation { + /* + * The latest restorable timestamp for a resource. + */ + @JsonProperty(value = "latestRestorableTimestamp") + 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() { + } +} 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..02dd4d153748b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ContinuousBackupRestoreLocation.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of the regional restorable account. */ +@Fluent +public final class ContinuousBackupRestoreLocation { + /* + * The name of the continuous backup restore location. + */ + @JsonProperty(value = "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() { + } +} 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..2960d6bfe9c7e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ContinuousModeBackupPolicy.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The object representing continuous mode backup policy. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Continuous") +@Fluent +public final class ContinuousModeBackupPolicy extends BackupPolicy { + /** Creates an instance of ContinuousModeBackupPolicy class. */ + public ContinuousModeBackupPolicy() { + } + + /** {@inheritDoc} */ + @Override + public ContinuousModeBackupPolicy withMigrationState(BackupPolicyMigrationState migrationState) { + super.withMigrationState(migrationState); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CorsPolicy.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CorsPolicy.java new file mode 100644 index 0000000000000..3353709a12696 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CorsPolicy.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The CORS policy for the Cosmos DB database account. */ +@Fluent +public final class CorsPolicy { + /* + * The origin domains that are permitted to make a request against the service via CORS. + */ + @JsonProperty(value = "allowedOrigins", required = true) + private String allowedOrigins; + + /* + * The methods (HTTP request verbs) that the origin domain may use for a CORS request. + */ + @JsonProperty(value = "allowedMethods") + private String allowedMethods; + + /* + * The request headers that the origin domain may specify on the CORS request. + */ + @JsonProperty(value = "allowedHeaders") + private String allowedHeaders; + + /* + * The response headers that may be sent in the response to the CORS request and exposed by the browser to the + * request issuer. + */ + @JsonProperty(value = "exposedHeaders") + private String exposedHeaders; + + /* + * The maximum amount time that a browser should cache the preflight OPTIONS request. + */ + @JsonProperty(value = "maxAgeInSeconds") + private Long maxAgeInSeconds; + + /** 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 + .logExceptionAsError( + new IllegalArgumentException("Missing required property allowedOrigins in model CorsPolicy")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CorsPolicy.class); +} 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..f952ce96ec254 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CreateMode.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.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +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. + */ + @JsonCreator + 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..a0c8387253c80 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CreateUpdateOptions.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * CreateUpdateOptions are a list of key-value pairs that describe the resource. Supported keys are "If-Match", + * "If-None-Match", "Session-Token" and "Throughput". + */ +@Fluent +public final class CreateUpdateOptions { + /* + * Request Units per second. For example, "throughput": 10000. + */ + @JsonProperty(value = "throughput") + private Integer throughput; + + /* + * Specifies the Autoscale settings. + */ + @JsonProperty(value = "autoscaleSettings") + 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. + * + * @return the autoscaleSettings value. + */ + public AutoscaleSettings autoscaleSettings() { + return this.autoscaleSettings; + } + + /** + * Set the autoscaleSettings property: Specifies the Autoscale settings. + * + * @param autoscaleSettings the autoscaleSettings value to set. + * @return the CreateUpdateOptions object itself. + */ + public CreateUpdateOptions withAutoscaleSettings(AutoscaleSettings autoscaleSettings) { + this.autoscaleSettings = autoscaleSettings; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (autoscaleSettings() != null) { + autoscaleSettings().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DataCenterResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DataCenterResource.java new file mode 100644 index 0000000000000..c8995264deffb --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DataCenterResource.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.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..9dd933355c3da --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DataCenterResourceProperties.java @@ -0,0 +1,366 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of a managed Cassandra data center. */ +@Fluent +public final class DataCenterResourceProperties { + /* + * The status of the resource at the time the operation was called. + */ + @JsonProperty(value = "provisioningState") + private ManagedCassandraProvisioningState provisioningState; + + /* + * The region this data center should be created in. + */ + @JsonProperty(value = "dataCenterLocation") + private String dataCenterLocation; + + /* + * Resource id of a subnet the nodes in this data center should have their network interfaces connected to. The + * subnet must be in the same region specified in 'dataCenterLocation' and must be able to route to the subnet + * specified in the cluster's 'delegatedManagementSubnetId' property. This resource id will be of the form + * '/subscriptions//resourceGroups//providers/Microsoft.Network/virtualNetworks//subnets/'. + */ + @JsonProperty(value = "delegatedSubnetId") + private String delegatedSubnetId; + + /* + * The number of nodes the data center should have. This is the desired number. After it is set, it may take some + * time for the data center to be scaled to match. To monitor the number of nodes and their status, use the + * fetchNodeStatus method on the cluster. + */ + @JsonProperty(value = "nodeCount") + private Integer nodeCount; + + /* + * IP addresses for seed nodes in this data center. This is for reference. Generally you will want to use the + * seedNodes property on the cluster, which aggregates the seed nodes from all data centers in the cluster. + */ + @JsonProperty(value = "seedNodes", access = JsonProperty.Access.WRITE_ONLY) + private List seedNodes; + + /* + * A fragment of a cassandra.yaml configuration file to be included in the cassandra.yaml for all nodes in this + * data center. The fragment should be Base64 encoded, and only a subset of keys are allowed. + */ + @JsonProperty(value = "base64EncodedCassandraYamlFragment") + private String base64EncodedCassandraYamlFragment; + + /* + * 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. + */ + @JsonProperty(value = "managedDiskCustomerKeyUri") + private String managedDiskCustomerKeyUri; + + /* + * Indicates the Key Uri of the customer key to use for encryption of the backup storage account. + */ + @JsonProperty(value = "backupStorageCustomerKeyUri") + private String backupStorageCustomerKeyUri; + + /* + * Virtual Machine SKU used for data centers. Default value is Standard_DS14_v2 + */ + @JsonProperty(value = "sku") + private String sku; + + /* + * Disk SKU used for data centers. Default value is P30. + */ + @JsonProperty(value = "diskSku") + private String diskSku; + + /* + * Number of disk used for data centers. Default value is 4. + */ + @JsonProperty(value = "diskCapacity") + private Integer diskCapacity; + + /* + * If the azure data center has Availability Zone support, apply it to the Virtual Machine ScaleSet that host the + * cassandra data center virtual machines. + */ + @JsonProperty(value = "availabilityZone") + private Boolean availabilityZone; + + /** 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 disk used for data centers. Default value is 4. + * + * @return the diskCapacity value. + */ + public Integer diskCapacity() { + return this.diskCapacity; + } + + /** + * Set the diskCapacity property: Number of disk used for data centers. Default value 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 azure 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 azure 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (seedNodes() != null) { + seedNodes().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DataTransferRegionalServiceResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DataTransferRegionalServiceResource.java new file mode 100644 index 0000000000000..0a00d14a6af15 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DataTransferRegionalServiceResource.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; + +/** Resource for a regional service location. */ +@Immutable +public final class DataTransferRegionalServiceResource extends RegionalServiceResource { + /** Creates an instance of DataTransferRegionalServiceResource class. */ + public DataTransferRegionalServiceResource() { + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DataTransferServiceResourceProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DataTransferServiceResourceProperties.java new file mode 100644 index 0000000000000..7e48def941c51 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DataTransferServiceResourceProperties.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +/** Properties for DataTransferServiceResource. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "serviceType") +@JsonTypeName("DataTransfer") +@Fluent +public final class DataTransferServiceResourceProperties extends ServiceResourceProperties { + /* + * An array that contains all of the locations for the service. + */ + @JsonProperty(value = "locations", access = JsonProperty.Access.WRITE_ONLY) + private List locations; + + /** Creates an instance of DataTransferServiceResourceProperties class. */ + public DataTransferServiceResourceProperties() { + } + + /** + * Get the locations property: An array that contains all of the locations for the service. + * + * @return the locations value. + */ + public List locations() { + return this.locations; + } + + /** {@inheritDoc} */ + @Override + public DataTransferServiceResourceProperties withInstanceSize(ServiceSize instanceSize) { + super.withInstanceSize(instanceSize); + return this; + } + + /** {@inheritDoc} */ + @Override + public DataTransferServiceResourceProperties withInstanceCount(Integer instanceCount) { + super.withInstanceCount(instanceCount); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (locations() != null) { + locations().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DataType.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DataType.java new file mode 100644 index 0000000000000..1f381b4b2f0c3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DataType.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.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +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. + */ + @JsonCreator + 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..82c6a2c22f3dc --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountConnectionString.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Connection string for the Cosmos DB account. */ +@Immutable +public final class DatabaseAccountConnectionString { + /* + * Value of the connection string + */ + @JsonProperty(value = "connectionString", access = JsonProperty.Access.WRITE_ONLY) + private String connectionString; + + /* + * Description of the connection string + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountCreateUpdateParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountCreateUpdateParameters.java new file mode 100644 index 0000000000000..2e35e070d24e4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountCreateUpdateParameters.java @@ -0,0 +1,830 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountCreateUpdateProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Parameters to create and update Cosmos DB database accounts. */ +@Fluent +public final class DatabaseAccountCreateUpdateParameters extends ArmResourceProperties { + /* + * Indicates the type of database account. This can only be set at database account creation. + */ + @JsonProperty(value = "kind") + private DatabaseAccountKind kind; + + /* + * Identity for the resource. + */ + @JsonProperty(value = "identity") + private ManagedServiceIdentity identity; + + /* + * Properties to create and update Azure Cosmos DB database accounts. + */ + @JsonProperty(value = "properties", required = true) + private DatabaseAccountCreateUpdateProperties innerProperties = new DatabaseAccountCreateUpdateProperties(); + + /** 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; + } + + /** {@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 is Tls 1.0, except for + * Cassandra and Mongo API's, which 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 is Tls 1.0, except for + * Cassandra and Mongo API's, which 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (identity() != null) { + identity().validate(); + } + if (innerProperties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model DatabaseAccountCreateUpdateParameters")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DatabaseAccountCreateUpdateParameters.class); +} 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..a06addfdb36cc --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountGetResults.java @@ -0,0 +1,1347 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 is Tls 1.0, except + * for Cassandra and Mongo API's, which only work with Tls 1.2. + * + * @return the minimalTlsVersion value. + */ + MinimalTlsVersion minimalTlsVersion(); + + /** + * 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 { + /** + * 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 is Tls + * 1.0, except for Cassandra and Mongo API's, which only work with Tls 1.2.. + * + * @param minimalTlsVersion Indicates the minimum allowed Tls version. The default is Tls 1.0, except for + * Cassandra and Mongo API's, which only work with Tls 1.2. + * @return the next definition stage. + */ + WithCreate withMinimalTlsVersion(MinimalTlsVersion minimalTlsVersion); + } + } + /** + * 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 { + /** + * 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 is Tls + * 1.0, except for Cassandra and Mongo API's, which only work with Tls 1.2.. + * + * @param minimalTlsVersion Indicates the minimum allowed Tls version. The default is Tls 1.0, except for + * Cassandra and Mongo API's, which only work with Tls 1.2. + * @return the next definition stage. + */ + Update withMinimalTlsVersion(MinimalTlsVersion minimalTlsVersion); + } + } + /** + * 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..10687e6b32dff --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountKeysMetadata.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The metadata related to each access key for the given Cosmos DB database account. */ +@Immutable +public final class DatabaseAccountKeysMetadata { + /* + * The metadata related to the Primary Read-Write Key for the given Cosmos DB database account. + */ + @JsonProperty(value = "primaryMasterKey", access = JsonProperty.Access.WRITE_ONLY) + private AccountKeyMetadata primaryMasterKey; + + /* + * The metadata related to the Secondary Read-Write Key for the given Cosmos DB database account. + */ + @JsonProperty(value = "secondaryMasterKey", access = JsonProperty.Access.WRITE_ONLY) + private AccountKeyMetadata secondaryMasterKey; + + /* + * The metadata related to the Primary Read-Only Key for the given Cosmos DB database account. + */ + @JsonProperty(value = "primaryReadonlyMasterKey", access = JsonProperty.Access.WRITE_ONLY) + private AccountKeyMetadata primaryReadonlyMasterKey; + + /* + * The metadata related to the Secondary Read-Only Key for the given Cosmos DB database account. + */ + @JsonProperty(value = "secondaryReadonlyMasterKey", access = JsonProperty.Access.WRITE_ONLY) + 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(); + } + } +} 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..466f00e43cced --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountKind.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +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. + */ + @JsonCreator + 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..e6e13dcddb379 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountListConnectionStringsResult.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountListConnectionStringsResultInner; +import java.util.List; + +/** An immutable client-side representation of DatabaseAccountListConnectionStringsResult. */ +public interface DatabaseAccountListConnectionStringsResult { + /** + * Gets the connectionStrings property: An array that contains the connection strings for the Cosmos DB account. + * + * @return the connectionStrings value. + */ + List connectionStrings(); + + /** + * Gets the inner + * com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountListConnectionStringsResultInner object. + * + * @return the inner object. + */ + DatabaseAccountListConnectionStringsResultInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountListKeysResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountListKeysResult.java new file mode 100644 index 0000000000000..224abe8747755 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountListKeysResult.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountListKeysResultInner; + +/** An immutable client-side representation of DatabaseAccountListKeysResult. */ +public interface DatabaseAccountListKeysResult { + /** + * Gets the primaryReadonlyMasterKey property: Base 64 encoded value of the primary read-only key. + * + * @return the primaryReadonlyMasterKey value. + */ + String primaryReadonlyMasterKey(); + + /** + * Gets the secondaryReadonlyMasterKey property: Base 64 encoded value of the secondary read-only key. + * + * @return the secondaryReadonlyMasterKey value. + */ + String secondaryReadonlyMasterKey(); + + /** + * Gets the primaryMasterKey property: Base 64 encoded value of the primary read-write key. + * + * @return the primaryMasterKey value. + */ + String primaryMasterKey(); + + /** + * Gets the secondaryMasterKey property: Base 64 encoded value of the secondary read-write key. + * + * @return the secondaryMasterKey value. + */ + String secondaryMasterKey(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountListKeysResultInner + * object. + * + * @return the inner object. + */ + DatabaseAccountListKeysResultInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountListReadOnlyKeysResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountListReadOnlyKeysResult.java new file mode 100644 index 0000000000000..a364359a8c09d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountListReadOnlyKeysResult.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountListReadOnlyKeysResultInner; + +/** An immutable client-side representation of DatabaseAccountListReadOnlyKeysResult. */ +public interface DatabaseAccountListReadOnlyKeysResult { + /** + * Gets the primaryReadonlyMasterKey property: Base 64 encoded value of the primary read-only key. + * + * @return the primaryReadonlyMasterKey value. + */ + String primaryReadonlyMasterKey(); + + /** + * Gets the secondaryReadonlyMasterKey property: Base 64 encoded value of the secondary read-only key. + * + * @return the secondaryReadonlyMasterKey value. + */ + String secondaryReadonlyMasterKey(); + + /** + * Gets the inner + * com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountListReadOnlyKeysResultInner object. + * + * @return the inner object. + */ + DatabaseAccountListReadOnlyKeysResultInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountOfferType.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountOfferType.java new file mode 100644 index 0000000000000..c34f408c523c1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountOfferType.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.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** 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. + */ + @JsonCreator + 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} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountRegenerateKeyParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountRegenerateKeyParameters.java new file mode 100644 index 0000000000000..9b6f01df67a3c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountRegenerateKeyParameters.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Parameters to regenerate the keys within the database account. */ +@Fluent +public final class DatabaseAccountRegenerateKeyParameters { + /* + * The access key to regenerate. + */ + @JsonProperty(value = "keyKind", required = true) + 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 + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property keyKind in model DatabaseAccountRegenerateKeyParameters")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DatabaseAccountRegenerateKeyParameters.class); +} 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..c0e68ba7f41e3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountRegions.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of DatabaseAccountRegions. */ +public interface DatabaseAccountRegions { + /** + * Retrieves the metrics determined by the given filter for the given database account and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request 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..61e01b9a8f7de --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountUpdateParameters.java @@ -0,0 +1,774 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountUpdateProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Parameters for patching Azure Cosmos DB database account properties. */ +@Fluent +public final class DatabaseAccountUpdateParameters { + /* + * Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping + * this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have + * a key no greater than 128 characters and value no greater than 256 characters. For example, the default + * experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values + * also include "Table", "Graph", "DocumentDB", and "MongoDB". + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * The location of the resource group to which the resource belongs. + */ + @JsonProperty(value = "location") + private String location; + + /* + * Identity for the resource. + */ + @JsonProperty(value = "identity") + private ManagedServiceIdentity identity; + + /* + * Properties to update Azure Cosmos DB database accounts. + */ + @JsonProperty(value = "properties") + private DatabaseAccountUpdateProperties innerProperties; + + /** 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 is Tls 1.0, except for + * Cassandra and Mongo API's, which 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 is Tls 1.0, except for + * Cassandra and Mongo API's, which 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccounts.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccounts.java new file mode 100644 index 0000000000000..79f962dd466cf --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccounts.java @@ -0,0 +1,488 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.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..f2f5f21370147 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountsListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountGetResultsInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the database accounts and their properties. */ +@Immutable +public final class DatabaseAccountsListResult { + /* + * List of database account and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + 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()); + } + } +} 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..ba384fbeb577d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseRestoreResource.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Specific Databases to restore. */ +@Fluent +public final class DatabaseRestoreResource { + /* + * The name of the database available for restore. + */ + @JsonProperty(value = "databaseName") + private String databaseName; + + /* + * The names of the collections available for restore. + */ + @JsonProperty(value = "collectionNames") + private List collectionNames; + + /** 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() { + } +} 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..16a265fd40d36 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Databases.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Databases. */ +public interface Databases { + /** + * Retrieves the metrics determined by the given filter for the given database account and database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request 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/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..cba157f7f567a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DefaultConsistencyLevel.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** 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. + */ + @JsonCreator + 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} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ExcludedPath.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ExcludedPath.java new file mode 100644 index 0000000000000..c1027d64f2311 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ExcludedPath.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ExcludedPath model. */ +@Fluent +public final class ExcludedPath { + /* + * The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard + * (/path/*) + */ + @JsonProperty(value = "path") + private String path; + + /** 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() { + } +} 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..e01d966910da6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ExtendedResourceProperties.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The system generated resource properties associated with SQL databases, SQL containers, Gremlin databases and Gremlin + * graphs. + */ +@Immutable +public class ExtendedResourceProperties { + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** 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; + } + + /** + * Get the ts property: A system generated property that denotes the last updated timestamp of the resource. + * + * @return the ts value. + */ + public Float ts() { + return this.ts; + } + + /** + * Get the etag property: A system generated property representing the resource etag required for optimistic + * concurrency control. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/FailoverPolicies.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/FailoverPolicies.java new file mode 100644 index 0000000000000..7b5abac872885 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/FailoverPolicies.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.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list of new failover policies for the failover priority change. */ +@Fluent +public final class FailoverPolicies { + /* + * List of failover policies. + */ + @JsonProperty(value = "failoverPolicies", required = true) + 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 + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property failoverPolicies in model FailoverPolicies")); + } else { + failoverPolicies().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(FailoverPolicies.class); +} 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..ee6eedafcc764 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/FailoverPolicy.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.fasterxml.jackson.annotation.JsonProperty; + +/** The failover policy for a given region of a database account. */ +@Fluent +public final class FailoverPolicy { + /* + * The unique identifier of the region in which the database account replicates to. Example: + * <accountName>-<locationName>. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The name of the region in which the database account exists. + */ + @JsonProperty(value = "locationName") + private String locationName; + + /* + * The failover priority of the region. A failover priority of 0 indicates a write region. The maximum value for a + * failover priority = (total number of regions - 1). Failover priority values must be unique for each of the + * regions in which the database account exists. + */ + @JsonProperty(value = "failoverPriority") + private Integer failoverPriority; + + /** 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() { + } +} 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..af189e7dcdd43 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GraphApiComputeRegionalServiceResource.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Resource for a regional service location. */ +@Immutable +public final class GraphApiComputeRegionalServiceResource extends RegionalServiceResource { + /* + * The regional endpoint for GraphAPICompute. + */ + @JsonProperty(value = "graphApiComputeEndpoint", access = JsonProperty.Access.WRITE_ONLY) + private String graphApiComputeEndpoint; + + /** 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GraphApiComputeServiceResourceProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GraphApiComputeServiceResourceProperties.java new file mode 100644 index 0000000000000..39d9039e4c1f5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GraphApiComputeServiceResourceProperties.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +/** Properties for GraphAPIComputeServiceResource. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "serviceType") +@JsonTypeName("GraphAPICompute") +@Fluent +public final class GraphApiComputeServiceResourceProperties extends ServiceResourceProperties { + /* + * GraphAPICompute endpoint for the service. + */ + @JsonProperty(value = "graphApiComputeEndpoint") + private String graphApiComputeEndpoint; + + /* + * An array that contains all of the locations for the service. + */ + @JsonProperty(value = "locations", access = JsonProperty.Access.WRITE_ONLY) + private List locations; + + /** Creates an instance of GraphApiComputeServiceResourceProperties class. */ + public GraphApiComputeServiceResourceProperties() { + } + + /** + * Get the graphApiComputeEndpoint property: GraphAPICompute endpoint for the service. + * + * @return the graphApiComputeEndpoint value. + */ + public String graphApiComputeEndpoint() { + return this.graphApiComputeEndpoint; + } + + /** + * Set the graphApiComputeEndpoint property: GraphAPICompute endpoint for the service. + * + * @param graphApiComputeEndpoint the graphApiComputeEndpoint value to set. + * @return the GraphApiComputeServiceResourceProperties object itself. + */ + public GraphApiComputeServiceResourceProperties withGraphApiComputeEndpoint(String graphApiComputeEndpoint) { + this.graphApiComputeEndpoint = graphApiComputeEndpoint; + return this; + } + + /** + * Get the locations property: An array that contains all of the locations for the service. + * + * @return the locations value. + */ + public List locations() { + return this.locations; + } + + /** {@inheritDoc} */ + @Override + public GraphApiComputeServiceResourceProperties withInstanceSize(ServiceSize instanceSize) { + super.withInstanceSize(instanceSize); + return this; + } + + /** {@inheritDoc} */ + @Override + public GraphApiComputeServiceResourceProperties withInstanceCount(Integer instanceCount) { + super.withInstanceCount(instanceCount); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (locations() != null) { + locations().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/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..f22ed9a50a02b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseCreateUpdateParameters.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.GremlinDatabaseCreateUpdateProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +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. + */ + @JsonProperty(value = "properties", required = true) + private GremlinDatabaseCreateUpdateProperties innerProperties = new GremlinDatabaseCreateUpdateProperties(); + + /** 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; + } + + /** {@inheritDoc} */ + @Override + public GremlinDatabaseCreateUpdateParameters withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public GremlinDatabaseCreateUpdateParameters withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The standard JSON format of a Gremlin database. + * + * @return the resource value. + */ + public GremlinDatabaseResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The standard JSON format of a Gremlin database. + * + * @param resource the resource value to set. + * @return the GremlinDatabaseCreateUpdateParameters object itself. + */ + public GremlinDatabaseCreateUpdateParameters withResource(GremlinDatabaseResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new GremlinDatabaseCreateUpdateProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Get the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @return the options value. + */ + public CreateUpdateOptions options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @param options the options value to set. + * @return the GremlinDatabaseCreateUpdateParameters object itself. + */ + public GremlinDatabaseCreateUpdateParameters withOptions(CreateUpdateOptions options) { + if (this.innerProperties() == null) { + this.innerProperties = new GremlinDatabaseCreateUpdateProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model GremlinDatabaseCreateUpdateParameters")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(GremlinDatabaseCreateUpdateParameters.class); +} 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..11afa94a2d0c7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseGetPropertiesOptions.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; + +/** 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() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseGetPropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseGetPropertiesResource.java new file mode 100644 index 0000000000000..ff8b338c3acba --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseGetPropertiesResource.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The GremlinDatabaseGetPropertiesResource model. */ +@Fluent +public final class GremlinDatabaseGetPropertiesResource extends GremlinDatabaseResource { + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseGetResults.java new file mode 100644 index 0000000000000..69dcbce3ea009 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseGetResults.java @@ -0,0 +1,259 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.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..fca1fca4c4201 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.cosmos.generated.fluent.models.GremlinDatabaseGetResultsInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the Gremlin databases and their properties. */ +@Immutable +public final class GremlinDatabaseListResult { + /* + * List of Gremlin databases and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + 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()); + } + } +} 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..090a670826ccb --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseResource.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.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB Gremlin database resource object. */ +@Fluent +public class GremlinDatabaseResource { + /* + * Name of the Cosmos DB Gremlin database + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model GremlinDatabaseResource")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(GremlinDatabaseResource.class); +} 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..c2e4251d48d65 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseRestoreResource.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Specific Gremlin Databases to restore. */ +@Fluent +public final class GremlinDatabaseRestoreResource { + /* + * The name of the gremlin database available for restore. + */ + @JsonProperty(value = "databaseName") + private String databaseName; + + /* + * The names of the graphs available for restore. + */ + @JsonProperty(value = "graphNames") + 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() { + } +} 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..1cf4681284cd8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphCreateUpdateParameters.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.GremlinGraphCreateUpdateProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +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. + */ + @JsonProperty(value = "properties", required = true) + private GremlinGraphCreateUpdateProperties innerProperties = new GremlinGraphCreateUpdateProperties(); + + /** 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; + } + + /** {@inheritDoc} */ + @Override + public GremlinGraphCreateUpdateParameters withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public GremlinGraphCreateUpdateParameters withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The standard JSON format of a Gremlin graph. + * + * @return the resource value. + */ + public GremlinGraphResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The standard JSON format of a Gremlin graph. + * + * @param resource the resource value to set. + * @return the GremlinGraphCreateUpdateParameters object itself. + */ + public GremlinGraphCreateUpdateParameters withResource(GremlinGraphResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new GremlinGraphCreateUpdateProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Get the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @return the options value. + */ + public CreateUpdateOptions options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @param options the options value to set. + * @return the GremlinGraphCreateUpdateParameters object itself. + */ + public GremlinGraphCreateUpdateParameters withOptions(CreateUpdateOptions options) { + if (this.innerProperties() == null) { + this.innerProperties = new GremlinGraphCreateUpdateProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model GremlinGraphCreateUpdateParameters")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(GremlinGraphCreateUpdateParameters.class); +} 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..ce9cff4d63619 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphGetPropertiesOptions.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; + +/** 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() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphGetPropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphGetPropertiesResource.java new file mode 100644 index 0000000000000..33e055a9dc002 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphGetPropertiesResource.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The GremlinGraphGetPropertiesResource model. */ +@Fluent +public final class GremlinGraphGetPropertiesResource extends GremlinGraphResource { + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphGetResults.java new file mode 100644 index 0000000000000..f8f6f51194b48 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphGetResults.java @@ -0,0 +1,283 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.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..e163486784da7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.cosmos.generated.fluent.models.GremlinGraphGetResultsInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the graphs and their properties. */ +@Immutable +public final class GremlinGraphListResult { + /* + * List of graphs and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + 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()); + } + } +} 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..91b2fddd24cbe --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphResource.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB Gremlin graph resource object. */ +@Fluent +public class GremlinGraphResource { + /* + * Name of the Cosmos DB Gremlin graph + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * The configuration of the indexing policy. By default, the indexing is automatic for all document paths within + * the graph + */ + @JsonProperty(value = "indexingPolicy") + private IndexingPolicy indexingPolicy; + + /* + * The configuration of the partition key to be used for partitioning data into multiple partitions + */ + @JsonProperty(value = "partitionKey") + private ContainerPartitionKey partitionKey; + + /* + * Default time to live + */ + @JsonProperty(value = "defaultTtl") + private Integer defaultTtl; + + /* + * The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the + * Azure Cosmos DB service. + */ + @JsonProperty(value = "uniqueKeyPolicy") + private UniqueKeyPolicy uniqueKeyPolicy; + + /* + * The conflict resolution policy for the graph. + */ + @JsonProperty(value = "conflictResolutionPolicy") + private ConflictResolutionPolicy conflictResolutionPolicy; + + /* + * Analytical TTL. + */ + @JsonProperty(value = "analyticalStorageTtl") + private Long analyticalStorageTtl; + + /** 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model GremlinGraphResource")); + } + if (indexingPolicy() != null) { + indexingPolicy().validate(); + } + if (partitionKey() != null) { + partitionKey().validate(); + } + if (uniqueKeyPolicy() != null) { + uniqueKeyPolicy().validate(); + } + if (conflictResolutionPolicy() != null) { + conflictResolutionPolicy().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(GremlinGraphResource.class); +} 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..25287f3b96167 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinResources.java @@ -0,0 +1,599 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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..3a80000817330 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/IncludedPath.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The paths that are included in indexing. */ +@Fluent +public final class IncludedPath { + /* + * The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard + * (/path/*) + */ + @JsonProperty(value = "path") + private String path; + + /* + * List of indexes for this path + */ + @JsonProperty(value = "indexes") + private List indexes; + + /** 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()); + } + } +} 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..ebe11be59a586 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/IndexKind.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +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. + */ + @JsonCreator + 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..756ec7417ef51 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Indexes.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The indexes for the path. */ +@Fluent +public final class Indexes { + /* + * The datatype for which the indexing behavior is applied to. + */ + @JsonProperty(value = "dataType") + private DataType dataType; + + /* + * The precision of the index. -1 is maximum precision. + */ + @JsonProperty(value = "precision") + private Integer precision; + + /* + * Indicates the type of index. + */ + @JsonProperty(value = "kind") + private IndexKind kind; + + /** 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() { + } +} 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..b1330b378b4f8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/IndexingMode.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +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. + */ + @JsonCreator + 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..b36538b000cf1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/IndexingPolicy.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Cosmos DB indexing policy. */ +@Fluent +public final class IndexingPolicy { + /* + * Indicates if the indexing policy is automatic + */ + @JsonProperty(value = "automatic") + private Boolean automatic; + + /* + * Indicates the indexing mode. + */ + @JsonProperty(value = "indexingMode") + private IndexingMode indexingMode; + + /* + * List of paths to include in the indexing + */ + @JsonProperty(value = "includedPaths") + private List includedPaths; + + /* + * List of paths to exclude from indexing + */ + @JsonProperty(value = "excludedPaths") + private List excludedPaths; + + /* + * List of composite path list + */ + @JsonProperty(value = "compositeIndexes") + private List> compositeIndexes; + + /* + * List of spatial specifics + */ + @JsonProperty(value = "spatialIndexes") + private List spatialIndexes; + + /** 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()); + } + } +} 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..bd9d45a341dcf --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/IpAddressOrRange.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** IpAddressOrRange object. */ +@Fluent +public final class IpAddressOrRange { + /* + * A single IPv4 address or a single IPv4 address range in CIDR format. Provided IPs must be well-formatted and + * cannot be contained in one of the following ranges: 10.0.0.0/8, 100.64.0.0/10, 172.16.0.0/12, 192.168.0.0/16, + * since these are not enforceable by the IP address filter. Example of valid inputs: “23.40.210.245” or + * “23.40.210.0/8”. + */ + @JsonProperty(value = "ipAddressOrRange") + 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() { + } +} 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..b6fc7e4a9fca2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/KeyKind.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +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. + */ + @JsonCreator + 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..04fc58b6cf2a7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/KeyWrapMetadata.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.fasterxml.jackson.annotation.JsonProperty; + +/** Represents key wrap metadata that a key wrapping provider can use to wrap/unwrap a client encryption key. */ +@Fluent +public final class KeyWrapMetadata { + /* + * The name of associated KeyEncryptionKey (aka CustomerManagedKey). + */ + @JsonProperty(value = "name") + private String name; + + /* + * ProviderName of KeyStoreProvider. + */ + @JsonProperty(value = "type") + private String type; + + /* + * Reference / link to the KeyEncryptionKey. + */ + @JsonProperty(value = "value") + private String value; + + /* + * Algorithm used in wrapping and unwrapping of the data encryption key. + */ + @JsonProperty(value = "algorithm") + 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() { + } +} 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..e4a86a9c5cf7e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ListClusters.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ClusterResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of managed Cassandra clusters. */ +@Fluent +public final class ListClusters { + /* + * Container for the array of clusters. + */ + @JsonProperty(value = "value") + 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()); + } + } +} 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..79c4a816daa2e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ListDataCenters.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DataCenterResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of managed Cassandra data centers and their properties. */ +@Immutable +public final class ListDataCenters { + /* + * Container for array of data centers. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + 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()); + } + } +} 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..939fc6f2bf78d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Location.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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A region in which the Azure Cosmos DB database account is deployed. */ +@Fluent +public final class Location { + /* + * The unique identifier of the region within the database account. Example: + * <accountName>-<locationName>. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The name of the region. + */ + @JsonProperty(value = "locationName") + private String locationName; + + /* + * The connection endpoint for the specific region. Example: + * https://<accountName>-<locationName>.documents.azure.com:443/ + */ + @JsonProperty(value = "documentEndpoint", access = JsonProperty.Access.WRITE_ONLY) + private String documentEndpoint; + + /* + * The status of the Cosmos DB account at the time the operation was called. The status can be one of following. + * 'Creating' – the Cosmos DB account is being created. When an account is in Creating state, only properties that + * are specified as input for the Create Cosmos DB account operation are returned. 'Succeeded' – the Cosmos DB + * account is active for use. 'Updating' – the Cosmos DB account is being updated. 'Deleting' – the Cosmos DB + * account is being deleted. 'Failed' – the Cosmos DB account failed creation. 'DeletionFailed' – the Cosmos DB + * account deletion failed. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The failover priority of the region. A failover priority of 0 indicates a write region. The maximum value for a + * failover priority = (total number of regions - 1). Failover priority values must be unique for each of the + * regions in which the database account exists. + */ + @JsonProperty(value = "failoverPriority") + private Integer failoverPriority; + + /* + * Flag to indicate whether or not this region is an AvailabilityZone region + */ + @JsonProperty(value = "isZoneRedundant") + private Boolean isZoneRedundant; + + /** 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() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/LocationGetResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/LocationGetResult.java new file mode 100644 index 0000000000000..ac430bd7d70f8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/LocationGetResult.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.LocationGetResultInner; + +/** An immutable client-side representation of LocationGetResult. */ +public interface LocationGetResult { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: Cosmos DB location metadata. + * + * @return the properties value. + */ + LocationProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.LocationGetResultInner object. + * + * @return the inner object. + */ + LocationGetResultInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/LocationListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/LocationListResult.java new file mode 100644 index 0000000000000..b879a8537ac86 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/LocationListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.cosmos.generated.fluent.models.LocationGetResultInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains Cosmos DB locations and their properties. */ +@Immutable +public final class LocationListResult { + /* + * List of Cosmos DB locations and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + 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()); + } + } +} 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..b80b9cafa6ee1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/LocationProperties.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.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Cosmos DB location metadata. */ +@Immutable +public final class LocationProperties { + /* + * Flag indicating whether the location supports availability zones or not. + */ + @JsonProperty(value = "supportsAvailabilityZone", access = JsonProperty.Access.WRITE_ONLY) + private Boolean supportsAvailabilityZone; + + /* + * Flag indicating whether the location is residency sensitive. + */ + @JsonProperty(value = "isResidencyRestricted", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isResidencyRestricted; + + /* + * The properties of available backup storage redundancies. + */ + @JsonProperty(value = "backupStorageRedundancies", access = JsonProperty.Access.WRITE_ONLY) + private List backupStorageRedundancies; + + /** 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/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..d7d6118e48738 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Locations.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.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..e354e03c50c1f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ManagedCassandraArmResourceProperties.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The core properties of ARM resources. */ +@Fluent +public class ManagedCassandraArmResourceProperties extends Resource { + /* + * Identity for the resource. + */ + @JsonProperty(value = "identity") + private ManagedCassandraManagedServiceIdentity identity; + + /** 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; + } + + /** {@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(); + } + } +} 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..1adac45aac429 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ManagedCassandraManagedServiceIdentity.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Identity for the resource. */ +@Fluent +public class ManagedCassandraManagedServiceIdentity { + /* + * The object id of the identity resource. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * The tenant id of the resource. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /* + * The type of the resource. + */ + @JsonProperty(value = "type") + 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() { + } +} 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..b0637ff27e567 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ManagedCassandraProvisioningState.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.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +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. + */ + @JsonCreator + 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..d6ba960bc5013 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ManagedCassandraReaperStatus.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.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The ManagedCassandraReaperStatus model. */ +@Fluent +public final class ManagedCassandraReaperStatus { + /* + * The healthy property. + */ + @JsonProperty(value = "healthy") + private Boolean healthy; + + /* + * Dictionary of + */ + @JsonProperty(value = "repairRunIds") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map repairRunIds; + + /* + * Dictionary of + */ + @JsonProperty(value = "repairSchedules") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + 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() { + } +} 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..3e9f8b1205cb8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ManagedCassandraResourceIdentityType.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.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +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. + */ + @JsonCreator + 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..a2cb44c84b935 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ManagedServiceIdentity.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.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Identity for the resource. */ +@Fluent +public class ManagedServiceIdentity { + /* + * The principal id of the system assigned identity. This property will only be provided for a system assigned + * identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * The tenant id of the system assigned identity. This property will only be provided for a system assigned + * identity. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /* + * The type of identity used for the resource. The type 'SystemAssigned,UserAssigned' includes both an implicitly + * created identity and a set of user assigned identities. The type 'None' will remove any identities from the + * service. + */ + @JsonProperty(value = "type") + private ResourceIdentityType type; + + /* + * The list of user identities associated with resource. The user identity dictionary key references will be ARM + * resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + */ + @JsonProperty(value = "userAssignedIdentities") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map userAssignedIdentities; + + /** 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(); + } + }); + } + } +} 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..50b9da6881a28 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ManagedServiceIdentityUserAssignedIdentities.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ManagedServiceIdentityUserAssignedIdentities model. */ +@Immutable +public final class ManagedServiceIdentityUserAssignedIdentities { + /* + * The principal id of user assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * The client id of user assigned identity. + */ + @JsonProperty(value = "clientId", access = JsonProperty.Access.WRITE_ONLY) + private String clientId; + + /** 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() { + } +} 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..bcc53e5fa4969 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MaterializedViewsBuilderRegionalServiceResource.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; + +/** Resource for a regional service location. */ +@Immutable +public final class MaterializedViewsBuilderRegionalServiceResource extends RegionalServiceResource { + /** Creates an instance of MaterializedViewsBuilderRegionalServiceResource class. */ + public MaterializedViewsBuilderRegionalServiceResource() { + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/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..115fa3279465d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MaterializedViewsBuilderServiceResourceProperties.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +/** Properties for MaterializedViewsBuilderServiceResource. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "serviceType") +@JsonTypeName("MaterializedViewsBuilder") +@Fluent +public final class MaterializedViewsBuilderServiceResourceProperties extends ServiceResourceProperties { + /* + * An array that contains all of the locations for the service. + */ + @JsonProperty(value = "locations", access = JsonProperty.Access.WRITE_ONLY) + private List locations; + + /** Creates an instance of MaterializedViewsBuilderServiceResourceProperties class. */ + public MaterializedViewsBuilderServiceResourceProperties() { + } + + /** + * Get the locations property: An array that contains all of the locations for the service. + * + * @return the locations value. + */ + public List locations() { + return this.locations; + } + + /** {@inheritDoc} */ + @Override + public 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() { + super.validate(); + if (locations() != null) { + locations().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Metric.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Metric.java new file mode 100644 index 0000000000000..8720c9fe2f2b8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Metric.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of Metric. */ +public interface Metric { + /** + * Gets the startTime property: The start time for the metric (ISO-8601 format). + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the endTime property: The end time for the metric (ISO-8601 format). + * + * @return the endTime value. + */ + OffsetDateTime endTime(); + + /** + * Gets the timeGrain property: The time grain to be used to summarize the metric values. + * + * @return the timeGrain value. + */ + String timeGrain(); + + /** + * Gets the unit property: The unit of the metric. + * + * @return the unit value. + */ + UnitType unit(); + + /** + * Gets the name property: The name information for the metric. + * + * @return the name value. + */ + MetricName name(); + + /** + * Gets the metricValues property: The metric values for the specified time window and timestep. + * + * @return the metricValues value. + */ + List metricValues(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.MetricInner object. + * + * @return the inner object. + */ + MetricInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricAvailability.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricAvailability.java new file mode 100644 index 0000000000000..995dffc02b060 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricAvailability.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The availability of the metric. */ +@Immutable +public final class MetricAvailability { + /* + * The time grain to be used to summarize the metric values. + */ + @JsonProperty(value = "timeGrain", access = JsonProperty.Access.WRITE_ONLY) + private String timeGrain; + + /* + * The retention for the metric values. + */ + @JsonProperty(value = "retention", access = JsonProperty.Access.WRITE_ONLY) + private String retention; + + /** 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() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricDefinition.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricDefinition.java new file mode 100644 index 0000000000000..4ca7c84770599 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricDefinition.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricDefinitionInner; +import java.util.List; + +/** An immutable client-side representation of MetricDefinition. */ +public interface MetricDefinition { + /** + * Gets the metricAvailabilities property: The list of metric availabilities for the account. + * + * @return the metricAvailabilities value. + */ + List metricAvailabilities(); + + /** + * Gets the primaryAggregationType property: The primary aggregation type of the metric. + * + * @return the primaryAggregationType value. + */ + PrimaryAggregationType primaryAggregationType(); + + /** + * Gets the unit property: The unit of the metric. + * + * @return the unit value. + */ + UnitType unit(); + + /** + * Gets the resourceUri property: The resource uri of the database. + * + * @return the resourceUri value. + */ + String resourceUri(); + + /** + * Gets the name property: The name information for the metric. + * + * @return the name value. + */ + MetricName name(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.MetricDefinitionInner object. + * + * @return the inner object. + */ + MetricDefinitionInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricDefinitionsListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricDefinitionsListResult.java new file mode 100644 index 0000000000000..de11a266e06a7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricDefinitionsListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricDefinitionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list metric definitions request. */ +@Immutable +public final class MetricDefinitionsListResult { + /* + * The list of metric definitions for the account. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + 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()); + } + } +} 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..ef92d0952e09d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list metrics request. */ +@Immutable +public final class MetricListResult { + /* + * The list of metrics for the account. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + 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()); + } + } +} 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..3dbf14b7f4047 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricName.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A metric name. */ +@Immutable +public final class MetricName { + /* + * The name of the metric. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private String value; + + /* + * The friendly name of the metric. + */ + @JsonProperty(value = "localizedValue", access = JsonProperty.Access.WRITE_ONLY) + private String localizedValue; + + /** 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() { + } +} 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..70cc446ac1ebc --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricValue.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Represents metrics values. */ +@Immutable +public class MetricValue { + /* + * The number of values for the metric. + */ + @JsonProperty(value = "_count", access = JsonProperty.Access.WRITE_ONLY) + private Integer count; + + /* + * The average value of the metric. + */ + @JsonProperty(value = "average", access = JsonProperty.Access.WRITE_ONLY) + private Double average; + + /* + * The max value of the metric. + */ + @JsonProperty(value = "maximum", access = JsonProperty.Access.WRITE_ONLY) + private Double maximum; + + /* + * The min value of the metric. + */ + @JsonProperty(value = "minimum", access = JsonProperty.Access.WRITE_ONLY) + private Double minimum; + + /* + * The metric timestamp (ISO-8601 format). + */ + @JsonProperty(value = "timestamp", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime timestamp; + + /* + * The total value of the metric. + */ + @JsonProperty(value = "total", access = JsonProperty.Access.WRITE_ONLY) + private Double total; + + /** 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; + } + + /** + * Get the average property: The average value of the metric. + * + * @return the average value. + */ + public Double average() { + return this.average; + } + + /** + * Get the maximum property: The max value of the metric. + * + * @return the maximum value. + */ + public Double maximum() { + return this.maximum; + } + + /** + * Get the minimum property: The min value of the metric. + * + * @return the minimum value. + */ + public Double minimum() { + return this.minimum; + } + + /** + * Get the timestamp property: The metric timestamp (ISO-8601 format). + * + * @return the timestamp value. + */ + public OffsetDateTime timestamp() { + return this.timestamp; + } + + /** + * Get the total property: The total value of the metric. + * + * @return the total value. + */ + public Double total() { + return this.total; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/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..427411e3f0191 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MinimalTlsVersion.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * Indicates the minimum allowed Tls version. The default is Tls 1.0, except for Cassandra and Mongo API's, which 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. + */ + @JsonCreator + 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..a434b7f1773dc --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionCreateUpdateParameters.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MongoDBCollectionCreateUpdateProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +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. + */ + @JsonProperty(value = "properties", required = true) + private MongoDBCollectionCreateUpdateProperties innerProperties = new MongoDBCollectionCreateUpdateProperties(); + + /** 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; + } + + /** {@inheritDoc} */ + @Override + public MongoDBCollectionCreateUpdateParameters withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public MongoDBCollectionCreateUpdateParameters withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The standard JSON format of a MongoDB collection. + * + * @return the resource value. + */ + public MongoDBCollectionResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The standard JSON format of a MongoDB collection. + * + * @param resource the resource value to set. + * @return the MongoDBCollectionCreateUpdateParameters object itself. + */ + public MongoDBCollectionCreateUpdateParameters withResource(MongoDBCollectionResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new MongoDBCollectionCreateUpdateProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Get the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @return the options value. + */ + public CreateUpdateOptions options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @param options the options value to set. + * @return the MongoDBCollectionCreateUpdateParameters object itself. + */ + public MongoDBCollectionCreateUpdateParameters withOptions(CreateUpdateOptions options) { + if (this.innerProperties() == null) { + this.innerProperties = new MongoDBCollectionCreateUpdateProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model MongoDBCollectionCreateUpdateParameters")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MongoDBCollectionCreateUpdateParameters.class); +} 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..e1194ac29a136 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionGetPropertiesOptions.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; + +/** 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() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionGetPropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionGetPropertiesResource.java new file mode 100644 index 0000000000000..464b8613ec05c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionGetPropertiesResource.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.fasterxml.jackson.annotation.JsonProperty; +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. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionGetResults.java new file mode 100644 index 0000000000000..29a371d0ed586 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionGetResults.java @@ -0,0 +1,283 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.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..0ea79af87895a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MongoDBCollectionGetResultsInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the MongoDB collections and their properties. */ +@Immutable +public final class MongoDBCollectionListResult { + /* + * List of MongoDB collections and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + 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()); + } + } +} 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..cd86381824400 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionResource.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.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Cosmos DB MongoDB collection resource object. */ +@Fluent +public class MongoDBCollectionResource { + /* + * Name of the Cosmos DB MongoDB collection + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * A key-value pair of shard keys to be applied for the request. + */ + @JsonProperty(value = "shardKey") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map shardKey; + + /* + * List of index keys + */ + @JsonProperty(value = "indexes") + private List indexes; + + /* + * Analytical TTL. + */ + @JsonProperty(value = "analyticalStorageTtl") + private Integer analyticalStorageTtl; + + /** 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model MongoDBCollectionResource")); + } + if (indexes() != null) { + indexes().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MongoDBCollectionResource.class); +} 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..e3d6a7fe8faae --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseCreateUpdateParameters.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MongoDBDatabaseCreateUpdateProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +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. + */ + @JsonProperty(value = "properties", required = true) + private MongoDBDatabaseCreateUpdateProperties innerProperties = new MongoDBDatabaseCreateUpdateProperties(); + + /** 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; + } + + /** {@inheritDoc} */ + @Override + public MongoDBDatabaseCreateUpdateParameters withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public MongoDBDatabaseCreateUpdateParameters withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The standard JSON format of a MongoDB database. + * + * @return the resource value. + */ + public MongoDBDatabaseResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The standard JSON format of a MongoDB database. + * + * @param resource the resource value to set. + * @return the MongoDBDatabaseCreateUpdateParameters object itself. + */ + public MongoDBDatabaseCreateUpdateParameters withResource(MongoDBDatabaseResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new MongoDBDatabaseCreateUpdateProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Get the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @return the options value. + */ + public CreateUpdateOptions options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @param options the options value to set. + * @return the MongoDBDatabaseCreateUpdateParameters object itself. + */ + public MongoDBDatabaseCreateUpdateParameters withOptions(CreateUpdateOptions options) { + if (this.innerProperties() == null) { + this.innerProperties = new MongoDBDatabaseCreateUpdateProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model MongoDBDatabaseCreateUpdateParameters")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MongoDBDatabaseCreateUpdateParameters.class); +} 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..248351a5c2e9a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseGetPropertiesOptions.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; + +/** 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() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseGetPropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseGetPropertiesResource.java new file mode 100644 index 0000000000000..e08d1421f403c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseGetPropertiesResource.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The MongoDBDatabaseGetPropertiesResource model. */ +@Fluent +public final class MongoDBDatabaseGetPropertiesResource extends MongoDBDatabaseResource { + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseGetResults.java new file mode 100644 index 0000000000000..b76480a7150bd --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseGetResults.java @@ -0,0 +1,259 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.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..cf82548452b0b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MongoDBDatabaseGetResultsInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the MongoDB databases and their properties. */ +@Immutable +public final class MongoDBDatabaseListResult { + /* + * List of MongoDB databases and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + 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()); + } + } +} 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..99b365660d89d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseResource.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.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB MongoDB database resource object. */ +@Fluent +public class MongoDBDatabaseResource { + /* + * Name of the Cosmos DB MongoDB database + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model MongoDBDatabaseResource")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MongoDBDatabaseResource.class); +} 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..954d6db47092a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBResources.java @@ -0,0 +1,871 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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..e36ba14c18ff7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoIndex.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB MongoDB collection index key. */ +@Fluent +public final class MongoIndex { + /* + * Cosmos DB MongoDB collection index keys + */ + @JsonProperty(value = "key") + private MongoIndexKeys key; + + /* + * Cosmos DB MongoDB collection index key options + */ + @JsonProperty(value = "options") + private MongoIndexOptions options; + + /** 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(); + } + } +} 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..a0b4551a38848 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoIndexKeys.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Cosmos DB MongoDB collection resource object. */ +@Fluent +public final class MongoIndexKeys { + /* + * List of keys for each MongoDB collection in the Azure Cosmos DB service + */ + @JsonProperty(value = "keys") + 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() { + } +} 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..2fda3659d5897 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoIndexOptions.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB MongoDB collection index options. */ +@Fluent +public final class MongoIndexOptions { + /* + * Expire after seconds + */ + @JsonProperty(value = "expireAfterSeconds") + private Integer expireAfterSeconds; + + /* + * Is unique or not + */ + @JsonProperty(value = "unique") + 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() { + } +} 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..37c342497feb4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoRoleDefinitionCreateUpdateParameters.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.resourcemanager.cosmos.generated.fluent.models.MongoRoleDefinitionResource; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Parameters to create and update an Azure Cosmos DB Mongo Role Definition. */ +@Fluent +public final class MongoRoleDefinitionCreateUpdateParameters { + /* + * Properties to create and update an Azure Cosmos DB Mongo Role Definition. + */ + @JsonProperty(value = "properties") + 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(); + } + } +} 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..e68196640b84b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoRoleDefinitionGetResults.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.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..870b3cef4c67e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoRoleDefinitionListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MongoRoleDefinitionGetResultsInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The relevant Mongo Role Definitions. */ +@Immutable +public final class MongoRoleDefinitionListResult { + /* + * List of Mongo Role Definitions and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + 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()); + } + } +} 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..90d7e7fa92c35 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoRoleDefinitionType.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.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** 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. + */ + @JsonCreator + 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} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/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..ceca4f0936ed1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoUserDefinitionCreateUpdateParameters.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.resourcemanager.cosmos.generated.fluent.models.MongoUserDefinitionResource; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Parameters to create and update an Azure Cosmos DB Mongo User Definition. */ +@Fluent +public final class MongoUserDefinitionCreateUpdateParameters { + /* + * Properties to create and update an Azure Cosmos DB Mongo User Definition. + */ + @JsonProperty(value = "properties") + 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(); + } + } +} 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..42696e07233bf --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoUserDefinitionGetResults.java @@ -0,0 +1,311 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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..d31e63d012f5b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoUserDefinitionListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MongoUserDefinitionGetResultsInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The relevant User Definition. */ +@Immutable +public final class MongoUserDefinitionListResult { + /* + * List of User Definition and their properties + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + 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()); + } + } +} 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..a5a9ee067be33 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NetworkAclBypass.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.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** 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. + */ + @JsonCreator + 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} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NodeState.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NodeState.java new file mode 100644 index 0000000000000..390b52dd7e75a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NodeState.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 com.fasterxml.jackson.annotation.JsonCreator; +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. + */ + @JsonCreator + 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..e6e906833f0af --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspace.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.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..397d8142fc661 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspaceConnectionInfoResult.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.NotebookWorkspaceConnectionInfoResultInner; + +/** An immutable client-side representation of NotebookWorkspaceConnectionInfoResult. */ +public interface NotebookWorkspaceConnectionInfoResult { + /** + * Gets the authToken property: Specifies auth token used for connecting to Notebook server (uses token-based auth). + * + * @return the authToken value. + */ + String authToken(); + + /** + * Gets the notebookServerEndpoint property: Specifies the endpoint of Notebook server. + * + * @return the notebookServerEndpoint value. + */ + String notebookServerEndpoint(); + + /** + * Gets the inner + * com.azure.resourcemanager.cosmos.generated.fluent.models.NotebookWorkspaceConnectionInfoResultInner object. + * + * @return the inner object. + */ + NotebookWorkspaceConnectionInfoResultInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspaceCreateUpdateParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspaceCreateUpdateParameters.java new file mode 100644 index 0000000000000..768d516f8899f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspaceCreateUpdateParameters.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; + +/** Parameters to create a notebook workspace resource. */ +@Immutable +public final class NotebookWorkspaceCreateUpdateParameters extends ArmProxyResource { + /** Creates an instance of NotebookWorkspaceCreateUpdateParameters class. */ + public NotebookWorkspaceCreateUpdateParameters() { + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspaceListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspaceListResult.java new file mode 100644 index 0000000000000..668bdd4cbf5fb --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspaceListResult.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.fluent.models.NotebookWorkspaceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of notebook workspace resources. */ +@Fluent +public final class NotebookWorkspaceListResult { + /* + * Array of notebook workspace resources + */ + @JsonProperty(value = "value") + 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()); + } + } +} 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..9608d212386c3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspaceName.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.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for NotebookWorkspaceName. */ +public final class NotebookWorkspaceName extends ExpandableStringEnum { + /** Static value default for NotebookWorkspaceName. */ + public static final NotebookWorkspaceName DEFAULT = fromString("default"); + + /** + * Creates 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. + */ + @JsonCreator + 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..d7aa01142f189 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspaces.java @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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..76002cb51dcf0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Operation.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.OperationInner; + +/** An immutable client-side representation of Operation. */ +public interface Operation { + /** + * Gets the name property: Operation name: {provider}/{resource}/{operation}. + * + * @return the name value. + */ + String name(); + + /** + * Gets the display property: The object that represents the operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/OperationDisplay.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/OperationDisplay.java new file mode 100644 index 0000000000000..06c88cd6008d9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/OperationDisplay.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The object that represents the operation. */ +@Fluent +public final class OperationDisplay { + /* + * Service provider: Microsoft.ResourceProvider + */ + @JsonProperty(value = "Provider") + private String provider; + + /* + * Resource on which the operation is performed: Profile, endpoint, etc. + */ + @JsonProperty(value = "Resource") + private String resource; + + /* + * Operation type: Read, write, delete, etc. + */ + @JsonProperty(value = "Operation") + private String operation; + + /* + * Description of operation + */ + @JsonProperty(value = "Description") + private String description; + + /** 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() { + } +} 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..21f9debebc026 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/OperationListResult.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Result of the request to list Resource Provider operations. It contains a list of operations and a URL link to get + * the next set of results. + */ +@Fluent +public final class OperationListResult { + /* + * List of operations supported by the Resource Provider. + */ + @JsonProperty(value = "value") + private List value; + + /* + * URL to get the next set of operation list results if there are any. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** 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()); + } + } +} 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..374918308faf4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/OperationType.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +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 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. + */ + @JsonCreator + 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..89f73e56ae5be --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Operations.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.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..c1fcf8fa298d9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/OptionsResource.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB options resource object. */ +@Fluent +public class OptionsResource { + /* + * Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when + * retrieving offer details. + */ + @JsonProperty(value = "throughput") + private Integer throughput; + + /* + * Specifies the Autoscale settings. + */ + @JsonProperty(value = "autoscaleSettings") + private AutoscaleSettings autoscaleSettings; + + /** 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(); + } + } +} 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..818e497ab43ad --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionKeyRangeIdRegions.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of PartitionKeyRangeIdRegions. */ +public interface PartitionKeyRangeIdRegions { + /** + * Retrieves the metrics determined by the given filter for the given partition key range id and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request 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..bcc3caa65d797 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionKeyRangeIds.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of PartitionKeyRangeIds. */ +public interface PartitionKeyRangeIds { + /** + * Retrieves the metrics determined by the given filter for the given partition key range id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request 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..883a04e20f83d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionKind.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +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. + */ + @JsonCreator + 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..b044ed0c8b8f4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionMetric.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionMetricInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of PartitionMetric. */ +public interface PartitionMetric { + /** + * Gets the startTime property: The start time for the metric (ISO-8601 format). + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the endTime property: The end time for the metric (ISO-8601 format). + * + * @return the endTime value. + */ + OffsetDateTime endTime(); + + /** + * Gets the timeGrain property: The time grain to be used to summarize the metric values. + * + * @return the timeGrain value. + */ + String timeGrain(); + + /** + * Gets the unit property: The unit of the metric. + * + * @return the unit value. + */ + UnitType unit(); + + /** + * Gets the name property: The name information for the metric. + * + * @return the name value. + */ + MetricName name(); + + /** + * Gets the metricValues property: The metric values for the specified time window and timestep. + * + * @return the metricValues value. + */ + List metricValues(); + + /** + * Gets the partitionId property: The partition id (GUID identifier) of the metric values. + * + * @return the partitionId value. + */ + String partitionId(); + + /** + * Gets the partitionKeyRangeId property: The partition key range id (integer identifier) of the metric values. + * + * @return the partitionKeyRangeId value. + */ + String partitionKeyRangeId(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionMetricInner object. + * + * @return the inner object. + */ + PartitionMetricInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionMetricListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionMetricListResult.java new file mode 100644 index 0000000000000..1458c1ce819f6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionMetricListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionMetricInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list partition metrics request. */ +@Immutable +public final class PartitionMetricListResult { + /* + * The list of partition-level metrics for the account. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + 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()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionUsage.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionUsage.java new file mode 100644 index 0000000000000..de30efd7d99e2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionUsage.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionUsageInner; + +/** An immutable client-side representation of PartitionUsage. */ +public interface PartitionUsage { + /** + * Gets the unit property: The unit of the metric. + * + * @return the unit value. + */ + UnitType unit(); + + /** + * Gets the name property: The name information for the metric. + * + * @return the name value. + */ + MetricName name(); + + /** + * Gets the quotaPeriod property: The quota period used to summarize the usage values. + * + * @return the quotaPeriod value. + */ + String quotaPeriod(); + + /** + * Gets the limit property: Maximum value for this metric. + * + * @return the limit value. + */ + Long limit(); + + /** + * Gets the currentValue property: Current value for this metric. + * + * @return the currentValue value. + */ + Long currentValue(); + + /** + * Gets the partitionId property: The partition id (GUID identifier) of the usages. + * + * @return the partitionId value. + */ + String partitionId(); + + /** + * Gets the partitionKeyRangeId property: The partition key range id (integer identifier) of the usages. + * + * @return the partitionKeyRangeId value. + */ + String partitionKeyRangeId(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionUsageInner object. + * + * @return the inner object. + */ + PartitionUsageInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionUsagesResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionUsagesResult.java new file mode 100644 index 0000000000000..9ecaae2fdaba0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionUsagesResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionUsageInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list partition level usage request. */ +@Immutable +public final class PartitionUsagesResult { + /* + * The list of partition-level usages for the database. A usage is a point in time metric + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** 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()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PercentileMetric.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PercentileMetric.java new file mode 100644 index 0000000000000..16fa1416ea65a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PercentileMetric.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.PercentileMetricInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of PercentileMetric. */ +public interface PercentileMetric { + /** + * Gets the startTime property: The start time for the metric (ISO-8601 format). + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the endTime property: The end time for the metric (ISO-8601 format). + * + * @return the endTime value. + */ + OffsetDateTime endTime(); + + /** + * Gets the timeGrain property: The time grain to be used to summarize the metric values. + * + * @return the timeGrain value. + */ + String timeGrain(); + + /** + * Gets the unit property: The unit of the metric. + * + * @return the unit value. + */ + UnitType unit(); + + /** + * Gets the name property: The name information for the metric. + * + * @return the name value. + */ + MetricName name(); + + /** + * Gets the metricValues property: The percentile metric values for the specified time window and timestep. + * + * @return the metricValues value. + */ + List metricValues(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.PercentileMetricInner object. + * + * @return the inner object. + */ + PercentileMetricInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PercentileMetricListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PercentileMetricListResult.java new file mode 100644 index 0000000000000..5ef4b58498365 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PercentileMetricListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PercentileMetricInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list percentile metrics request. */ +@Immutable +public final class PercentileMetricListResult { + /* + * The list of percentile metrics for the account. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + 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()); + } + } +} 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..154f20a5d0ea3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PercentileMetricValue.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents percentile metrics values. */ +@Immutable +public final class PercentileMetricValue extends MetricValue { + /* + * The 10th percentile value for the metric. + */ + @JsonProperty(value = "P10", access = JsonProperty.Access.WRITE_ONLY) + private Double p10; + + /* + * The 25th percentile value for the metric. + */ + @JsonProperty(value = "P25", access = JsonProperty.Access.WRITE_ONLY) + private Double p25; + + /* + * The 50th percentile value for the metric. + */ + @JsonProperty(value = "P50", access = JsonProperty.Access.WRITE_ONLY) + private Double p50; + + /* + * The 75th percentile value for the metric. + */ + @JsonProperty(value = "P75", access = JsonProperty.Access.WRITE_ONLY) + private Double p75; + + /* + * The 90th percentile value for the metric. + */ + @JsonProperty(value = "P90", access = JsonProperty.Access.WRITE_ONLY) + private Double p90; + + /* + * The 95th percentile value for the metric. + */ + @JsonProperty(value = "P95", access = JsonProperty.Access.WRITE_ONLY) + private Double p95; + + /* + * The 99th percentile value for the metric. + */ + @JsonProperty(value = "P99", access = JsonProperty.Access.WRITE_ONLY) + private Double p99; + + /** 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PercentileSourceTargets.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PercentileSourceTargets.java new file mode 100644 index 0000000000000..ecb2a38b703df --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PercentileSourceTargets.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of PercentileSourceTargets. */ +public interface PercentileSourceTargets { + /** + * Retrieves the metrics determined by the given filter for the given account, source and target region. This url is + * only for PBS and Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param sourceRegion Source region from which data is written. Cosmos DB region, with spaces between words and + * each word capitalized. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each + * word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request 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..8e7e09c0968c7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PercentileTargets.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of PercentileTargets. */ +public interface PercentileTargets { + /** + * Retrieves the metrics determined by the given filter for the given account target region. This url is only for + * PBS and Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each + * word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request 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..767d4cdaa4859 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Percentiles.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Percentiles. */ +public interface Percentiles { + /** + * Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and + * Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request 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..5220f615ecc60 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PeriodicModeBackupPolicy.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The object representing periodic mode backup policy. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Periodic") +@Fluent +public final class PeriodicModeBackupPolicy extends BackupPolicy { + /* + * Configuration values for periodic mode backup + */ + @JsonProperty(value = "periodicModeProperties") + private PeriodicModeProperties periodicModeProperties; + + /** Creates an instance of PeriodicModeBackupPolicy class. */ + public PeriodicModeBackupPolicy() { + } + + /** + * Get the periodicModeProperties property: Configuration values for periodic mode backup. + * + * @return the periodicModeProperties value. + */ + public PeriodicModeProperties periodicModeProperties() { + return this.periodicModeProperties; + } + + /** + * Set the periodicModeProperties property: Configuration values for periodic mode backup. + * + * @param periodicModeProperties the periodicModeProperties value to set. + * @return the PeriodicModeBackupPolicy object itself. + */ + public PeriodicModeBackupPolicy withPeriodicModeProperties(PeriodicModeProperties periodicModeProperties) { + this.periodicModeProperties = periodicModeProperties; + return this; + } + + /** {@inheritDoc} */ + @Override + public PeriodicModeBackupPolicy withMigrationState(BackupPolicyMigrationState migrationState) { + super.withMigrationState(migrationState); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (periodicModeProperties() != null) { + periodicModeProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PeriodicModeProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PeriodicModeProperties.java new file mode 100644 index 0000000000000..5891a5fbe6aa9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PeriodicModeProperties.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Configuration values for periodic mode backup. */ +@Fluent +public final class PeriodicModeProperties { + /* + * An integer representing the interval in minutes between two backups + */ + @JsonProperty(value = "backupIntervalInMinutes") + private Integer backupIntervalInMinutes; + + /* + * An integer representing the time (in hours) that each backup is retained + */ + @JsonProperty(value = "backupRetentionIntervalInHours") + private Integer backupRetentionIntervalInHours; + + /* + * Enum to indicate type of backup residency + */ + @JsonProperty(value = "backupStorageRedundancy") + private BackupStorageRedundancy backupStorageRedundancy; + + /** 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() { + } +} 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..22882197777ba --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Permission.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The set of data plane operations permitted through this Role Definition. */ +@Fluent +public final class Permission { + /* + * An array of data actions that are allowed. + */ + @JsonProperty(value = "dataActions") + private List dataActions; + + /* + * An array of data actions that are denied. + */ + @JsonProperty(value = "notDataActions") + private List notDataActions; + + /** 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() { + } +} 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..2a8639dac7e3f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrimaryAggregationType.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.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +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. + */ + @JsonCreator + 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..2493cb100df08 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateEndpointConnection.java @@ -0,0 +1,251 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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..5de4673d69825 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateEndpointConnectionListResult.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PrivateEndpointConnectionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of private endpoint connections. */ +@Fluent +public final class PrivateEndpointConnectionListResult { + /* + * Array of private endpoint connections + */ + @JsonProperty(value = "value") + 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()); + } + } +} 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..c303076f03ae4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateEndpointConnections.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of PrivateEndpointConnections. */ +public interface PrivateEndpointConnections { + /** + * List all private endpoint connections on a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private endpoint connections 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..9289348ab5822 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateEndpointProperty.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Private endpoint which the connection belongs to. */ +@Fluent +public final class PrivateEndpointProperty { + /* + * Resource id of the private endpoint. + */ + @JsonProperty(value = "id") + 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() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateLinkResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateLinkResource.java new file mode 100644 index 0000000000000..0cd8da5dfa317 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateLinkResource.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.PrivateLinkResourceInner; +import java.util.List; + +/** An immutable client-side representation of PrivateLinkResource. */ +public interface PrivateLinkResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the groupId property: The private link resource group id. + * + * @return the groupId value. + */ + String groupId(); + + /** + * Gets the requiredMembers property: The private link resource required member names. + * + * @return the requiredMembers value. + */ + List requiredMembers(); + + /** + * Gets the requiredZoneNames property: The private link resource required zone names. + * + * @return the requiredZoneNames value. + */ + List requiredZoneNames(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.PrivateLinkResourceInner object. + * + * @return the inner object. + */ + PrivateLinkResourceInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateLinkResourceListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateLinkResourceListResult.java new file mode 100644 index 0000000000000..fa72807e94cde --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateLinkResourceListResult.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PrivateLinkResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of private link resources. */ +@Fluent +public final class PrivateLinkResourceListResult { + /* + * Array of private link resources + */ + @JsonProperty(value = "value") + 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()); + } + } +} 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..417fe8f7dd7b0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateLinkResources.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.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..358ddd87c3e4f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateLinkServiceConnectionStateProperty.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.fasterxml.jackson.annotation.JsonProperty; + +/** Connection State of the Private Endpoint Connection. */ +@Fluent +public final class PrivateLinkServiceConnectionStateProperty { + /* + * The private link service connection status. + */ + @JsonProperty(value = "status") + private String status; + + /* + * The private link service connection description. + */ + @JsonProperty(value = "description") + private String description; + + /* + * Any action that is required beyond basic workflow (approve/ reject/ disconnect) + */ + @JsonProperty(value = "actionsRequired", access = JsonProperty.Access.WRITE_ONLY) + private String actionsRequired; + + /** 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() { + } +} 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..db03bc814a7b4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Privilege.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The set of data plane operations permitted through this Role Definition. */ +@Fluent +public final class Privilege { + /* + * An Azure Cosmos DB Mongo DB Resource. + */ + @JsonProperty(value = "resource") + private PrivilegeResource resource; + + /* + * An array of actions that are allowed. + */ + @JsonProperty(value = "actions") + 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(); + } + } +} 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..3ece9fd0ae1f3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivilegeResource.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An Azure Cosmos DB Mongo DB Resource. */ +@Fluent +public final class PrivilegeResource { + /* + * The database name the role is applied. + */ + @JsonProperty(value = "db") + private String db; + + /* + * The collection name the role is applied. + */ + @JsonProperty(value = "collection") + 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() { + } +} 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..0dca1e51aad43 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PublicNetworkAccess.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.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +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"); + + /** + * 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. + */ + @JsonCreator + 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..26dee2ab9f4af --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RegionForOnlineOffline.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.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB region to online or offline. */ +@Fluent +public final class RegionForOnlineOffline { + /* + * Cosmos DB region, with spaces between words and each word capitalized. + */ + @JsonProperty(value = "region", required = true) + 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 + .logExceptionAsError( + new IllegalArgumentException("Missing required property region in model RegionForOnlineOffline")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RegionForOnlineOffline.class); +} 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..53ca21d453f5a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RegionalServiceResource.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Resource for a regional service location. */ +@Immutable +public class RegionalServiceResource { + /* + * The regional service name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The location name. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /* + * Describes the status of a service. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private ServiceStatus status; + + /** 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; + } + + /** + * Get the location property: The location name. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the status property: Describes the status of a service. + * + * @return the status value. + */ + public ServiceStatus status() { + return this.status; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/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..1ea862c342d83 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ResourceIdentityType.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * 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. + */ + @JsonCreator + 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} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableDatabaseAccountGetResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableDatabaseAccountGetResult.java new file mode 100644 index 0000000000000..5584ffa5389b1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableDatabaseAccountGetResult.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableDatabaseAccountGetResultInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of RestorableDatabaseAccountGetResult. */ +public interface RestorableDatabaseAccountGetResult { + /** + * Gets the id property: The unique resource identifier of the ARM resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the ARM resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of Azure resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The location of the resource group to which the resource belongs. + * + * @return the location value. + */ + String location(); + + /** + * Gets the accountName property: The name of the global database account. + * + * @return the accountName value. + */ + String accountName(); + + /** + * Gets the creationTime property: The creation time of the restorable database account (ISO-8601 format). + * + * @return the creationTime value. + */ + OffsetDateTime creationTime(); + + /** + * Gets the deletionTime property: The time at which the restorable database account has been deleted (ISO-8601 + * format). + * + * @return the deletionTime value. + */ + OffsetDateTime deletionTime(); + + /** + * Gets the apiType property: The API type of the restorable database account. + * + * @return the apiType value. + */ + ApiType apiType(); + + /** + * Gets the restorableLocations property: List of regions where the of the database account can be restored from. + * + * @return the restorableLocations value. + */ + List restorableLocations(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableDatabaseAccountGetResultInner + * object. + * + * @return the inner object. + */ + RestorableDatabaseAccountGetResultInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableDatabaseAccounts.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableDatabaseAccounts.java new file mode 100644 index 0000000000000..f69bd1ed173ef --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableDatabaseAccounts.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.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..2e8da35ec2af2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableDatabaseAccountsListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableDatabaseAccountGetResultInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the restorable database accounts and their properties. */ +@Immutable +public final class RestorableDatabaseAccountsListResult { + /* + * List of restorable database accounts and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + 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()); + } + } +} 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..048328ffe0ca4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableGremlinDatabaseGetResult.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.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..978e950a87191 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableGremlinDatabasePropertiesResource.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.fasterxml.jackson.annotation.JsonProperty; + +/** The resource of an Azure Cosmos DB Gremlin database event. */ +@Immutable +public final class RestorableGremlinDatabasePropertiesResource { + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * The operation type of this database event. + */ + @JsonProperty(value = "operationType", access = JsonProperty.Access.WRITE_ONLY) + private OperationType operationType; + + /* + * The time when this database event happened. + */ + @JsonProperty(value = "eventTimestamp", access = JsonProperty.Access.WRITE_ONLY) + private String eventTimestamp; + + /* + * The name of this Gremlin database. + */ + @JsonProperty(value = "ownerId", access = JsonProperty.Access.WRITE_ONLY) + private String ownerId; + + /* + * The resource ID of this Gremlin database. + */ + @JsonProperty(value = "ownerResourceId", access = JsonProperty.Access.WRITE_ONLY) + 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 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() { + } +} 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..23863973530ce --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableGremlinDatabases.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of 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..568af70ca5072 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableGremlinDatabasesListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableGremlinDatabaseGetResultInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the Gremlin database events and their properties. */ +@Immutable +public final class RestorableGremlinDatabasesListResult { + /* + * List of Gremlin database events and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + 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()); + } + } +} 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..57ce6b791a128 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableGremlinGraphGetResult.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.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..34b331945f572 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableGremlinGraphPropertiesResource.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.fasterxml.jackson.annotation.JsonProperty; + +/** The resource of an Azure Cosmos DB Gremlin graph event. */ +@Immutable +public final class RestorableGremlinGraphPropertiesResource { + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * The operation type of this graph event. + */ + @JsonProperty(value = "operationType", access = JsonProperty.Access.WRITE_ONLY) + private OperationType operationType; + + /* + * The time when this graph event happened. + */ + @JsonProperty(value = "eventTimestamp", access = JsonProperty.Access.WRITE_ONLY) + private String eventTimestamp; + + /* + * The name of this Gremlin graph. + */ + @JsonProperty(value = "ownerId", access = JsonProperty.Access.WRITE_ONLY) + private String ownerId; + + /* + * The resource ID of this Gremlin graph. + */ + @JsonProperty(value = "ownerResourceId", access = JsonProperty.Access.WRITE_ONLY) + 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 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() { + } +} 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..128e0aa6fab1d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableGremlinGraphs.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.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..038c56f3a6e72 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableGremlinGraphsListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableGremlinGraphGetResultInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the Gremlin graph events and their properties. */ +@Immutable +public final class RestorableGremlinGraphsListResult { + /* + * List of Gremlin graph events and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + 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()); + } + } +} 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..700ea1959eee7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableGremlinResources.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 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..e3cadca52afe4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableGremlinResourcesGetResult.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.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..db14ef7d25bee --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableGremlinResourcesListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableGremlinResourcesGetResultInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the restorable Gremlin resources. */ +@Immutable +public final class RestorableGremlinResourcesListResult { + /* + * List of restorable Gremlin resources, including the gremlin database and graph names. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + 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()); + } + } +} 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..60e9b0d8f1294 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableLocationResource.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.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Properties of the regional restorable account. */ +@Immutable +public final class RestorableLocationResource { + /* + * The location of the regional restorable account. + */ + @JsonProperty(value = "locationName", access = JsonProperty.Access.WRITE_ONLY) + private String locationName; + + /* + * The instance id of the regional restorable account. + */ + @JsonProperty(value = "regionalDatabaseAccountInstanceId", access = JsonProperty.Access.WRITE_ONLY) + private String regionalDatabaseAccountInstanceId; + + /* + * The creation time of the regional restorable database account (ISO-8601 format). + */ + @JsonProperty(value = "creationTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime creationTime; + + /* + * The time at which the regional restorable database account has been deleted (ISO-8601 format). + */ + @JsonProperty(value = "deletionTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime deletionTime; + + /** 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() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbCollectionGetResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbCollectionGetResult.java new file mode 100644 index 0000000000000..62529fb0ffc77 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbCollectionGetResult.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableMongodbCollectionGetResultInner; + +/** An immutable client-side representation of RestorableMongodbCollectionGetResult. */ +public interface RestorableMongodbCollectionGetResult { + /** + * Gets the id property: The unique resource Identifier of the ARM resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the ARM resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of Azure resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the resource property: The resource of an Azure Cosmos DB MongoDB collection event. + * + * @return the resource value. + */ + RestorableMongodbCollectionPropertiesResource resource(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableMongodbCollectionGetResultInner + * object. + * + * @return the inner object. + */ + RestorableMongodbCollectionGetResultInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbCollectionPropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbCollectionPropertiesResource.java new file mode 100644 index 0000000000000..b6e48def2d5d2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbCollectionPropertiesResource.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.fasterxml.jackson.annotation.JsonProperty; + +/** The resource of an Azure Cosmos DB MongoDB collection event. */ +@Immutable +public final class RestorableMongodbCollectionPropertiesResource { + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * The operation type of this collection event. + */ + @JsonProperty(value = "operationType", access = JsonProperty.Access.WRITE_ONLY) + private OperationType operationType; + + /* + * The time when this collection event happened. + */ + @JsonProperty(value = "eventTimestamp", access = JsonProperty.Access.WRITE_ONLY) + private String eventTimestamp; + + /* + * The name of this MongoDB collection. + */ + @JsonProperty(value = "ownerId", access = JsonProperty.Access.WRITE_ONLY) + private String ownerId; + + /* + * The resource ID of this MongoDB collection. + */ + @JsonProperty(value = "ownerResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String ownerResourceId; + + /** 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 eventTimestamp property: The time when this collection event happened. + * + * @return the eventTimestamp value. + */ + public String eventTimestamp() { + return this.eventTimestamp; + } + + /** + * Get the ownerId property: The name of this MongoDB collection. + * + * @return the ownerId value. + */ + public String ownerId() { + return this.ownerId; + } + + /** + * Get the ownerResourceId property: The resource ID of this MongoDB collection. + * + * @return the ownerResourceId value. + */ + public String ownerResourceId() { + return this.ownerResourceId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbCollections.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbCollections.java new file mode 100644 index 0000000000000..b33b6387d1011 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbCollections.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.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..0582e85d4d7fc --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbCollectionsListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableMongodbCollectionGetResultInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the MongoDB collection events and their properties. */ +@Immutable +public final class RestorableMongodbCollectionsListResult { + /* + * List of MongoDB collection events and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + 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()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbDatabaseGetResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbDatabaseGetResult.java new file mode 100644 index 0000000000000..f0e1414c9e7c7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbDatabaseGetResult.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableMongodbDatabaseGetResultInner; + +/** An immutable client-side representation of RestorableMongodbDatabaseGetResult. */ +public interface RestorableMongodbDatabaseGetResult { + /** + * Gets the id property: The unique resource Identifier of the ARM resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the ARM resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of Azure resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the resource property: The resource of an Azure Cosmos DB MongoDB database event. + * + * @return the resource value. + */ + RestorableMongodbDatabasePropertiesResource resource(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableMongodbDatabaseGetResultInner + * object. + * + * @return the inner object. + */ + RestorableMongodbDatabaseGetResultInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbDatabasePropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbDatabasePropertiesResource.java new file mode 100644 index 0000000000000..9aec8fad8d3f0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbDatabasePropertiesResource.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The resource of an Azure Cosmos DB MongoDB database event. */ +@Immutable +public final class RestorableMongodbDatabasePropertiesResource { + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * The operation type of this database event. + */ + @JsonProperty(value = "operationType", access = JsonProperty.Access.WRITE_ONLY) + private OperationType operationType; + + /* + * The time when this database event happened. + */ + @JsonProperty(value = "eventTimestamp", access = JsonProperty.Access.WRITE_ONLY) + private String eventTimestamp; + + /* + * The name of this MongoDB database. + */ + @JsonProperty(value = "ownerId", access = JsonProperty.Access.WRITE_ONLY) + private String ownerId; + + /* + * The resource ID of this MongoDB database. + */ + @JsonProperty(value = "ownerResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String ownerResourceId; + + /** 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 eventTimestamp property: The time when this database event happened. + * + * @return the eventTimestamp value. + */ + public String eventTimestamp() { + return this.eventTimestamp; + } + + /** + * Get the ownerId property: The name of this MongoDB database. + * + * @return the ownerId value. + */ + public String ownerId() { + return this.ownerId; + } + + /** + * Get the ownerResourceId property: The resource ID of this MongoDB database. + * + * @return the ownerResourceId value. + */ + public String ownerResourceId() { + return this.ownerResourceId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbDatabases.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbDatabases.java new file mode 100644 index 0000000000000..59dee1348170a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbDatabases.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of 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..38064aab86730 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbDatabasesListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableMongodbDatabaseGetResultInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the MongoDB database events and their properties. */ +@Immutable +public final class RestorableMongodbDatabasesListResult { + /* + * List of MongoDB database events and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + 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()); + } + } +} 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..6328f0145eefe --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbResources.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 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..d1ffaf0f54ea9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbResourcesGetResult.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.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..ad02775749ac5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbResourcesListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableMongodbResourcesGetResultInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the restorable MongoDB resources. */ +@Immutable +public final class RestorableMongodbResourcesListResult { + /* + * List of restorable MongoDB resources, including the database and collection names. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + 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()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainerGetResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainerGetResult.java new file mode 100644 index 0000000000000..f491902574b3c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainerGetResult.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableSqlContainerGetResultInner; + +/** An immutable client-side representation of RestorableSqlContainerGetResult. */ +public interface RestorableSqlContainerGetResult { + /** + * Gets the id property: The unique resource Identifier of the ARM resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the ARM resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of Azure resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the resource property: The resource of an Azure Cosmos DB SQL container event. + * + * @return the resource value. + */ + RestorableSqlContainerPropertiesResource resource(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableSqlContainerGetResultInner + * object. + * + * @return the inner object. + */ + RestorableSqlContainerGetResultInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainerPropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainerPropertiesResource.java new file mode 100644 index 0000000000000..f201ea1415186 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainerPropertiesResource.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The resource of an Azure Cosmos DB SQL container event. */ +@Fluent +public final class RestorableSqlContainerPropertiesResource { + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * The operation type of this container event. + */ + @JsonProperty(value = "operationType", access = JsonProperty.Access.WRITE_ONLY) + private OperationType operationType; + + /* + * The when this container event happened. + */ + @JsonProperty(value = "eventTimestamp", access = JsonProperty.Access.WRITE_ONLY) + private String eventTimestamp; + + /* + * The name of this SQL container. + */ + @JsonProperty(value = "ownerId", access = JsonProperty.Access.WRITE_ONLY) + private String ownerId; + + /* + * The resource ID of this SQL container. + */ + @JsonProperty(value = "ownerResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String ownerResourceId; + + /* + * Cosmos DB SQL container resource object + */ + @JsonProperty(value = "container") + private RestorableSqlContainerPropertiesResourceContainer container; + + /** 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 eventTimestamp property: The when this container event happened. + * + * @return the eventTimestamp value. + */ + public String eventTimestamp() { + return this.eventTimestamp; + } + + /** + * Get the ownerId property: The name of this SQL container. + * + * @return the ownerId value. + */ + public String ownerId() { + return this.ownerId; + } + + /** + * Get the ownerResourceId property: The resource ID of this SQL container. + * + * @return the ownerResourceId value. + */ + public String ownerResourceId() { + return this.ownerResourceId; + } + + /** + * Get the container property: Cosmos DB SQL container resource object. + * + * @return the container value. + */ + public RestorableSqlContainerPropertiesResourceContainer container() { + return this.container; + } + + /** + * Set the container property: Cosmos DB SQL container resource object. + * + * @param container the container value to set. + * @return the RestorableSqlContainerPropertiesResource object itself. + */ + public RestorableSqlContainerPropertiesResource withContainer( + RestorableSqlContainerPropertiesResourceContainer container) { + this.container = container; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (container() != null) { + container().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainerPropertiesResourceContainer.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainerPropertiesResourceContainer.java new file mode 100644 index 0000000000000..1ac51dab93f27 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainerPropertiesResourceContainer.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.fasterxml.jackson.annotation.JsonProperty; + +/** 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. + */ + @JsonProperty(value = "_self", access = JsonProperty.Access.WRITE_ONLY) + private String self; + + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainers.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainers.java new file mode 100644 index 0000000000000..bc2f82b521222 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainers.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.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..2eba5ac56de17 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainersListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableSqlContainerGetResultInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the SQL container events and their properties. */ +@Immutable +public final class RestorableSqlContainersListResult { + /* + * List of SQL container events and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + 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()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabaseGetResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabaseGetResult.java new file mode 100644 index 0000000000000..424dda4dc4692 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabaseGetResult.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableSqlDatabaseGetResultInner; + +/** An immutable client-side representation of RestorableSqlDatabaseGetResult. */ +public interface RestorableSqlDatabaseGetResult { + /** + * Gets the id property: The unique resource Identifier of the ARM resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the ARM resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of Azure resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the resource property: The resource of an Azure Cosmos DB SQL database event. + * + * @return the resource value. + */ + RestorableSqlDatabasePropertiesResource resource(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableSqlDatabaseGetResultInner + * object. + * + * @return the inner object. + */ + RestorableSqlDatabaseGetResultInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabasePropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabasePropertiesResource.java new file mode 100644 index 0000000000000..9c7f2c671ed62 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabasePropertiesResource.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The resource of an Azure Cosmos DB SQL database event. */ +@Fluent +public final class RestorableSqlDatabasePropertiesResource { + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * The operation type of this database event. + */ + @JsonProperty(value = "operationType", access = JsonProperty.Access.WRITE_ONLY) + private OperationType operationType; + + /* + * The time when this database event happened. + */ + @JsonProperty(value = "eventTimestamp", access = JsonProperty.Access.WRITE_ONLY) + private String eventTimestamp; + + /* + * The name of the SQL database. + */ + @JsonProperty(value = "ownerId", access = JsonProperty.Access.WRITE_ONLY) + private String ownerId; + + /* + * The resource ID of the SQL database. + */ + @JsonProperty(value = "ownerResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String ownerResourceId; + + /* + * Cosmos DB SQL database resource object + */ + @JsonProperty(value = "database") + private RestorableSqlDatabasePropertiesResourceDatabase database; + + /** 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 eventTimestamp property: The time when this database event happened. + * + * @return the eventTimestamp value. + */ + public String eventTimestamp() { + return this.eventTimestamp; + } + + /** + * Get the ownerId property: The name of the SQL database. + * + * @return the ownerId value. + */ + public String ownerId() { + return this.ownerId; + } + + /** + * Get the ownerResourceId property: The resource ID of the SQL database. + * + * @return the ownerResourceId value. + */ + public String ownerResourceId() { + return this.ownerResourceId; + } + + /** + * Get the database property: Cosmos DB SQL database resource object. + * + * @return the database value. + */ + public RestorableSqlDatabasePropertiesResourceDatabase database() { + return this.database; + } + + /** + * Set the database property: Cosmos DB SQL database resource object. + * + * @param database the database value to set. + * @return the RestorableSqlDatabasePropertiesResource object itself. + */ + public RestorableSqlDatabasePropertiesResource withDatabase( + RestorableSqlDatabasePropertiesResourceDatabase database) { + this.database = database; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (database() != null) { + database().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabasePropertiesResourceDatabase.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabasePropertiesResourceDatabase.java new file mode 100644 index 0000000000000..5d284c4f5a8f9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabasePropertiesResourceDatabase.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.fasterxml.jackson.annotation.JsonProperty; + +/** 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. + */ + @JsonProperty(value = "_colls", access = JsonProperty.Access.WRITE_ONLY) + private String colls; + + /* + * A system generated property that specifies the addressable path of the users resource. + */ + @JsonProperty(value = "_users", access = JsonProperty.Access.WRITE_ONLY) + private String users; + + /* + * A system generated property that specifies the addressable path of the database resource. + */ + @JsonProperty(value = "_self", access = JsonProperty.Access.WRITE_ONLY) + private String self; + + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabases.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabases.java new file mode 100644 index 0000000000000..e448c3f10a989 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabases.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of 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..7dfb8702aa9d2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabasesListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableSqlDatabaseGetResultInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the SQL database events and their properties. */ +@Immutable +public final class RestorableSqlDatabasesListResult { + /* + * List of SQL database events and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + 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()); + } + } +} 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..b073816b70cc4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlResources.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 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..28fee3a7f35e2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlResourcesGetResult.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.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..f364b3f84a258 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlResourcesListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableSqlResourcesGetResultInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the restorable SQL resources. */ +@Immutable +public final class RestorableSqlResourcesListResult { + /* + * List of restorable SQL resources, including the database and collection names. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + 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()); + } + } +} 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..375c25c3265af --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableTableGetResult.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.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..7bbff7fc1e5c4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableTablePropertiesResource.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.fasterxml.jackson.annotation.JsonProperty; + +/** The resource of an Azure Cosmos DB Table event. */ +@Immutable +public final class RestorableTablePropertiesResource { + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * The operation type of this table event. + */ + @JsonProperty(value = "operationType", access = JsonProperty.Access.WRITE_ONLY) + private OperationType operationType; + + /* + * The time when this table event happened. + */ + @JsonProperty(value = "eventTimestamp", access = JsonProperty.Access.WRITE_ONLY) + private String eventTimestamp; + + /* + * The name of this Table. + */ + @JsonProperty(value = "ownerId", access = JsonProperty.Access.WRITE_ONLY) + private String ownerId; + + /* + * The resource ID of this Table. + */ + @JsonProperty(value = "ownerResourceId", access = JsonProperty.Access.WRITE_ONLY) + 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 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() { + } +} 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..7fccf5f64d65f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableTableResources.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of 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..2e83116337135 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableTableResourcesGetResult.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.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..47fe70ec95c6e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableTableResourcesListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableTableResourcesGetResultInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of restorable table names. */ +@Immutable +public final class RestorableTableResourcesListResult { + /* + * List of restorable table names. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + 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()); + } + } +} 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..47a5879ad8383 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableTables.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 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..92de52a34cfc9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableTablesListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableTableGetResultInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the Table events and their properties. */ +@Immutable +public final class RestorableTablesListResult { + /* + * List of Table events and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + 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()); + } + } +} 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..c22008cce6db0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestoreMode.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.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +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. + */ + @JsonCreator + 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..aadb49f9538b2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestoreParameters.java @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Parameters to indicate the information about the restore. */ +@Fluent +public final class RestoreParameters { + /* + * Describes the mode of the restore. + */ + @JsonProperty(value = "restoreMode") + private RestoreMode restoreMode; + + /* + * The id of the restorable database account from which the restore has to be initiated. For example: + * /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName} + */ + @JsonProperty(value = "restoreSource") + private String restoreSource; + + /* + * Time to which the account has to be restored (ISO-8601 format). + */ + @JsonProperty(value = "restoreTimestampInUtc") + private OffsetDateTime restoreTimestampInUtc; + + /* + * List of specific databases available for restore. + */ + @JsonProperty(value = "databasesToRestore") + private List databasesToRestore; + + /* + * List of specific gremlin databases available for restore. + */ + @JsonProperty(value = "gremlinDatabasesToRestore") + private List gremlinDatabasesToRestore; + + /* + * List of specific tables available for restore. + */ + @JsonProperty(value = "tablesToRestore") + 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 restoreSource property: The id of the restorable database account from which the restore has to be + * initiated. For example: + * /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName}. + * + * @return the restoreSource value. + */ + public String restoreSource() { + return this.restoreSource; + } + + /** + * Set the restoreSource property: The id of the restorable database account from which the restore has to be + * initiated. For example: + * /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName}. + * + * @param restoreSource the restoreSource value to set. + * @return the RestoreParameters object itself. + */ + public RestoreParameters withRestoreSource(String restoreSource) { + this.restoreSource = restoreSource; + return this; + } + + /** + * Get the restoreTimestampInUtc property: Time to which the account has to be restored (ISO-8601 format). + * + * @return the restoreTimestampInUtc value. + */ + public OffsetDateTime restoreTimestampInUtc() { + return this.restoreTimestampInUtc; + } + + /** + * Set the restoreTimestampInUtc property: Time to which the account has to be restored (ISO-8601 format). + * + * @param restoreTimestampInUtc the restoreTimestampInUtc value to set. + * @return the RestoreParameters object itself. + */ + public RestoreParameters withRestoreTimestampInUtc(OffsetDateTime restoreTimestampInUtc) { + this.restoreTimestampInUtc = restoreTimestampInUtc; + return this; + } + + /** + * Get the databasesToRestore property: List of specific databases available for restore. + * + * @return the databasesToRestore value. + */ + public List databasesToRestore() { + return this.databasesToRestore; + } + + /** + * Set the databasesToRestore property: List of specific databases available for restore. + * + * @param databasesToRestore the databasesToRestore value to set. + * @return the RestoreParameters object itself. + */ + public RestoreParameters withDatabasesToRestore(List databasesToRestore) { + this.databasesToRestore = databasesToRestore; + return this; + } + + /** + * 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (databasesToRestore() != null) { + databasesToRestore().forEach(e -> e.validate()); + } + if (gremlinDatabasesToRestore() != null) { + gremlinDatabasesToRestore().forEach(e -> e.validate()); + } + } +} 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..b8990109241ff --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Role.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The set of roles permitted through this Role Definition. */ +@Fluent +public final class Role { + /* + * The database name the role is applied. + */ + @JsonProperty(value = "db") + private String db; + + /* + * The role name. + */ + @JsonProperty(value = "role") + 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() { + } +} 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..850919bfff49e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RoleDefinitionType.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.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** 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. + */ + @JsonCreator + 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} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SeedNode.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SeedNode.java new file mode 100644 index 0000000000000..e04e5e98bb6fd --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SeedNode.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The SeedNode model. */ +@Fluent +public final class SeedNode { + /* + * IP address of this seed node. + */ + @JsonProperty(value = "ipAddress") + 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() { + } +} 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..c0d2296f74d56 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServerVersion.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Describes the ServerVersion of an a 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"); + + /** + * 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. + */ + @JsonCreator + 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..311531e29905e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServiceResource.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ServiceResourceInner; + +/** An immutable client-side representation of ServiceResource. */ +public interface ServiceResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: Services response resource. + * + * @return the properties value. + */ + ServiceResourceProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.ServiceResourceInner object. + * + * @return the inner object. + */ + ServiceResourceInner innerModel(); + + /** The entirety of the ServiceResource definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ServiceResource definition stages. */ + interface DefinitionStages { + /** The first stage of the ServiceResource definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ServiceResource definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, accountName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @return the next definition stage. + */ + WithCreate withExistingDatabaseAccount(String resourceGroupName, String accountName); + } + /** + * The stage of the ServiceResource definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithInstanceSize, + DefinitionStages.WithInstanceCount, + DefinitionStages.WithServiceType { + /** + * Executes the create request. + * + * @return the created resource. + */ + ServiceResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ServiceResource create(Context context); + } + /** The stage of the ServiceResource definition allowing to specify instanceSize. */ + interface WithInstanceSize { + /** + * Specifies the instanceSize property: Instance type for the service.. + * + * @param instanceSize Instance type for the service. + * @return the next definition stage. + */ + WithCreate withInstanceSize(ServiceSize instanceSize); + } + /** The stage of the ServiceResource definition allowing to specify instanceCount. */ + interface WithInstanceCount { + /** + * Specifies the instanceCount property: Instance count for the service.. + * + * @param instanceCount Instance count for the service. + * @return the next definition stage. + */ + WithCreate withInstanceCount(Integer instanceCount); + } + /** The stage of the ServiceResource definition allowing to specify serviceType. */ + interface WithServiceType { + /** + * Specifies the serviceType property: ServiceType for the service.. + * + * @param serviceType ServiceType for the service. + * @return the next definition stage. + */ + WithCreate withServiceType(ServiceType serviceType); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ServiceResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ServiceResource refresh(Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServiceResourceCreateUpdateParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServiceResourceCreateUpdateParameters.java new file mode 100644 index 0000000000000..e989c8fa16dde --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServiceResourceCreateUpdateParameters.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ServiceResourceCreateUpdateProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Parameters for Create or Update Request for ServiceResource. */ +@Fluent +public final class ServiceResourceCreateUpdateParameters { + /* + * Properties in ServiceResourceCreateUpdateParameters. + */ + @JsonProperty(value = "properties") + private ServiceResourceCreateUpdateProperties innerProperties; + + /** Creates an instance of ServiceResourceCreateUpdateParameters class. */ + public ServiceResourceCreateUpdateParameters() { + } + + /** + * Get the innerProperties property: Properties in ServiceResourceCreateUpdateParameters. + * + * @return the innerProperties value. + */ + private ServiceResourceCreateUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the instanceSize property: Instance type for the service. + * + * @return the instanceSize value. + */ + public ServiceSize instanceSize() { + return this.innerProperties() == null ? null : this.innerProperties().instanceSize(); + } + + /** + * Set the instanceSize property: Instance type for the service. + * + * @param instanceSize the instanceSize value to set. + * @return the ServiceResourceCreateUpdateParameters object itself. + */ + public ServiceResourceCreateUpdateParameters withInstanceSize(ServiceSize instanceSize) { + if (this.innerProperties() == null) { + this.innerProperties = new ServiceResourceCreateUpdateProperties(); + } + this.innerProperties().withInstanceSize(instanceSize); + return this; + } + + /** + * Get the instanceCount property: Instance count for the service. + * + * @return the instanceCount value. + */ + public Integer instanceCount() { + return this.innerProperties() == null ? null : this.innerProperties().instanceCount(); + } + + /** + * Set the instanceCount property: Instance count for the service. + * + * @param instanceCount the instanceCount value to set. + * @return the ServiceResourceCreateUpdateParameters object itself. + */ + public ServiceResourceCreateUpdateParameters withInstanceCount(Integer instanceCount) { + if (this.innerProperties() == null) { + this.innerProperties = new ServiceResourceCreateUpdateProperties(); + } + this.innerProperties().withInstanceCount(instanceCount); + return this; + } + + /** + * Get the serviceType property: ServiceType for the service. + * + * @return the serviceType value. + */ + public ServiceType serviceType() { + return this.innerProperties() == null ? null : this.innerProperties().serviceType(); + } + + /** + * Set the serviceType property: ServiceType for the service. + * + * @param serviceType the serviceType value to set. + * @return the ServiceResourceCreateUpdateParameters object itself. + */ + public ServiceResourceCreateUpdateParameters withServiceType(ServiceType serviceType) { + if (this.innerProperties() == null) { + this.innerProperties = new ServiceResourceCreateUpdateProperties(); + } + this.innerProperties().withServiceType(serviceType); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServiceResourceListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServiceResourceListResult.java new file mode 100644 index 0000000000000..070289bb65639 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServiceResourceListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ServiceResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the Service Resource and their properties. */ +@Immutable +public final class ServiceResourceListResult { + /* + * List of Service Resource and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + 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()); + } + } +} 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..1936d77a574b1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServiceResourceProperties.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.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; + +/** Services response resource. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "serviceType", + defaultImpl = ServiceResourceProperties.class) +@JsonTypeName("ServiceResourceProperties") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "DataTransfer", value = DataTransferServiceResourceProperties.class), + @JsonSubTypes.Type(name = "SqlDedicatedGateway", value = SqlDedicatedGatewayServiceResourceProperties.class), + @JsonSubTypes.Type(name = "GraphAPICompute", value = GraphApiComputeServiceResourceProperties.class), + @JsonSubTypes.Type( + name = "MaterializedViewsBuilder", + value = MaterializedViewsBuilderServiceResourceProperties.class) +}) +@Fluent +public class ServiceResourceProperties { + /* + * Time of the last state change (ISO-8601 format). + */ + @JsonProperty(value = "creationTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime creationTime; + + /* + * Instance type for the service. + */ + @JsonProperty(value = "instanceSize") + private ServiceSize instanceSize; + + /* + * Instance count for the service. + */ + @JsonProperty(value = "instanceCount") + private Integer instanceCount; + + /* + * Describes the status of a service. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private ServiceStatus status; + + /* + * Services response resource. + */ + @JsonIgnore private Map additionalProperties; + + /** Creates an instance of ServiceResourceProperties class. */ + public ServiceResourceProperties() { + } + + /** + * Get the creationTime property: Time of the last state change (ISO-8601 format). + * + * @return the creationTime value. + */ + public OffsetDateTime creationTime() { + return this.creationTime; + } + + /** + * Get the instanceSize property: Instance type for the service. + * + * @return the instanceSize value. + */ + public ServiceSize instanceSize() { + return this.instanceSize; + } + + /** + * Set the instanceSize property: Instance type for the service. + * + * @param instanceSize the instanceSize value to set. + * @return the ServiceResourceProperties object itself. + */ + public ServiceResourceProperties withInstanceSize(ServiceSize instanceSize) { + this.instanceSize = instanceSize; + return this; + } + + /** + * Get the instanceCount property: Instance count for the service. + * + * @return the instanceCount value. + */ + public Integer instanceCount() { + return this.instanceCount; + } + + /** + * Set the instanceCount property: Instance count for the service. + * + * @param instanceCount the instanceCount value to set. + * @return the ServiceResourceProperties object itself. + */ + public ServiceResourceProperties withInstanceCount(Integer instanceCount) { + this.instanceCount = instanceCount; + return this; + } + + /** + * Get the status property: Describes the status of a service. + * + * @return the status value. + */ + public ServiceStatus status() { + return this.status; + } + + /** + * Get the additionalProperties property: Services response resource. + * + * @return the additionalProperties value. + */ + @JsonAnyGetter + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: Services response resource. + * + * @param additionalProperties the additionalProperties value to set. + * @return the ServiceResourceProperties object itself. + */ + public ServiceResourceProperties withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + @JsonAnySetter + void withAdditionalProperties(String key, Object value) { + if (additionalProperties == null) { + additionalProperties = new HashMap<>(); + } + additionalProperties.put(key, value); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServiceSize.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServiceSize.java new file mode 100644 index 0000000000000..f66f27c92e871 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServiceSize.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +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. + */ + @JsonCreator + 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..67b0237599486 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServiceStatus.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.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +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. + */ + @JsonCreator + 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..115ad30ea2182 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServiceType.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +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. + */ + @JsonCreator + 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..9c24ed2e8a9bf --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Services.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Services. */ +public interface Services { + /** + * Gets the status of service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of service 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..cc7429ce6dd08 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SpatialSpec.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The SpatialSpec model. */ +@Fluent +public final class SpatialSpec { + /* + * The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard + * (/path/*) + */ + @JsonProperty(value = "path") + private String path; + + /* + * List of path's spatial type + */ + @JsonProperty(value = "types") + private List types; + + /** 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() { + } +} 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..faae7088ee790 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SpatialType.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +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. + */ + @JsonCreator + 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..a467b479aa7d2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerCreateUpdateParameters.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlContainerCreateUpdateProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +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. + */ + @JsonProperty(value = "properties", required = true) + private SqlContainerCreateUpdateProperties innerProperties = new SqlContainerCreateUpdateProperties(); + + /** 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; + } + + /** {@inheritDoc} */ + @Override + public SqlContainerCreateUpdateParameters withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlContainerCreateUpdateParameters withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The standard JSON format of a container. + * + * @return the resource value. + */ + public SqlContainerResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The standard JSON format of a container. + * + * @param resource the resource value to set. + * @return the SqlContainerCreateUpdateParameters object itself. + */ + public SqlContainerCreateUpdateParameters withResource(SqlContainerResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlContainerCreateUpdateProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Get the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @return the options value. + */ + public CreateUpdateOptions options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @param options the options value to set. + * @return the SqlContainerCreateUpdateParameters object itself. + */ + public SqlContainerCreateUpdateParameters withOptions(CreateUpdateOptions options) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlContainerCreateUpdateProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model SqlContainerCreateUpdateParameters")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlContainerCreateUpdateParameters.class); +} 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..7a7d80395c276 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerGetPropertiesOptions.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; + +/** 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() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerGetPropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerGetPropertiesResource.java new file mode 100644 index 0000000000000..e2f175981b316 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerGetPropertiesResource.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.fasterxml.jackson.annotation.JsonProperty; + +/** The SqlContainerGetPropertiesResource model. */ +@Fluent +public final class SqlContainerGetPropertiesResource extends SqlContainerResource { + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerGetResults.java new file mode 100644 index 0000000000000..d44ea095e8001 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerGetResults.java @@ -0,0 +1,283 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.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..c4d588a32d23f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlContainerGetResultsInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the containers and their properties. */ +@Immutable +public final class SqlContainerListResult { + /* + * List of containers and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + 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()); + } + } +} 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..b1662111030f7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerResource.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB SQL container resource object. */ +@Fluent +public class SqlContainerResource { + /* + * Name of the Cosmos DB SQL container + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * The configuration of the indexing policy. By default, the indexing is automatic for all document paths within + * the container + */ + @JsonProperty(value = "indexingPolicy") + private IndexingPolicy indexingPolicy; + + /* + * The configuration of the partition key to be used for partitioning data into multiple partitions + */ + @JsonProperty(value = "partitionKey") + private ContainerPartitionKey partitionKey; + + /* + * Default time to live + */ + @JsonProperty(value = "defaultTtl") + private Integer defaultTtl; + + /* + * The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the + * Azure Cosmos DB service. + */ + @JsonProperty(value = "uniqueKeyPolicy") + private UniqueKeyPolicy uniqueKeyPolicy; + + /* + * The conflict resolution policy for the container. + */ + @JsonProperty(value = "conflictResolutionPolicy") + private ConflictResolutionPolicy conflictResolutionPolicy; + + /* + * The client encryption policy for the container. + */ + @JsonProperty(value = "clientEncryptionPolicy") + private ClientEncryptionPolicy clientEncryptionPolicy; + + /* + * Analytical TTL. + */ + @JsonProperty(value = "analyticalStorageTtl") + private Long analyticalStorageTtl; + + /** 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model SqlContainerResource")); + } + if (indexingPolicy() != null) { + indexingPolicy().validate(); + } + if (partitionKey() != null) { + partitionKey().validate(); + } + if (uniqueKeyPolicy() != null) { + uniqueKeyPolicy().validate(); + } + if (conflictResolutionPolicy() != null) { + conflictResolutionPolicy().validate(); + } + if (clientEncryptionPolicy() != null) { + clientEncryptionPolicy().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlContainerResource.class); +} 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..29dee6062ae7f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseCreateUpdateParameters.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlDatabaseCreateUpdateProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +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. + */ + @JsonProperty(value = "properties", required = true) + private SqlDatabaseCreateUpdateProperties innerProperties = new SqlDatabaseCreateUpdateProperties(); + + /** 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; + } + + /** {@inheritDoc} */ + @Override + public SqlDatabaseCreateUpdateParameters withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlDatabaseCreateUpdateParameters withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The standard JSON format of a SQL database. + * + * @return the resource value. + */ + public SqlDatabaseResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The standard JSON format of a SQL database. + * + * @param resource the resource value to set. + * @return the SqlDatabaseCreateUpdateParameters object itself. + */ + public SqlDatabaseCreateUpdateParameters withResource(SqlDatabaseResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlDatabaseCreateUpdateProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Get the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @return the options value. + */ + public CreateUpdateOptions options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @param options the options value to set. + * @return the SqlDatabaseCreateUpdateParameters object itself. + */ + public SqlDatabaseCreateUpdateParameters withOptions(CreateUpdateOptions options) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlDatabaseCreateUpdateProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model SqlDatabaseCreateUpdateParameters")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlDatabaseCreateUpdateParameters.class); +} 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..e734c5ab468cf --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseGetPropertiesOptions.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; + +/** 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() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseGetPropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseGetPropertiesResource.java new file mode 100644 index 0000000000000..0418a535332ff --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseGetPropertiesResource.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The SqlDatabaseGetPropertiesResource model. */ +@Fluent +public final class SqlDatabaseGetPropertiesResource extends SqlDatabaseResource { + /* + * A system generated property that specified the addressable path of the collections resource. + */ + @JsonProperty(value = "_colls") + private String colls; + + /* + * A system generated property that specifies the addressable path of the users resource. + */ + @JsonProperty(value = "_users") + private String users; + + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseGetResults.java new file mode 100644 index 0000000000000..052db2095c958 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseGetResults.java @@ -0,0 +1,259 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.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..626f6006919f7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlDatabaseGetResultsInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the SQL databases and their properties. */ +@Immutable +public final class SqlDatabaseListResult { + /* + * List of SQL databases and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + 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()); + } + } +} 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..0ce2bc6b051fa --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseResource.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.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB SQL database resource object. */ +@Fluent +public class SqlDatabaseResource { + /* + * Name of the Cosmos DB SQL database + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model SqlDatabaseResource")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlDatabaseResource.class); +} 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..7f2baee3e9506 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDedicatedGatewayRegionalServiceResource.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Resource for a regional service location. */ +@Immutable +public final class SqlDedicatedGatewayRegionalServiceResource extends RegionalServiceResource { + /* + * The regional endpoint for SqlDedicatedGateway. + */ + @JsonProperty(value = "sqlDedicatedGatewayEndpoint", access = JsonProperty.Access.WRITE_ONLY) + private String sqlDedicatedGatewayEndpoint; + + /** 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDedicatedGatewayServiceResourceProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDedicatedGatewayServiceResourceProperties.java new file mode 100644 index 0000000000000..12a49c3994c11 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDedicatedGatewayServiceResourceProperties.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.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +/** Properties for SqlDedicatedGatewayServiceResource. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "serviceType") +@JsonTypeName("SqlDedicatedGateway") +@Fluent +public final class SqlDedicatedGatewayServiceResourceProperties extends ServiceResourceProperties { + /* + * SqlDedicatedGateway endpoint for the service. + */ + @JsonProperty(value = "sqlDedicatedGatewayEndpoint") + private String sqlDedicatedGatewayEndpoint; + + /* + * An array that contains all of the locations for the service. + */ + @JsonProperty(value = "locations", access = JsonProperty.Access.WRITE_ONLY) + private List locations; + + /** Creates an instance of SqlDedicatedGatewayServiceResourceProperties class. */ + public SqlDedicatedGatewayServiceResourceProperties() { + } + + /** + * Get the sqlDedicatedGatewayEndpoint property: SqlDedicatedGateway endpoint for the service. + * + * @return the sqlDedicatedGatewayEndpoint value. + */ + public String sqlDedicatedGatewayEndpoint() { + return this.sqlDedicatedGatewayEndpoint; + } + + /** + * Set the sqlDedicatedGatewayEndpoint property: SqlDedicatedGateway endpoint for the service. + * + * @param sqlDedicatedGatewayEndpoint the sqlDedicatedGatewayEndpoint value to set. + * @return the SqlDedicatedGatewayServiceResourceProperties object itself. + */ + public SqlDedicatedGatewayServiceResourceProperties withSqlDedicatedGatewayEndpoint( + String sqlDedicatedGatewayEndpoint) { + this.sqlDedicatedGatewayEndpoint = sqlDedicatedGatewayEndpoint; + return this; + } + + /** + * Get the locations property: An array that contains all of the locations for the service. + * + * @return the locations value. + */ + public List locations() { + return this.locations; + } + + /** {@inheritDoc} */ + @Override + public SqlDedicatedGatewayServiceResourceProperties withInstanceSize(ServiceSize instanceSize) { + super.withInstanceSize(instanceSize); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlDedicatedGatewayServiceResourceProperties withInstanceCount(Integer instanceCount) { + super.withInstanceCount(instanceCount); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (locations() != null) { + locations().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlResources.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlResources.java new file mode 100644 index 0000000000000..940fce44ea2be --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlResources.java @@ -0,0 +1,1456 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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..77bb7e2f8aef0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlRoleAssignmentCreateUpdateParameters.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlRoleAssignmentResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Parameters to create and update an Azure Cosmos DB SQL Role Assignment. */ +@Fluent +public final class SqlRoleAssignmentCreateUpdateParameters { + /* + * Properties to create and update an Azure Cosmos DB SQL Role Assignment. + */ + @JsonProperty(value = "properties") + 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(); + } + } +} 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..85612353be874 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlRoleAssignmentGetResults.java @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.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..238a5b7ebbe82 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlRoleAssignmentListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlRoleAssignmentGetResultsInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The relevant Role Assignments. */ +@Immutable +public final class SqlRoleAssignmentListResult { + /* + * List of Role Assignments and their properties + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + 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()); + } + } +} 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..be575721043ec --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlRoleDefinitionCreateUpdateParameters.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlRoleDefinitionResource; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Parameters to create and update an Azure Cosmos DB SQL Role Definition. */ +@Fluent +public final class SqlRoleDefinitionCreateUpdateParameters { + /* + * Properties to create and update an Azure Cosmos DB SQL Role Definition. + */ + @JsonProperty(value = "properties") + 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(); + } + } +} 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..d16f496bab715 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlRoleDefinitionGetResults.java @@ -0,0 +1,269 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.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..cda220009d041 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlRoleDefinitionListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlRoleDefinitionGetResultsInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The relevant Role Definitions. */ +@Immutable +public final class SqlRoleDefinitionListResult { + /* + * List of Role Definitions and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + 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()); + } + } +} 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..70b73ab74efce --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlStoredProcedureCreateUpdateParameters.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlStoredProcedureCreateUpdateProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +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. + */ + @JsonProperty(value = "properties", required = true) + private SqlStoredProcedureCreateUpdateProperties innerProperties = new SqlStoredProcedureCreateUpdateProperties(); + + /** 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; + } + + /** {@inheritDoc} */ + @Override + public SqlStoredProcedureCreateUpdateParameters withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlStoredProcedureCreateUpdateParameters withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The standard JSON format of a storedProcedure. + * + * @return the resource value. + */ + public SqlStoredProcedureResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The standard JSON format of a storedProcedure. + * + * @param resource the resource value to set. + * @return the SqlStoredProcedureCreateUpdateParameters object itself. + */ + public SqlStoredProcedureCreateUpdateParameters withResource(SqlStoredProcedureResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlStoredProcedureCreateUpdateProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Get the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @return the options value. + */ + public CreateUpdateOptions options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @param options the options value to set. + * @return the SqlStoredProcedureCreateUpdateParameters object itself. + */ + public SqlStoredProcedureCreateUpdateParameters withOptions(CreateUpdateOptions options) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlStoredProcedureCreateUpdateProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model SqlStoredProcedureCreateUpdateParameters")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlStoredProcedureCreateUpdateParameters.class); +} 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..39eb9555c7c35 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlStoredProcedureGetPropertiesResource.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.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The SqlStoredProcedureGetPropertiesResource model. */ +@Fluent +public final class SqlStoredProcedureGetPropertiesResource extends SqlStoredProcedureResource { + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** 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() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlStoredProcedureGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlStoredProcedureGetResults.java new file mode 100644 index 0000000000000..9f0e8c52cbc9a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlStoredProcedureGetResults.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.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..cf2b5398aa2cb --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlStoredProcedureListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlStoredProcedureGetResultsInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the storedProcedures and their properties. */ +@Immutable +public final class SqlStoredProcedureListResult { + /* + * List of storedProcedures and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + 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()); + } + } +} 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..edf86f8df72da --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlStoredProcedureResource.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB SQL storedProcedure resource object. */ +@Fluent +public class SqlStoredProcedureResource { + /* + * Name of the Cosmos DB SQL storedProcedure + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * Body of the Stored Procedure + */ + @JsonProperty(value = "body") + private String body; + + /** 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 + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model SqlStoredProcedureResource")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlStoredProcedureResource.class); +} 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..8343d938a7829 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlTriggerCreateUpdateParameters.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlTriggerCreateUpdateProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +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. + */ + @JsonProperty(value = "properties", required = true) + private SqlTriggerCreateUpdateProperties innerProperties = new SqlTriggerCreateUpdateProperties(); + + /** 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; + } + + /** {@inheritDoc} */ + @Override + public SqlTriggerCreateUpdateParameters withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlTriggerCreateUpdateParameters withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The standard JSON format of a trigger. + * + * @return the resource value. + */ + public SqlTriggerResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The standard JSON format of a trigger. + * + * @param resource the resource value to set. + * @return the SqlTriggerCreateUpdateParameters object itself. + */ + public SqlTriggerCreateUpdateParameters withResource(SqlTriggerResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlTriggerCreateUpdateProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Get the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @return the options value. + */ + public CreateUpdateOptions options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @param options the options value to set. + * @return the SqlTriggerCreateUpdateParameters object itself. + */ + public SqlTriggerCreateUpdateParameters withOptions(CreateUpdateOptions options) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlTriggerCreateUpdateProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model SqlTriggerCreateUpdateParameters")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlTriggerCreateUpdateParameters.class); +} 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..346cd82c3bbdb --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlTriggerGetPropertiesResource.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.fasterxml.jackson.annotation.JsonProperty; + +/** The SqlTriggerGetPropertiesResource model. */ +@Fluent +public final class SqlTriggerGetPropertiesResource extends SqlTriggerResource { + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** 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() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlTriggerGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlTriggerGetResults.java new file mode 100644 index 0000000000000..abefd14225ab2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlTriggerGetResults.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.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..60c4bdaba788d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlTriggerListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlTriggerGetResultsInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the triggers and their properties. */ +@Immutable +public final class SqlTriggerListResult { + /* + * List of triggers and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + 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()); + } + } +} 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..af33e7018b1a0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlTriggerResource.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB SQL trigger resource object. */ +@Fluent +public class SqlTriggerResource { + /* + * Name of the Cosmos DB SQL trigger + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * Body of the Trigger + */ + @JsonProperty(value = "body") + private String body; + + /* + * Type of the Trigger + */ + @JsonProperty(value = "triggerType") + private TriggerType triggerType; + + /* + * The operation the trigger is associated with + */ + @JsonProperty(value = "triggerOperation") + private TriggerOperation triggerOperation; + + /** 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 + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model SqlTriggerResource")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlTriggerResource.class); +} 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..d03f2f6caaa9f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlUserDefinedFunctionCreateUpdateParameters.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlUserDefinedFunctionCreateUpdateProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Parameters to create and update Cosmos DB userDefinedFunction. */ +@Fluent +public final class SqlUserDefinedFunctionCreateUpdateParameters extends ArmResourceProperties { + /* + * Properties to create and update Azure Cosmos DB userDefinedFunction. + */ + @JsonProperty(value = "properties", required = true) + private SqlUserDefinedFunctionCreateUpdateProperties innerProperties = + new SqlUserDefinedFunctionCreateUpdateProperties(); + + /** 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; + } + + /** {@inheritDoc} */ + @Override + public SqlUserDefinedFunctionCreateUpdateParameters withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlUserDefinedFunctionCreateUpdateParameters withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The standard JSON format of a userDefinedFunction. + * + * @return the resource value. + */ + public SqlUserDefinedFunctionResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The standard JSON format of a userDefinedFunction. + * + * @param resource the resource value to set. + * @return the SqlUserDefinedFunctionCreateUpdateParameters object itself. + */ + public SqlUserDefinedFunctionCreateUpdateParameters withResource(SqlUserDefinedFunctionResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlUserDefinedFunctionCreateUpdateProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Get the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @return the options value. + */ + public CreateUpdateOptions options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @param options the options value to set. + * @return the SqlUserDefinedFunctionCreateUpdateParameters object itself. + */ + public SqlUserDefinedFunctionCreateUpdateParameters withOptions(CreateUpdateOptions options) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlUserDefinedFunctionCreateUpdateProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model" + + " SqlUserDefinedFunctionCreateUpdateParameters")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlUserDefinedFunctionCreateUpdateParameters.class); +} 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..8c176ee636e22 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlUserDefinedFunctionGetPropertiesResource.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.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The SqlUserDefinedFunctionGetPropertiesResource model. */ +@Fluent +public final class SqlUserDefinedFunctionGetPropertiesResource extends SqlUserDefinedFunctionResource { + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** 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() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlUserDefinedFunctionGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlUserDefinedFunctionGetResults.java new file mode 100644 index 0000000000000..ad20296d60f31 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlUserDefinedFunctionGetResults.java @@ -0,0 +1,256 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.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..88332b27536e9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlUserDefinedFunctionListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlUserDefinedFunctionGetResultsInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the userDefinedFunctions and their properties. */ +@Immutable +public final class SqlUserDefinedFunctionListResult { + /* + * List of userDefinedFunctions and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + 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()); + } + } +} 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..c37b9f086b39b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlUserDefinedFunctionResource.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB SQL userDefinedFunction resource object. */ +@Fluent +public class SqlUserDefinedFunctionResource { + /* + * Name of the Cosmos DB SQL userDefinedFunction + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * Body of the User Defined Function + */ + @JsonProperty(value = "body") + private String body; + + /** 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 + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property id in model SqlUserDefinedFunctionResource")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlUserDefinedFunctionResource.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..1205c4a31a78d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableCreateUpdateParameters.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.TableCreateUpdateProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +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. + */ + @JsonProperty(value = "properties", required = true) + private TableCreateUpdateProperties innerProperties = new TableCreateUpdateProperties(); + + /** 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; + } + + /** {@inheritDoc} */ + @Override + public TableCreateUpdateParameters withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public TableCreateUpdateParameters withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The standard JSON format of a Table. + * + * @return the resource value. + */ + public TableResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The standard JSON format of a Table. + * + * @param resource the resource value to set. + * @return the TableCreateUpdateParameters object itself. + */ + public TableCreateUpdateParameters withResource(TableResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new TableCreateUpdateProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Get the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @return the options value. + */ + public CreateUpdateOptions options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @param options the options value to set. + * @return the TableCreateUpdateParameters object itself. + */ + public TableCreateUpdateParameters withOptions(CreateUpdateOptions options) { + if (this.innerProperties() == null) { + this.innerProperties = new TableCreateUpdateProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model TableCreateUpdateParameters")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(TableCreateUpdateParameters.class); +} 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..2c0fc7868d676 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableGetPropertiesOptions.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; + +/** 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() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableGetPropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableGetPropertiesResource.java new file mode 100644 index 0000000000000..a0572eb4b4a13 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableGetPropertiesResource.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The TableGetPropertiesResource model. */ +@Fluent +public final class TableGetPropertiesResource extends TableResource { + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableGetResults.java new file mode 100644 index 0000000000000..df1eca57d31f6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableGetResults.java @@ -0,0 +1,282 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.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..eb720e70f95f9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.cosmos.generated.fluent.models.TableGetResultsInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the Table and their properties. */ +@Immutable +public final class TableListResult { + /* + * List of Table and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + 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()); + } + } +} 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..761aed6ef1af2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableResource.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.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB table resource object. */ +@Fluent +public class TableResource { + /* + * Name of the Cosmos DB table + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model TableResource")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(TableResource.class); +} 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..62cfcd7fe0e40 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableResources.java @@ -0,0 +1,308 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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..4a433f03f0787 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ThroughputPolicyResource.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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB resource throughput policy. */ +@Fluent +public final class ThroughputPolicyResource { + /* + * Determines whether the ThroughputPolicy is active or not + */ + @JsonProperty(value = "isEnabled") + private Boolean isEnabled; + + /* + * Represents the percentage by which throughput can increase every time throughput policy kicks in. + */ + @JsonProperty(value = "incrementPercent") + private Integer incrementPercent; + + /** 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() { + } +} 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..2c40d5e64b364 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ThroughputSettingsGetPropertiesResource.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.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ThroughputSettingsGetPropertiesResource model. */ +@Fluent +public final class ThroughputSettingsGetPropertiesResource extends ThroughputSettingsResource { + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** 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; + } + + /** {@inheritDoc} */ + @Override + public ThroughputSettingsGetPropertiesResource withThroughput(Integer throughput) { + super.withThroughput(throughput); + return this; + } + + /** {@inheritDoc} */ + @Override + public ThroughputSettingsGetPropertiesResource withAutoscaleSettings(AutoscaleSettingsResource autoscaleSettings) { + super.withAutoscaleSettings(autoscaleSettings); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ThroughputSettingsGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ThroughputSettingsGetResults.java new file mode 100644 index 0000000000000..a55c3fc25375b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ThroughputSettingsGetResults.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.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..4f3281944f5e3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ThroughputSettingsResource.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Cosmos DB resource throughput object. Either throughput is required or autoscaleSettings is required, but not both. + */ +@Fluent +public class ThroughputSettingsResource { + /* + * Value of the Cosmos DB resource throughput. Either throughput is required or autoscaleSettings is required, but + * not both. + */ + @JsonProperty(value = "throughput") + private Integer throughput; + + /* + * Cosmos DB resource for autoscale settings. Either throughput is required or autoscaleSettings is required, but + * not both. + */ + @JsonProperty(value = "autoscaleSettings") + private AutoscaleSettingsResource autoscaleSettings; + + /* + * The minimum throughput of the resource + */ + @JsonProperty(value = "minimumThroughput", access = JsonProperty.Access.WRITE_ONLY) + private String minimumThroughput; + + /* + * The throughput replace is pending + */ + @JsonProperty(value = "offerReplacePending", access = JsonProperty.Access.WRITE_ONLY) + private String offerReplacePending; + + /** 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; + } + + /** + * Get the offerReplacePending property: The throughput replace is pending. + * + * @return the offerReplacePending value. + */ + public String offerReplacePending() { + return this.offerReplacePending; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (autoscaleSettings() != null) { + autoscaleSettings().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ThroughputSettingsUpdateParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ThroughputSettingsUpdateParameters.java new file mode 100644 index 0000000000000..da41f3aaeed7d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ThroughputSettingsUpdateParameters.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ThroughputSettingsUpdateProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +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. + */ + @JsonProperty(value = "properties", required = true) + private ThroughputSettingsUpdateProperties innerProperties = new ThroughputSettingsUpdateProperties(); + + /** 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; + } + + /** {@inheritDoc} */ + @Override + public ThroughputSettingsUpdateParameters withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ThroughputSettingsUpdateParameters withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The standard JSON format of a resource throughput. + * + * @return the resource value. + */ + public ThroughputSettingsResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The standard JSON format of a resource throughput. + * + * @param resource the resource value to set. + * @return the ThroughputSettingsUpdateParameters object itself. + */ + public ThroughputSettingsUpdateParameters withResource(ThroughputSettingsResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new ThroughputSettingsUpdateProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model ThroughputSettingsUpdateParameters")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ThroughputSettingsUpdateParameters.class); +} 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..10fd3dac3bc0e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TriggerOperation.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 com.fasterxml.jackson.annotation.JsonCreator; +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. + */ + @JsonCreator + 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..59721c126732d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TriggerType.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.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +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. + */ + @JsonCreator + 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/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..1294faf7cc99c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/UniqueKey.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The unique key on that enforces uniqueness constraint on documents in the collection in the Azure Cosmos DB service. + */ +@Fluent +public final class UniqueKey { + /* + * List of paths must be unique for each document in the Azure Cosmos DB service + */ + @JsonProperty(value = "paths") + 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() { + } +} 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..193fe559cd3dc --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/UniqueKeyPolicy.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure + * Cosmos DB service. + */ +@Fluent +public final class UniqueKeyPolicy { + /* + * List of unique keys on that enforces uniqueness constraint on documents in the collection in the Azure Cosmos DB + * service. + */ + @JsonProperty(value = "uniqueKeys") + private List uniqueKeys; + + /** 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()); + } + } +} 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..d3d4919370cff --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/UnitType.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.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +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. + */ + @JsonCreator + 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..f19cb41736ea2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Usage.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.UsageInner; + +/** An immutable client-side representation of Usage. */ +public interface Usage { + /** + * Gets the unit property: The unit of the metric. + * + * @return the unit value. + */ + UnitType unit(); + + /** + * Gets the name property: The name information for the metric. + * + * @return the name value. + */ + MetricName name(); + + /** + * Gets the quotaPeriod property: The quota period used to summarize the usage values. + * + * @return the quotaPeriod value. + */ + String quotaPeriod(); + + /** + * Gets the limit property: Maximum value for this metric. + * + * @return the limit value. + */ + Long limit(); + + /** + * Gets the currentValue property: Current value for this metric. + * + * @return the currentValue value. + */ + Long currentValue(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.UsageInner object. + * + * @return the inner object. + */ + UsageInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/UsagesResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/UsagesResult.java new file mode 100644 index 0000000000000..fb0784bed02c0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/UsagesResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.cosmos.generated.fluent.models.UsageInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list usage request. */ +@Immutable +public final class UsagesResult { + /* + * The list of usages for the database. A usage is a point in time metric + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** 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()); + } + } +} 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..b735d6a51439d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/VirtualNetworkRule.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Virtual Network ACL Rule object. */ +@Fluent +public final class VirtualNetworkRule { + /* + * Resource ID of a subnet, for example: + * /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + */ + @JsonProperty(value = "id") + private String id; + + /* + * Create firewall rule before the virtual network has vnet service endpoint enabled. + */ + @JsonProperty(value = "ignoreMissingVNetServiceEndpoint") + private Boolean ignoreMissingVNetServiceEndpoint; + + /** 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() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/package-info.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/package-info.java new file mode 100644 index 0000000000000..824557a190c26 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the data models for CosmosDBManagementClient. Azure Cosmos DB Database Service Resource Provider + * REST API. + */ +package com.azure.resourcemanager.cosmos.generated.models; diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/package-info.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/package-info.java new file mode 100644 index 0000000000000..562d43a115bc3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the classes for CosmosDBManagementClient. Azure Cosmos DB Database Service Resource Provider REST + * API. + */ +package com.azure.resourcemanager.cosmos.generated; diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/module-info.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/module-info.java new file mode 100644 index 0000000000000..dae49a8d560d0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/module-info.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.cosmos.generated { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.cosmos.generated; + exports com.azure.resourcemanager.cosmos.generated.fluent; + exports com.azure.resourcemanager.cosmos.generated.fluent.models; + exports com.azure.resourcemanager.cosmos.generated.models; + + opens com.azure.resourcemanager.cosmos.generated.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.cosmos.generated.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersCreateUpdateSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersCreateUpdateSamples.java new file mode 100644 index 0000000000000..153fed6915dee --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersCreateUpdateSamples.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.resourcemanager.cosmos.generated.models.AuthenticationMethod; +import com.azure.resourcemanager.cosmos.generated.models.Certificate; +import com.azure.resourcemanager.cosmos.generated.models.ClusterResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.SeedNode; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for CassandraClusters CreateUpdate. */ +public final class CassandraClustersCreateUpdateSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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(); + } + + @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..f3ef48125f758 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersDeallocateSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft 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/2022-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..c04689f869a97 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersDeleteSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft 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/2022-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..85b3beba238f6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersGetByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +/** Samples for CassandraClusters GetByResourceGroup. */ +public final class CassandraClustersGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..12595527697c4 --- /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/2022-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..331bb7f86921f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersListByResourceGroupSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft 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/2022-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..4fe1869ce8916 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft 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/2022-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..a2b7d061f3443 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersStartSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft 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/2022-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..55001a72ad4be --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersStatusSamples.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 CassandraClusters Status. */ +public final class CassandraClustersStatusSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..fc4ed6990d024 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersUpdateSamples.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.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/2022-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(); + } + + @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..ab13cfc782c78 --- /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/2022-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..40ee2d044a855 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraDataCentersDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +/** Samples for CassandraDataCenters Delete. */ +public final class CassandraDataCentersDeleteSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..a754e8e4263cf --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraDataCentersGetSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +/** Samples for CassandraDataCenters Get. */ +public final class CassandraDataCentersGetSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..55b9aa3496c3b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraDataCentersListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft 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/2022-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..a24d3140c2c7b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraDataCentersUpdateSamples.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.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/2022-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..61b881b54c838 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesCreateUpdateCassandraKeyspaceSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.resourcemanager.cosmos.generated.models.CassandraKeyspaceResource; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import java.util.HashMap; +import java.util.Map; + +/** Samples for CassandraResources CreateUpdateCassandraKeyspace. */ +public final class CassandraResourcesCreateUpdateCassandraKeyspaceSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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(); + } + + @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..eb55c2ebe0961 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesCreateUpdateCassandraTableSamples.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.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/2022-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(); + } + + @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..808aeea10b389 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesDeleteCassandraKeyspaceSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +/** Samples for CassandraResources DeleteCassandraKeyspace. */ +public final class CassandraResourcesDeleteCassandraKeyspaceSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..260210d855d7c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesDeleteCassandraTableSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +/** Samples for CassandraResources DeleteCassandraTable. */ +public final class CassandraResourcesDeleteCassandraTableSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..55fb6f18a455f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesGetCassandraKeyspaceSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +/** Samples for CassandraResources GetCassandraKeyspace. */ +public final class CassandraResourcesGetCassandraKeyspaceSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..c2a19ba20bf96 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesGetCassandraKeyspaceThroughputSamples.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 GetCassandraKeyspaceThroughput. */ +public final class CassandraResourcesGetCassandraKeyspaceThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..a2a60026bda54 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesGetCassandraTableSamples.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 CassandraResources GetCassandraTable. */ +public final class CassandraResourcesGetCassandraTableSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..d5d622289d3d7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesGetCassandraTableThroughputSamples.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 GetCassandraTableThroughput. */ +public final class CassandraResourcesGetCassandraTableThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..c04d0ebc9e7b7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesListCassandraKeyspacesSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft 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/2022-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..20cf5ed8ab010 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesListCassandraTablesSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +/** Samples for CassandraResources ListCassandraTables. */ +public final class CassandraResourcesListCassandraTablesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..e1cfbad679ba0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesMigrateCassandraKeyspaceToAutoscaleSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +/** Samples for CassandraResources MigrateCassandraKeyspaceToAutoscale. */ +public final class CassandraResourcesMigrateCassandraKeyspaceToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..ce46472d39636 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesMigrateCassandraKeyspaceToManualThroughputSamples.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 MigrateCassandraKeyspaceToManualThroughput. */ +public final class CassandraResourcesMigrateCassandraKeyspaceToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..16cb6537a7596 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesMigrateCassandraTableToAutoscaleSamples.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 MigrateCassandraTableToAutoscale. */ +public final class CassandraResourcesMigrateCassandraTableToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..863b89e1fd5d8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesMigrateCassandraTableToManualThroughputSamples.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 MigrateCassandraTableToManualThroughput. */ +public final class CassandraResourcesMigrateCassandraTableToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..d565597103d4c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesUpdateCassandraKeyspaceThroughputSamples.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.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/2022-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); + } + + @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..132a7ffa2d98d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesUpdateCassandraTableThroughputSamples.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.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/2022-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); + } + + @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..5d619b39e1030 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CollectionListMetricDefinitionsSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +/** Samples for Collection ListMetricDefinitions. */ +public final class CollectionListMetricDefinitionsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..bfdffc74c84ed --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CollectionListMetricsSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +/** Samples for Collection ListMetrics. */ +public final class CollectionListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..f7dfb42f4ef69 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CollectionListUsagesSamples.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; + +/** Samples for Collection ListUsages. */ +public final class CollectionListUsagesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..cacd5a11c8967 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CollectionPartitionListMetricsSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +/** Samples for CollectionPartition ListMetrics. */ +public final class CollectionPartitionListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..70a6e49316b0e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CollectionPartitionListUsagesSamples.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; + +/** Samples for CollectionPartition ListUsages. */ +public final class CollectionPartitionListUsagesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..01578979de6a9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CollectionPartitionRegionListMetricsSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +/** Samples for CollectionPartitionRegion ListMetrics. */ +public final class CollectionPartitionRegionListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..e5f62b66eb761 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CollectionRegionListMetricsSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +/** Samples for CollectionRegion ListMetrics. */ +public final class CollectionRegionListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..b615f5e74823f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountRegionListMetricsSamples.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; + +/** Samples for DatabaseAccountRegion ListMetrics. */ +public final class DatabaseAccountRegionListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..d280b6197ebc6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsCheckNameExistsSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft 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/2022-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..251b87317f587 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsCreateOrUpdateSamples.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.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.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/2022-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()) + .withRestoreParameters( + new RestoreParameters() + .withRestoreMode(RestoreMode.POINT_IN_TIME) + .withRestoreSource( + "/subscriptions/subid/providers/Microsoft.DocumentDB/locations/westus/restorableDatabaseAccounts/1a97b4bb-f6a0-430e-ade1-638d781830cc") + .withRestoreTimestampInUtc(OffsetDateTime.parse("2021-03-11T22:05:09Z")) + .withDatabasesToRestore( + Arrays + .asList( + new 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/2022-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) + .create(); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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(); + } + + @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..fb7df90b31f03 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsDeleteSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft 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/2022-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..609becee133e3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsFailoverPriorityChangeSamples.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.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/2022-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..38533fcd69d97 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsGetByResourceGroupSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft 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/2022-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..0db87690cd236 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsGetReadOnlyKeysSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft 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/2022-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..b25f513ee6eca --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsListByResourceGroupSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft 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/2022-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..99ef7e566679e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsListConnectionStringsSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +/** Samples for DatabaseAccounts ListConnectionStrings. */ +public final class DatabaseAccountsListConnectionStringsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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/2022-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..720f42ed1831d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsListKeysSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft 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/2022-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..6cc51edba5d98 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsListMetricDefinitionsSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft 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/2022-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..88af3d5658737 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsListMetricsSamples.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; + +/** Samples for DatabaseAccounts ListMetrics. */ +public final class DatabaseAccountsListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..83c006bdcb057 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsListReadOnlyKeysSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft 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/2022-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..a9836e96dbdaf --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsListSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft 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/2022-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..c80b24acd9820 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsListUsagesSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +/** Samples for DatabaseAccounts ListUsages. */ +public final class DatabaseAccountsListUsagesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..318688ef3987b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsOfflineRegionSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.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/2022-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(), 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..5712a240bb530 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsOnlineRegionSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.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/2022-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(), 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..a0b4aaef0308e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsRegenerateKeySamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.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/2022-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..d1ebe0b88b542 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsUpdateSamples.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft 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/2022-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) + .apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseListMetricDefinitionsSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseListMetricDefinitionsSamples.java new file mode 100644 index 0000000000000..060c7279c1398 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseListMetricDefinitionsSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft 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/2022-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..e39c5c3753eb9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseListMetricsSamples.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; + +/** Samples for Database ListMetrics. */ +public final class DatabaseListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..4154506e2e093 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseListUsagesSamples.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 Database ListUsages. */ +public final class DatabaseListUsagesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..3822483043a2f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesCreateUpdateGremlinDatabaseSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.GremlinDatabaseResource; +import java.util.HashMap; +import java.util.Map; + +/** Samples for GremlinResources CreateUpdateGremlinDatabase. */ +public final class GremlinResourcesCreateUpdateGremlinDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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(); + } + + @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..b1b5bccbf07b9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesCreateUpdateGremlinGraphSamples.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.resourcemanager.cosmos.generated.models.ConflictResolutionMode; +import com.azure.resourcemanager.cosmos.generated.models.ConflictResolutionPolicy; +import com.azure.resourcemanager.cosmos.generated.models.ContainerPartitionKey; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.DataType; +import com.azure.resourcemanager.cosmos.generated.models.GremlinGraphResource; +import com.azure.resourcemanager.cosmos.generated.models.IncludedPath; +import com.azure.resourcemanager.cosmos.generated.models.IndexKind; +import com.azure.resourcemanager.cosmos.generated.models.Indexes; +import com.azure.resourcemanager.cosmos.generated.models.IndexingMode; +import com.azure.resourcemanager.cosmos.generated.models.IndexingPolicy; +import com.azure.resourcemanager.cosmos.generated.models.PartitionKind; +import com.azure.resourcemanager.cosmos.generated.models.UniqueKey; +import com.azure.resourcemanager.cosmos.generated.models.UniqueKeyPolicy; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for GremlinResources CreateUpdateGremlinGraph. */ +public final class GremlinResourcesCreateUpdateGremlinGraphSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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(); + } + + @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..45c7132e4e76b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesDeleteGremlinDatabaseSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +/** Samples for GremlinResources DeleteGremlinDatabase. */ +public final class GremlinResourcesDeleteGremlinDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..148bfa650dfce --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesDeleteGremlinGraphSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +/** Samples for GremlinResources DeleteGremlinGraph. */ +public final class GremlinResourcesDeleteGremlinGraphSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..b6cfc2e9cdb82 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesGetGremlinDatabaseSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +/** Samples for GremlinResources GetGremlinDatabase. */ +public final class GremlinResourcesGetGremlinDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..80d9d18479569 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesGetGremlinDatabaseThroughputSamples.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 GetGremlinDatabaseThroughput. */ +public final class GremlinResourcesGetGremlinDatabaseThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..0e0c2339299ec --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesGetGremlinGraphSamples.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 GetGremlinGraph. */ +public final class GremlinResourcesGetGremlinGraphSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..750d8f4ffc2c1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesGetGremlinGraphThroughputSamples.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 GetGremlinGraphThroughput. */ +public final class GremlinResourcesGetGremlinGraphThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..c07d41dd655a8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesListGremlinDatabasesSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft 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/2022-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..a176ac88ab03e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesListGremlinGraphsSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +/** Samples for GremlinResources ListGremlinGraphs. */ +public final class GremlinResourcesListGremlinGraphsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..c89a08874a3db --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesMigrateGremlinDatabaseToAutoscaleSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +/** Samples for GremlinResources MigrateGremlinDatabaseToAutoscale. */ +public final class GremlinResourcesMigrateGremlinDatabaseToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..20424a51b84d8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesMigrateGremlinDatabaseToManualThroughputSamples.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 MigrateGremlinDatabaseToManualThroughput. */ +public final class GremlinResourcesMigrateGremlinDatabaseToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..c0dcef2740b52 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesMigrateGremlinGraphToAutoscaleSamples.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 MigrateGremlinGraphToAutoscale. */ +public final class GremlinResourcesMigrateGremlinGraphToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..b59ecf7a41e6d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesMigrateGremlinGraphToManualThroughputSamples.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 MigrateGremlinGraphToManualThroughput. */ +public final class GremlinResourcesMigrateGremlinGraphToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..68ea30f0f5904 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesRetrieveContinuousBackupInformationSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.resourcemanager.cosmos.generated.models.ContinuousBackupRestoreLocation; + +/** Samples for GremlinResources RetrieveContinuousBackupInformation. */ +public final class GremlinResourcesRetrieveContinuousBackupInformationSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..5457e62a3f0ed --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesUpdateGremlinDatabaseThroughputSamples.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.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/2022-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); + } + + @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..5b53e2cc0ab1b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesUpdateGremlinGraphThroughputSamples.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.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/2022-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); + } + + @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..db1ef807a5541 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/LocationsGetSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft 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/2022-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..16f95ce23e5a9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/LocationsListSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft 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/2022-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..1cc28838a4a5c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesCreateUpdateMongoDBCollectionSamples.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.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/2022-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", "Hash")) + .withIndexes( + Arrays + .asList( + new MongoIndex() + .withKey(new MongoIndexKeys().withKeys(Arrays.asList("_ts"))) + .withOptions(new MongoIndexOptions().withExpireAfterSeconds(100).withUnique(true)), + new MongoIndex().withKey(new MongoIndexKeys().withKeys(Arrays.asList("_id")))))) + .withTags(mapOf()) + .withOptions(new CreateUpdateOptions()) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesCreateUpdateMongoDBDatabaseSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesCreateUpdateMongoDBDatabaseSamples.java new file mode 100644 index 0000000000000..ab5904c1e2eac --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesCreateUpdateMongoDBDatabaseSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBDatabaseResource; +import java.util.HashMap; +import java.util.Map; + +/** Samples for MongoDBResources CreateUpdateMongoDBDatabase. */ +public final class MongoDBResourcesCreateUpdateMongoDBDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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(); + } + + @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..ef3df2f334488 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesCreateUpdateMongoRoleDefinitionSamples.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; + +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/2022-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..232ff8f31e5b0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesCreateUpdateMongoUserDefinitionSamples.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.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/2022-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..dabc7bfc476e3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesDeleteMongoDBCollectionSamples.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 DeleteMongoDBCollection. */ +public final class MongoDBResourcesDeleteMongoDBCollectionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..2ff013ede4624 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesDeleteMongoDBDatabaseSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +/** Samples for MongoDBResources DeleteMongoDBDatabase. */ +public final class MongoDBResourcesDeleteMongoDBDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..9a8cd4644ec7d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesDeleteMongoRoleDefinitionSamples.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 DeleteMongoRoleDefinition. */ +public final class MongoDBResourcesDeleteMongoRoleDefinitionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..e4ff1bce63af0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesDeleteMongoUserDefinitionSamples.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 DeleteMongoUserDefinition. */ +public final class MongoDBResourcesDeleteMongoUserDefinitionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..ba6d7a54cd57c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesGetMongoDBCollectionSamples.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 GetMongoDBCollection. */ +public final class MongoDBResourcesGetMongoDBCollectionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..8de8581b6548a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesGetMongoDBCollectionThroughputSamples.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 GetMongoDBCollectionThroughput. */ +public final class MongoDBResourcesGetMongoDBCollectionThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..7de08c45dcecd --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesGetMongoDBDatabaseSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +/** Samples for MongoDBResources GetMongoDBDatabase. */ +public final class MongoDBResourcesGetMongoDBDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..b393a7f52e20c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesGetMongoDBDatabaseThroughputSamples.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 GetMongoDBDatabaseThroughput. */ +public final class MongoDBResourcesGetMongoDBDatabaseThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..e5928f4b7bdab --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesGetMongoRoleDefinitionSamples.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 GetMongoRoleDefinition. */ +public final class MongoDBResourcesGetMongoRoleDefinitionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..c307f1424472e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesGetMongoUserDefinitionSamples.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 GetMongoUserDefinition. */ +public final class MongoDBResourcesGetMongoUserDefinitionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..3eae0e20ead8e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesListMongoDBCollectionsSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +/** Samples for MongoDBResources ListMongoDBCollections. */ +public final class MongoDBResourcesListMongoDBCollectionsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..e23f0bd166993 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesListMongoDBDatabasesSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft 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/2022-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..dd152aa7700c8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesListMongoRoleDefinitionsSamples.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 ListMongoRoleDefinitions. */ +public final class MongoDBResourcesListMongoRoleDefinitionsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..299f30f462dea --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesListMongoUserDefinitionsSamples.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 ListMongoUserDefinitions. */ +public final class MongoDBResourcesListMongoUserDefinitionsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..e6c7a39ed0964 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesMigrateMongoDBCollectionToAutoscaleSamples.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 MigrateMongoDBCollectionToAutoscale. */ +public final class MongoDBResourcesMigrateMongoDBCollectionToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..72fa4e073aae8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesMigrateMongoDBCollectionToManualThroughputSamples.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 MigrateMongoDBCollectionToManualThroughput. */ +public final class MongoDBResourcesMigrateMongoDBCollectionToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..5b8d4fc7021ee --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +/** Samples for MongoDBResources MigrateMongoDBDatabaseToAutoscale. */ +public final class MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..fbdece0c8ed73 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputSamples.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 MigrateMongoDBDatabaseToManualThroughput. */ +public final class MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..460fbca92ee89 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesRetrieveContinuousBackupInformationSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.resourcemanager.cosmos.generated.models.ContinuousBackupRestoreLocation; + +/** Samples for MongoDBResources RetrieveContinuousBackupInformation. */ +public final class MongoDBResourcesRetrieveContinuousBackupInformationSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..69a290ebcd3b4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesUpdateMongoDBCollectionThroughputSamples.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.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/2022-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); + } + + @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..5ceff438a5748 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesUpdateMongoDBDatabaseThroughputSamples.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.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/2022-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); + } + + @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..a90ddda2746be --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/NotebookWorkspacesCreateOrUpdateSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.resourcemanager.cosmos.generated.models.NotebookWorkspaceName; + +/** Samples for NotebookWorkspaces CreateOrUpdate. */ +public final class NotebookWorkspacesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..fca932018b5d3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/NotebookWorkspacesDeleteSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.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/2022-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..f19cc73e9633f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/NotebookWorkspacesGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.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/2022-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..d94d16935bb89 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/NotebookWorkspacesListByDatabaseAccountSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft 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/2022-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..5051ff3da9f44 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/NotebookWorkspacesListConnectionInfoSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.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/2022-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..19f99fd02aea6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/NotebookWorkspacesRegenerateAuthTokenSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.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/2022-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..71e70909b7171 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/NotebookWorkspacesStartSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.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/2022-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..5d71fcc086f66 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/OperationsListSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft 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/2022-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..a409a640eef50 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PartitionKeyRangeIdListMetricsSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +/** Samples for PartitionKeyRangeId ListMetrics. */ +public final class PartitionKeyRangeIdListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..a8015ce5b607b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PartitionKeyRangeIdRegionListMetricsSamples.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 PartitionKeyRangeIdRegion ListMetrics. */ +public final class PartitionKeyRangeIdRegionListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..67b07870afb2a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PercentileListMetricsSamples.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; + +/** Samples for Percentile ListMetrics. */ +public final class PercentileListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..a3e8e487d673a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PercentileSourceTargetListMetricsSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +/** Samples for PercentileSourceTarget ListMetrics. */ +public final class PercentileSourceTargetListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..f14f0d940ef9b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PercentileTargetListMetricsSamples.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; + +/** Samples for PercentileTarget ListMetrics. */ +public final class PercentileTargetListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..6fc61944f316f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PrivateEndpointConnectionsCreateOrUpdateSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.resourcemanager.cosmos.generated.models.PrivateLinkServiceConnectionStateProperty; + +/** Samples for PrivateEndpointConnections CreateOrUpdate. */ +public final class PrivateEndpointConnectionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..3cfdd10f24458 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PrivateEndpointConnectionsDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +/** Samples for PrivateEndpointConnections Delete. */ +public final class PrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..d262689b37f50 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PrivateEndpointConnectionsGetSamples.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 PrivateEndpointConnections Get. */ +public final class PrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..fe99cb2a7af23 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PrivateEndpointConnectionsListByDatabaseAccountSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft 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/2022-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..72954fb67779c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PrivateLinkResourcesGetSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft 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/2022-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..755344d7a661d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PrivateLinkResourcesListByDatabaseAccountSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft 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/2022-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..d74c5506aa711 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableDatabaseAccountsGetByLocationSamples.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 GetByLocation. */ +public final class RestorableDatabaseAccountsGetByLocationSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..38395fb006845 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableDatabaseAccountsListByLocationSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft 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/2022-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..5251cf75c5030 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableDatabaseAccountsListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft 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/2022-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..644237f2f644b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableGremlinDatabasesListSamples.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 RestorableGremlinDatabases List. */ +public final class RestorableGremlinDatabasesListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..8e74073684946 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableGremlinGraphsListSamples.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; + +/** Samples for RestorableGremlinGraphs List. */ +public final class RestorableGremlinGraphsListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..ec8e9d5901646 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableGremlinResourcesListSamples.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; + +/** Samples for RestorableGremlinResources List. */ +public final class RestorableGremlinResourcesListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..207f993d89cf9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableMongodbCollectionsListSamples.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; + +/** Samples for RestorableMongodbCollections List. */ +public final class RestorableMongodbCollectionsListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..7d072d2f07919 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableMongodbDatabasesListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +/** Samples for RestorableMongodbDatabases List. */ +public final class RestorableMongodbDatabasesListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..8443c510885ec --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableMongodbResourcesListSamples.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; + +/** Samples for RestorableMongodbResources List. */ +public final class RestorableMongodbResourcesListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..6c72add0ee6d3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableSqlContainersListSamples.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; + +/** Samples for RestorableSqlContainers List. */ +public final class RestorableSqlContainersListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..c6cd723bc3a9d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableSqlDatabasesListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +/** Samples for RestorableSqlDatabases List. */ +public final class RestorableSqlDatabasesListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..6977d62ebe6a9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableSqlResourcesListSamples.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; + +/** Samples for RestorableSqlResources List. */ +public final class RestorableSqlResourcesListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..c20e937c64247 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableTableResourcesListSamples.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; + +/** Samples for RestorableTableResources List. */ +public final class RestorableTableResourcesListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..e26d8692bf1d9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableTablesListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +/** Samples for RestorableTables List. */ +public final class RestorableTablesListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..dc1f3a8973549 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/ServiceCreateSamples.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.generated; + +import com.azure.resourcemanager.cosmos.generated.models.ServiceSize; +import com.azure.resourcemanager.cosmos.generated.models.ServiceType; + +/** Samples for Service Create. */ +public final class ServiceCreateSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlDedicatedGatewayServiceCreate.json + */ + /** + * Sample code: SqlDedicatedGatewayServiceCreate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void sqlDedicatedGatewayServiceCreate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .services() + .define("SqlDedicatedGateway") + .withExistingDatabaseAccount("rg1", "ddb1") + .withInstanceSize(ServiceSize.COSMOS_D4S) + .withInstanceCount(1) + .withServiceType(ServiceType.SQL_DEDICATED_GATEWAY) + .create(); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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") + .withInstanceSize(ServiceSize.COSMOS_D4S) + .withInstanceCount(1) + .withServiceType(ServiceType.DATA_TRANSFER) + .create(); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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") + .withInstanceSize(ServiceSize.COSMOS_D4S) + .withInstanceCount(1) + .withServiceType(ServiceType.MATERIALIZED_VIEWS_BUILDER) + .create(); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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") + .withInstanceSize(ServiceSize.COSMOS_D4S) + .withInstanceCount(1) + .withServiceType(ServiceType.GRAPH_APICOMPUTE) + .create(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/ServiceDeleteSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/ServiceDeleteSamples.java new file mode 100644 index 0000000000000..4c00636cfdd1b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/ServiceDeleteSamples.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; + +/** Samples for Service Delete. */ +public final class ServiceDeleteSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlDedicatedGatewayServiceDelete.json + */ + /** + * Sample code: SqlDedicatedGatewayServiceDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void sqlDedicatedGatewayServiceDelete( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.services().delete("rg1", "ddb1", "SqlDedicatedGateway", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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/2022-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/2022-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..79c0456b689c9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/ServiceGetSamples.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.generated; + +/** Samples for Service Get. */ +public final class ServiceGetSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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/2022-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/2022-11-15/examples/CosmosDBSqlDedicatedGatewayServiceGet.json + */ + /** + * Sample code: SqlDedicatedGatewayServiceGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void sqlDedicatedGatewayServiceGet( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.services().getWithResponse("rg1", "ddb1", "SqlDedicatedGateway", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..04eb9b202e4ee --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/ServiceListSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft 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/2022-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..c5d6851c6b64e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesCreateUpdateClientEncryptionKeySamples.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; + +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/2022-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..33b18797b5f5f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesCreateUpdateSqlContainerSamples.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.generated; + +import com.azure.resourcemanager.cosmos.generated.models.ClientEncryptionIncludedPath; +import com.azure.resourcemanager.cosmos.generated.models.ClientEncryptionPolicy; +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/2022-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))) + .withTags(mapOf()) + .withOptions(new CreateUpdateOptions()) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesCreateUpdateSqlDatabaseSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesCreateUpdateSqlDatabaseSamples.java new file mode 100644 index 0000000000000..bc3a8883e28b2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesCreateUpdateSqlDatabaseSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.SqlDatabaseResource; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SqlResources CreateUpdateSqlDatabase. */ +public final class SqlResourcesCreateUpdateSqlDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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(); + } + + @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..aa2ddd4afcfe5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesCreateUpdateSqlRoleAssignmentSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +/** Samples for SqlResources CreateUpdateSqlRoleAssignment. */ +public final class SqlResourcesCreateUpdateSqlRoleAssignmentSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..1143e2d3e49e8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesCreateUpdateSqlRoleDefinitionSamples.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.resourcemanager.cosmos.generated.models.Permission; +import com.azure.resourcemanager.cosmos.generated.models.RoleDefinitionType; +import java.util.Arrays; + +/** Samples for SqlResources CreateUpdateSqlRoleDefinition. */ +public final class SqlResourcesCreateUpdateSqlRoleDefinitionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..dc52d9739daf5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesCreateUpdateSqlStoredProcedureSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.SqlStoredProcedureResource; + +/** Samples for SqlResources CreateUpdateSqlStoredProcedure. */ +public final class SqlResourcesCreateUpdateSqlStoredProcedureSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..8e13b49aca33c --- /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/2022-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..eb64f78337e4a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesCreateUpdateSqlUserDefinedFunctionSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.SqlUserDefinedFunctionResource; + +/** Samples for SqlResources CreateUpdateSqlUserDefinedFunction. */ +public final class SqlResourcesCreateUpdateSqlUserDefinedFunctionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..9249b417b9fd3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesDeleteSqlContainerSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +/** Samples for SqlResources DeleteSqlContainer. */ +public final class SqlResourcesDeleteSqlContainerSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..ce43ee85f6933 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesDeleteSqlDatabaseSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft 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/2022-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..14034c3ad532d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesDeleteSqlRoleAssignmentSamples.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 DeleteSqlRoleAssignment. */ +public final class SqlResourcesDeleteSqlRoleAssignmentSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..e78ce6caf4fc8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesDeleteSqlRoleDefinitionSamples.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 DeleteSqlRoleDefinition. */ +public final class SqlResourcesDeleteSqlRoleDefinitionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..5f854d764389b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesDeleteSqlStoredProcedureSamples.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; + +/** Samples for SqlResources DeleteSqlStoredProcedure. */ +public final class SqlResourcesDeleteSqlStoredProcedureSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..2b922e8e5a85f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesDeleteSqlTriggerSamples.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 DeleteSqlTrigger. */ +public final class SqlResourcesDeleteSqlTriggerSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..3889283a5f6ae --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesDeleteSqlUserDefinedFunctionSamples.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; + +/** Samples for SqlResources DeleteSqlUserDefinedFunction. */ +public final class SqlResourcesDeleteSqlUserDefinedFunctionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..f1326ed8def8a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesGetClientEncryptionKeySamples.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 GetClientEncryptionKey. */ +public final class SqlResourcesGetClientEncryptionKeySamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..2a260b12f262a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesGetSqlContainerSamples.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 GetSqlContainer. */ +public final class SqlResourcesGetSqlContainerSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..70e5f23269074 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesGetSqlContainerThroughputSamples.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 GetSqlContainerThroughput. */ +public final class SqlResourcesGetSqlContainerThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..1147b5e3a3057 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesGetSqlDatabaseSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +/** Samples for SqlResources GetSqlDatabase. */ +public final class SqlResourcesGetSqlDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..96e0b8ce80ad9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesGetSqlDatabaseThroughputSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +/** Samples for SqlResources GetSqlDatabaseThroughput. */ +public final class SqlResourcesGetSqlDatabaseThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..051cf7f352292 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesGetSqlRoleAssignmentSamples.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 GetSqlRoleAssignment. */ +public final class SqlResourcesGetSqlRoleAssignmentSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..4de1cb86bbf03 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesGetSqlRoleDefinitionSamples.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 GetSqlRoleDefinition. */ +public final class SqlResourcesGetSqlRoleDefinitionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..331dff6f4914c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesGetSqlStoredProcedureSamples.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; + +/** Samples for SqlResources GetSqlStoredProcedure. */ +public final class SqlResourcesGetSqlStoredProcedureSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..5304ed6276dc9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesGetSqlTriggerSamples.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 GetSqlTrigger. */ +public final class SqlResourcesGetSqlTriggerSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..d8a723e084ea0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesGetSqlUserDefinedFunctionSamples.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; + +/** Samples for SqlResources GetSqlUserDefinedFunction. */ +public final class SqlResourcesGetSqlUserDefinedFunctionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..733e8dab8d9e0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesListClientEncryptionKeysSamples.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 ListClientEncryptionKeys. */ +public final class SqlResourcesListClientEncryptionKeysSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..66aeb840b6da8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesListSqlContainersSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft 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/2022-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..ddafa0c0b40de --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesListSqlDatabasesSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft 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/2022-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..639a23d4b5c6c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesListSqlRoleAssignmentsSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +/** Samples for SqlResources ListSqlRoleAssignments. */ +public final class SqlResourcesListSqlRoleAssignmentsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..27ecee69ed3a5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesListSqlRoleDefinitionsSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +/** Samples for SqlResources ListSqlRoleDefinitions. */ +public final class SqlResourcesListSqlRoleDefinitionsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..9edc37f6ddd88 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesListSqlStoredProceduresSamples.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 ListSqlStoredProcedures. */ +public final class SqlResourcesListSqlStoredProceduresSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..3477f49c3a338 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesListSqlTriggersSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +/** Samples for SqlResources ListSqlTriggers. */ +public final class SqlResourcesListSqlTriggersSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..0203cce51f4ed --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesListSqlUserDefinedFunctionsSamples.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 ListSqlUserDefinedFunctions. */ +public final class SqlResourcesListSqlUserDefinedFunctionsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..91a8a4ffe125b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesMigrateSqlContainerToAutoscaleSamples.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 MigrateSqlContainerToAutoscale. */ +public final class SqlResourcesMigrateSqlContainerToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..bf5a7adf08601 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesMigrateSqlContainerToManualThroughputSamples.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 MigrateSqlContainerToManualThroughput. */ +public final class SqlResourcesMigrateSqlContainerToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..1d915733cf87f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesMigrateSqlDatabaseToAutoscaleSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +/** Samples for SqlResources MigrateSqlDatabaseToAutoscale. */ +public final class SqlResourcesMigrateSqlDatabaseToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..5afc1cd0141cc --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesMigrateSqlDatabaseToManualThroughputSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +/** Samples for SqlResources MigrateSqlDatabaseToManualThroughput. */ +public final class SqlResourcesMigrateSqlDatabaseToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..f94e37a904ee1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesRetrieveContinuousBackupInformationSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.resourcemanager.cosmos.generated.models.ContinuousBackupRestoreLocation; + +/** Samples for SqlResources RetrieveContinuousBackupInformation. */ +public final class SqlResourcesRetrieveContinuousBackupInformationSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..6735bdb7f6537 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesUpdateSqlContainerThroughputSamples.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.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/2022-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); + } + + @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..25f66f0e171ab --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesUpdateSqlDatabaseThroughputSamples.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.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/2022-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); + } + + @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..2ddbc5e96182e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/TableResourcesCreateUpdateTableSamples.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.TableResource; +import java.util.HashMap; +import java.util.Map; + +/** Samples for TableResources CreateUpdateTable. */ +public final class TableResourcesCreateUpdateTableSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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(); + } + + @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..59e6469763147 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/TableResourcesDeleteTableSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft 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/2022-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..8c5a134a712f8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/TableResourcesGetTableSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft 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/2022-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..a9f5ffff4b775 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/TableResourcesGetTableThroughputSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +/** Samples for TableResources GetTableThroughput. */ +public final class TableResourcesGetTableThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..e86744561ada5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/TableResourcesListTablesSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft 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/2022-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..c83037e99c0c9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/TableResourcesMigrateTableToAutoscaleSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft 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/2022-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..56e4b395e2ad9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/TableResourcesMigrateTableToManualThroughputSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +/** Samples for TableResources MigrateTableToManualThroughput. */ +public final class TableResourcesMigrateTableToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-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..4ca16025f961c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/TableResourcesRetrieveContinuousBackupInformationSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.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/2022-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..344b287e03f1a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/TableResourcesUpdateTableThroughputSamples.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.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/2022-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); + } + + @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 049630b9e52a1..646fbe68d5e80 100644 --- a/sdk/cosmos/ci.yml +++ b/sdk/cosmos/ci.yml @@ -71,33 +71,37 @@ pr: - sdk/cosmos/azure-spring-data-cosmos-test/pom.xml parameters: -- name: release_azurecosmos - displayName: 'azure-cosmos' - type: boolean - default: true -- name: release_azurespringdatacosmos - displayName: 'azure-spring-data-cosmos' - type: boolean - default: true -- name: release_azurecosmosencryption - displayName: 'azure-cosmos-encryption' - type: boolean - default: true -- name: release_azurecosmosspark31 - displayName: 'azure-cosmos-spark_3-1_2-12' - type: boolean - default: true -- name: release_azurecosmosspark32 - displayName: 'azure-cosmos-spark_3-2_2-12' - type: boolean - default: true -- name: release_azurecosmosspark33 - displayName: 'azure-cosmos-spark_3-3_2-12' - type: boolean - default: true + - name: release_azurecosmos + displayName: azure-cosmos + type: boolean + default: true + - name: release_azurespringdatacosmos + displayName: azure-spring-data-cosmos + type: boolean + default: true + - name: release_azurecosmosencryption + displayName: azure-cosmos-encryption + type: boolean + default: true + - name: release_azurecosmosspark31 + displayName: azure-cosmos-spark_3-1_2-12 + type: boolean + default: true + - name: release_azurecosmosspark32 + displayName: azure-cosmos-spark_3-2_2-12 + type: boolean + default: true + - name: release_azurecosmosspark33 + displayName: azure-cosmos-spark_3-3_2-12 + 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 EnableBatchRelease: true @@ -136,6 +140,10 @@ extends: skipPublishDocGithubIo: true skipPublishDocMs: true releaseInBatch: ${{ parameters.release_azurecosmosspark33 }} + - name: azure-resourcemanager-cosmos-generated + groupId: com.azure.resourcemanager + safeName: azureresourcemanagercosmosgenerated + releaseInBatch: ${{ parameters.release_azureresourcemanagercosmosgenerated }} AdditionalModules: - name: azure-cosmos-benchmark groupId: com.azure diff --git a/sdk/cosmos/pom.xml b/sdk/cosmos/pom.xml index ef9732205d8cb..9bd85c01c8728 100644 --- a/sdk/cosmos/pom.xml +++ b/sdk/cosmos/pom.xml @@ -10,15 +10,16 @@ 1.0.0 - azure-cosmos - azure-cosmos-benchmark - azure-cosmos-dotnet-benchmark - azure-cosmos-encryption - azure-spring-data-cosmos - azure-spring-data-cosmos-test - azure-cosmos-spark_3_2-12 - azure-cosmos-spark_3-1_2-12 - azure-cosmos-spark_3-2_2-12 - azure-cosmos-spark_3-3_2-12 + azure-cosmos + azure-cosmos-benchmark + azure-cosmos-dotnet-benchmark + azure-cosmos-encryption + 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_2-12 + azure-resourcemanager-cosmos-generated + azure-spring-data-cosmos + azure-spring-data-cosmos-test