diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index fed402697b635..3dd282dfb175b 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -310,6 +310,7 @@ com.azure.resourcemanager:azure-resourcemanager-elastic;1.0.0-beta.1;1.0.0-beta. com.azure.resourcemanager:azure-resourcemanager-webpubsub;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-security;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-azurearcdata;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 # Unreleased dependencies: Copy the entry from above, prepend "unreleased_" and remove the current # version. Unreleased dependencies are only valid for dependency versions. diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/CHANGELOG.md b/sdk/cosmos/azure-resourcemanager-cosmos-generated/CHANGELOG.md new file mode 100644 index 0000000000000..83d614d4350af --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-08-06) + +- Azure Resource Manager CosmosDB client library for Java. This package contains Microsoft Azure SDK for CosmosDB Management SDK. Azure Cosmos DB Database Service Resource Provider REST API. Package tag package-2021-06. 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..cfff7533d09c0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/README.md @@ -0,0 +1,101 @@ +# Azure Resource Manager CosmosDB client library for Java + +Azure Resource Manager CosmosDB client library for Java. + +This package contains Microsoft Azure SDK for CosmosDB Management SDK. Azure Cosmos DB Database Service Resource Provider REST API. Package tag package-2021-06. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-cosmos-generated;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-cosmos-generated + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, `azure` client can be authenticated by following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +CosmosDBManager manager = CosmosDBManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/pom.xml b/sdk/cosmos/azure-resourcemanager-cosmos-generated/pom.xml new file mode 100644 index 0000000000000..dfff04301752f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/pom.xml @@ -0,0 +1,86 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-cosmos-generated + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for CosmosDB Management + This package contains Microsoft Azure SDK for CosmosDB Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure Cosmos DB Database Service Resource Provider REST API. Package tag package-2021-06. + 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 + + + + + com.azure + azure-core + 1.18.0 + + + com.azure + azure-core-management + 1.3.1 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + true + + + + org.revapi + revapi-maven-plugin + 0.11.2 + + + + + java.method.addedToInterface + + + true + .* + com\.azure\.resourcemanager(\.[^.]+)+\.fluent(\.[^.]+)* + + + + + + + + diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/CosmosDBManager.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/CosmosDBManager.java new file mode 100644 index 0000000000000..ba34b3fba922f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/CosmosDBManager.java @@ -0,0 +1,563 @@ +// Copyright (c) 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.policy.AddDatePolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.CosmosDBManagementClient; +import com.azure.resourcemanager.cosmos.generated.implementation.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.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.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.SqlResourcesImpl; +import com.azure.resourcemanager.cosmos.generated.implementation.TableResourcesImpl; +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.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.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.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; + +/** 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 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 final CosmosDBManagementClient clientObject; + + private CosmosDBManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new CosmosDBManagementClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of CosmosDB service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the CosmosDB service API instance. + */ + public static CosmosDBManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Gets a Configurable instance that can be used to create CosmosDBManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new CosmosDBManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private final ClientLogger logger = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = Objects.requireNonNull(defaultPollInterval, "'retryPolicy' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of CosmosDB service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the CosmosDB service API instance. + */ + public CosmosDBManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder + .append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.cosmos.generated") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder + .append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new RequestIdPolicy()); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.addAll(this.policies); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new CosmosDBManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of DatabaseAccounts. */ + public DatabaseAccounts databaseAccounts() { + if (this.databaseAccounts == null) { + this.databaseAccounts = new DatabaseAccountsImpl(clientObject.getDatabaseAccounts(), this); + } + return databaseAccounts; + } + + /** @return Resource collection API of Operations. */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** @return Resource collection API of Databases. */ + public Databases databases() { + if (this.databases == null) { + this.databases = new DatabasesImpl(clientObject.getDatabases(), this); + } + return databases; + } + + /** @return Resource collection API of Collections. */ + public Collections collections() { + if (this.collections == null) { + this.collections = new CollectionsImpl(clientObject.getCollections(), this); + } + return collections; + } + + /** @return Resource collection API of CollectionRegions. */ + public CollectionRegions collectionRegions() { + if (this.collectionRegions == null) { + this.collectionRegions = new CollectionRegionsImpl(clientObject.getCollectionRegions(), this); + } + return collectionRegions; + } + + /** @return Resource collection API of DatabaseAccountRegions. */ + public DatabaseAccountRegions databaseAccountRegions() { + if (this.databaseAccountRegions == null) { + this.databaseAccountRegions = + new DatabaseAccountRegionsImpl(clientObject.getDatabaseAccountRegions(), this); + } + return databaseAccountRegions; + } + + /** @return Resource collection API of PercentileSourceTargets. */ + public PercentileSourceTargets percentileSourceTargets() { + if (this.percentileSourceTargets == null) { + this.percentileSourceTargets = + new PercentileSourceTargetsImpl(clientObject.getPercentileSourceTargets(), this); + } + return percentileSourceTargets; + } + + /** @return Resource collection API of PercentileTargets. */ + public PercentileTargets percentileTargets() { + if (this.percentileTargets == null) { + this.percentileTargets = new PercentileTargetsImpl(clientObject.getPercentileTargets(), this); + } + return percentileTargets; + } + + /** @return Resource collection API of Percentiles. */ + public Percentiles percentiles() { + if (this.percentiles == null) { + this.percentiles = new PercentilesImpl(clientObject.getPercentiles(), this); + } + return percentiles; + } + + /** @return Resource collection API of CollectionPartitionRegions. */ + public CollectionPartitionRegions collectionPartitionRegions() { + if (this.collectionPartitionRegions == null) { + this.collectionPartitionRegions = + new CollectionPartitionRegionsImpl(clientObject.getCollectionPartitionRegions(), this); + } + return collectionPartitionRegions; + } + + /** @return Resource collection API of CollectionPartitions. */ + public CollectionPartitions collectionPartitions() { + if (this.collectionPartitions == null) { + this.collectionPartitions = new CollectionPartitionsImpl(clientObject.getCollectionPartitions(), this); + } + return collectionPartitions; + } + + /** @return Resource collection API of PartitionKeyRangeIds. */ + public PartitionKeyRangeIds partitionKeyRangeIds() { + if (this.partitionKeyRangeIds == null) { + this.partitionKeyRangeIds = new PartitionKeyRangeIdsImpl(clientObject.getPartitionKeyRangeIds(), this); + } + return partitionKeyRangeIds; + } + + /** @return Resource collection API of PartitionKeyRangeIdRegions. */ + public PartitionKeyRangeIdRegions partitionKeyRangeIdRegions() { + if (this.partitionKeyRangeIdRegions == null) { + this.partitionKeyRangeIdRegions = + new PartitionKeyRangeIdRegionsImpl(clientObject.getPartitionKeyRangeIdRegions(), this); + } + return partitionKeyRangeIdRegions; + } + + /** @return Resource collection API of SqlResources. */ + public SqlResources sqlResources() { + if (this.sqlResources == null) { + this.sqlResources = new SqlResourcesImpl(clientObject.getSqlResources(), this); + } + return sqlResources; + } + + /** @return Resource collection API of MongoDBResources. */ + public MongoDBResources mongoDBResources() { + if (this.mongoDBResources == null) { + this.mongoDBResources = new MongoDBResourcesImpl(clientObject.getMongoDBResources(), this); + } + return mongoDBResources; + } + + /** @return Resource collection API of TableResources. */ + public TableResources tableResources() { + if (this.tableResources == null) { + this.tableResources = new TableResourcesImpl(clientObject.getTableResources(), this); + } + return tableResources; + } + + /** @return Resource collection API of CassandraResources. */ + public CassandraResources cassandraResources() { + if (this.cassandraResources == null) { + this.cassandraResources = new CassandraResourcesImpl(clientObject.getCassandraResources(), this); + } + return cassandraResources; + } + + /** @return Resource collection API of GremlinResources. */ + public GremlinResources gremlinResources() { + if (this.gremlinResources == null) { + this.gremlinResources = new GremlinResourcesImpl(clientObject.getGremlinResources(), this); + } + return gremlinResources; + } + + /** @return Resource collection API of NotebookWorkspaces. */ + public NotebookWorkspaces notebookWorkspaces() { + if (this.notebookWorkspaces == null) { + this.notebookWorkspaces = new NotebookWorkspacesImpl(clientObject.getNotebookWorkspaces(), this); + } + return notebookWorkspaces; + } + + /** @return Resource collection API of PrivateEndpointConnections. */ + public PrivateEndpointConnections privateEndpointConnections() { + if (this.privateEndpointConnections == null) { + this.privateEndpointConnections = + new PrivateEndpointConnectionsImpl(clientObject.getPrivateEndpointConnections(), this); + } + return privateEndpointConnections; + } + + /** @return Resource collection API of PrivateLinkResources. */ + public PrivateLinkResources privateLinkResources() { + if (this.privateLinkResources == null) { + this.privateLinkResources = new PrivateLinkResourcesImpl(clientObject.getPrivateLinkResources(), this); + } + return privateLinkResources; + } + + /** @return Resource collection API of RestorableDatabaseAccounts. */ + public RestorableDatabaseAccounts restorableDatabaseAccounts() { + if (this.restorableDatabaseAccounts == null) { + this.restorableDatabaseAccounts = + new RestorableDatabaseAccountsImpl(clientObject.getRestorableDatabaseAccounts(), this); + } + return restorableDatabaseAccounts; + } + + /** @return Resource collection API of RestorableSqlDatabases. */ + public RestorableSqlDatabases restorableSqlDatabases() { + if (this.restorableSqlDatabases == null) { + this.restorableSqlDatabases = + new RestorableSqlDatabasesImpl(clientObject.getRestorableSqlDatabases(), this); + } + return restorableSqlDatabases; + } + + /** @return Resource collection API of RestorableSqlContainers. */ + public RestorableSqlContainers restorableSqlContainers() { + if (this.restorableSqlContainers == null) { + this.restorableSqlContainers = + new RestorableSqlContainersImpl(clientObject.getRestorableSqlContainers(), this); + } + return restorableSqlContainers; + } + + /** @return Resource collection API of RestorableSqlResources. */ + public RestorableSqlResources restorableSqlResources() { + if (this.restorableSqlResources == null) { + this.restorableSqlResources = + new RestorableSqlResourcesImpl(clientObject.getRestorableSqlResources(), this); + } + return restorableSqlResources; + } + + /** @return Resource collection API of RestorableMongodbDatabases. */ + public RestorableMongodbDatabases restorableMongodbDatabases() { + if (this.restorableMongodbDatabases == null) { + this.restorableMongodbDatabases = + new RestorableMongodbDatabasesImpl(clientObject.getRestorableMongodbDatabases(), this); + } + return restorableMongodbDatabases; + } + + /** @return Resource collection API of RestorableMongodbCollections. */ + public RestorableMongodbCollections restorableMongodbCollections() { + if (this.restorableMongodbCollections == null) { + this.restorableMongodbCollections = + new RestorableMongodbCollectionsImpl(clientObject.getRestorableMongodbCollections(), this); + } + return restorableMongodbCollections; + } + + /** @return Resource collection API of RestorableMongodbResources. */ + public RestorableMongodbResources restorableMongodbResources() { + if (this.restorableMongodbResources == null) { + this.restorableMongodbResources = + new RestorableMongodbResourcesImpl(clientObject.getRestorableMongodbResources(), this); + } + return restorableMongodbResources; + } + + /** + * @return 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/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..288b9540b4782 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CassandraResourcesClient.java @@ -0,0 +1,954 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.cosmos.generated.fluent.models.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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listCassandraKeyspaces( + String resourceGroupName, String accountName); + + /** + * Lists the Cassandra keyspaces under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the Cassandra keyspaces and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listCassandraKeyspaces( + String resourceGroupName, String accountName, Context context); + + /** + * Gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CassandraKeyspaceGetResultsInner getCassandraKeyspace( + String resourceGroupName, String accountName, String keyspaceName); + + /** + * Gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getCassandraKeyspaceWithResponse( + String resourceGroupName, String accountName, String keyspaceName, Context context); + + /** + * Create or update an Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param createUpdateCassandraKeyspaceParameters The parameters to provide for the current Cassandra keyspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra keyspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, CassandraKeyspaceGetResultsInner> + beginCreateUpdateCassandraKeyspace( + String resourceGroupName, + String accountName, + String keyspaceName, + CassandraKeyspaceCreateUpdateParameters createUpdateCassandraKeyspaceParameters); + + /** + * Create or update an Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param createUpdateCassandraKeyspaceParameters The parameters to provide for the current Cassandra keyspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra keyspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, CassandraKeyspaceGetResultsInner> + beginCreateUpdateCassandraKeyspace( + String resourceGroupName, + String accountName, + String keyspaceName, + CassandraKeyspaceCreateUpdateParameters createUpdateCassandraKeyspaceParameters, + Context context); + + /** + * Create or update an Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param createUpdateCassandraKeyspaceParameters The parameters to provide for the current Cassandra keyspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra keyspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CassandraKeyspaceGetResultsInner createUpdateCassandraKeyspace( + String resourceGroupName, + String accountName, + String keyspaceName, + CassandraKeyspaceCreateUpdateParameters createUpdateCassandraKeyspaceParameters); + + /** + * Create or update an Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param createUpdateCassandraKeyspaceParameters The parameters to provide for the current Cassandra keyspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra keyspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CassandraKeyspaceGetResultsInner createUpdateCassandraKeyspace( + String resourceGroupName, + String accountName, + String keyspaceName, + CassandraKeyspaceCreateUpdateParameters createUpdateCassandraKeyspaceParameters, + Context context); + + /** + * Deletes an existing Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDeleteCassandraKeyspace( + String resourceGroupName, String accountName, String keyspaceName); + + /** + * Deletes an existing Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDeleteCassandraKeyspace( + String resourceGroupName, String accountName, String keyspaceName, Context context); + + /** + * Deletes an existing Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteCassandraKeyspace(String resourceGroupName, String accountName, String keyspaceName); + + /** + * Deletes an existing Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteCassandraKeyspace(String resourceGroupName, String accountName, String keyspaceName, Context context); + + /** + * Gets the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database account with the + * provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner getCassandraKeyspaceThroughput( + String resourceGroupName, String accountName, String keyspaceName); + + /** + * Gets the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database account with the + * provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getCassandraKeyspaceThroughputWithResponse( + String resourceGroupName, String accountName, String keyspaceName, Context context); + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * Keyspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateCassandraKeyspaceThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * Keyspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateCassandraKeyspaceThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * Keyspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner updateCassandraKeyspaceThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * Keyspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner updateCassandraKeyspaceThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * Migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateCassandraKeyspaceToAutoscale(String resourceGroupName, String accountName, String keyspaceName); + + /** + * Migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateCassandraKeyspaceToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, Context context); + + /** + * Migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateCassandraKeyspaceToAutoscale( + String resourceGroupName, String accountName, String keyspaceName); + + /** + * Migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateCassandraKeyspaceToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, Context context); + + /** + * Migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateCassandraKeyspaceToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName); + + /** + * Migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateCassandraKeyspaceToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName, Context context); + + /** + * Migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateCassandraKeyspaceToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName); + + /** + * Migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateCassandraKeyspaceToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName, Context context); + + /** + * Lists the Cassandra table under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the Cassandra tables and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listCassandraTables( + String resourceGroupName, String accountName, String keyspaceName); + + /** + * Lists the Cassandra table under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the Cassandra tables and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listCassandraTables( + String resourceGroupName, String accountName, String keyspaceName, Context context); + + /** + * Gets the Cassandra table under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra table under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CassandraTableGetResultsInner getCassandraTable( + String resourceGroupName, String accountName, String keyspaceName, String tableName); + + /** + * Gets the Cassandra table under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra table under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getCassandraTableWithResponse( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context); + + /** + * Create or update an Azure Cosmos DB Cassandra Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param createUpdateCassandraTableParameters The parameters to provide for the current Cassandra Table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, CassandraTableGetResultsInner> + beginCreateUpdateCassandraTable( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters); + + /** + * Create or update an Azure Cosmos DB Cassandra Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param createUpdateCassandraTableParameters The parameters to provide for the current Cassandra Table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, CassandraTableGetResultsInner> + beginCreateUpdateCassandraTable( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters, + Context context); + + /** + * Create or update an Azure Cosmos DB Cassandra Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param createUpdateCassandraTableParameters The parameters to provide for the current Cassandra Table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CassandraTableGetResultsInner createUpdateCassandraTable( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters); + + /** + * Create or update an Azure Cosmos DB Cassandra Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param createUpdateCassandraTableParameters The parameters to provide for the current Cassandra Table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CassandraTableGetResultsInner createUpdateCassandraTable( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters, + Context context); + + /** + * Deletes an existing Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDeleteCassandraTable( + String resourceGroupName, String accountName, String keyspaceName, String tableName); + + /** + * Deletes an existing Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDeleteCassandraTable( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context); + + /** + * Deletes an existing Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteCassandraTable(String resourceGroupName, String accountName, String keyspaceName, String tableName); + + /** + * Deletes an existing Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteCassandraTable( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context); + + /** + * Gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the + * provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner getCassandraTableThroughput( + String resourceGroupName, String accountName, String keyspaceName, String tableName); + + /** + * Gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the + * provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getCassandraTableThroughputWithResponse( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context); + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateCassandraTableThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateCassandraTableThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner updateCassandraTableThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner updateCassandraTableThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * Migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateCassandraTableToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, String tableName); + + /** + * Migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateCassandraTableToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context); + + /** + * Migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateCassandraTableToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, String tableName); + + /** + * Migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateCassandraTableToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context); + + /** + * Migrate an Azure Cosmos DB Cassandra table from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateCassandraTableToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName, String tableName); + + /** + * Migrate an Azure Cosmos DB Cassandra table from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + 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..71bf720881e09 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CollectionPartitionRegionsClient.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionMetricInner; + +/** An instance of this class provides access to all the operations defined in CollectionPartitionRegionsClient. */ +public interface CollectionPartitionRegionsClient { + /** + * Retrieves the metrics determined by the given filter for the given collection and region, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter); + + /** + * Retrieves the metrics determined by the given filter for the given collection and region, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter, + Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CollectionPartitionsClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CollectionPartitionsClient.java new file mode 100644 index 0000000000000..2b56234440753 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CollectionPartitionsClient.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionMetricInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionUsageInner; + +/** An instance of this class provides access to all the operations defined in CollectionPartitionsClient. */ +public interface CollectionPartitionsClient { + /** + * Retrieves the metrics determined by the given filter for the given collection, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter); + + /** + * Retrieves the metrics determined by the given filter for the given collection, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context); + + /** + * Retrieves the usages (most recent storage data) for the given collection, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition level usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listUsages( + String resourceGroupName, String accountName, String databaseRid, String collectionRid); + + /** + * Retrieves the usages (most recent storage data) for the given collection, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition level usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listUsages( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CollectionRegionsClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CollectionRegionsClient.java new file mode 100644 index 0000000000000..b91fa05e2f395 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CollectionRegionsClient.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricInner; + +/** An instance of this class provides access to all the operations defined in CollectionRegionsClient. */ +public interface CollectionRegionsClient { + /** + * Retrieves the metrics determined by the given filter for the given database account, collection and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter); + + /** + * Retrieves the metrics determined by the given filter for the given database account, collection and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter, + Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CollectionsClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CollectionsClient.java new file mode 100644 index 0000000000000..a5c83b2e13f7d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CollectionsClient.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricDefinitionInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.UsageInner; + +/** An instance of this class provides access to all the operations defined in CollectionsClient. */ +public interface CollectionsClient { + /** + * Retrieves the metrics determined by the given filter for the given database account and collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter); + + /** + * Retrieves the metrics determined by the given filter for the given database account and collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context); + + /** + * Retrieves the usages (most recent storage data) for the given collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listUsages( + String resourceGroupName, String accountName, String databaseRid, String collectionRid); + + /** + * Retrieves the usages (most recent storage data) for the given collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listUsages( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context); + + /** + * Retrieves metric definitions for the given collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, String databaseRid, String collectionRid); + + /** + * Retrieves metric definitions for the given collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, String databaseRid, String collectionRid, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CosmosDBManagementClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CosmosDBManagementClient.java new file mode 100644 index 0000000000000..96389430ec447 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CosmosDBManagementClient.java @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +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 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(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/DatabaseAccountRegionsClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/DatabaseAccountRegionsClient.java new file mode 100644 index 0000000000000..527626327ad66 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/DatabaseAccountRegionsClient.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricInner; + +/** An instance of this class provides access to all the operations defined in DatabaseAccountRegionsClient. */ +public interface DatabaseAccountRegionsClient { + /** + * Retrieves the metrics determined by the given filter for the given database account and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics(String resourceGroupName, String accountName, String region, String filter); + + /** + * Retrieves the metrics determined by the given filter for the given database account and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, String accountName, String region, String filter, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/DatabaseAccountsClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/DatabaseAccountsClient.java new file mode 100644 index 0000000000000..f0271fe89c404 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/DatabaseAccountsClient.java @@ -0,0 +1,782 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountListConnectionStringsResultInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountListKeysResultInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountListReadOnlyKeysResultInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricDefinitionInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.UsageInner; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountRegenerateKeyParameters; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.FailoverPolicies; +import com.azure.resourcemanager.cosmos.generated.models.RegionForOnlineOffline; + +/** An instance of this class provides access to all the operations defined in DatabaseAccountsClient. */ +public interface DatabaseAccountsClient { + /** + * Retrieves the properties of an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseAccountGetResultsInner getByResourceGroup(String resourceGroupName, String accountName); + + /** + * Retrieves the properties of an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String accountName, Context context); + + /** + * Updates the properties of an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param updateParameters The parameters to provide for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, DatabaseAccountGetResultsInner> beginUpdate( + String resourceGroupName, String accountName, DatabaseAccountUpdateParameters updateParameters); + + /** + * Updates the properties of an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param updateParameters The parameters to provide for the current database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, DatabaseAccountGetResultsInner> beginUpdate( + String resourceGroupName, + String accountName, + DatabaseAccountUpdateParameters updateParameters, + Context context); + + /** + * Updates the properties of an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param updateParameters The parameters to provide for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseAccountGetResultsInner update( + String resourceGroupName, String accountName, DatabaseAccountUpdateParameters updateParameters); + + /** + * Updates the properties of an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param updateParameters The parameters to provide for the current database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseAccountGetResultsInner update( + String resourceGroupName, + String accountName, + DatabaseAccountUpdateParameters updateParameters, + Context context); + + /** + * Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates + * on an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateParameters The parameters to provide for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, DatabaseAccountGetResultsInner> beginCreateOrUpdate( + String resourceGroupName, String accountName, DatabaseAccountCreateUpdateParameters createUpdateParameters); + + /** + * Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates + * on an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateParameters The parameters to provide for the current database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, DatabaseAccountGetResultsInner> beginCreateOrUpdate( + String resourceGroupName, + String accountName, + DatabaseAccountCreateUpdateParameters createUpdateParameters, + Context context); + + /** + * Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates + * on an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateParameters The parameters to provide for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseAccountGetResultsInner createOrUpdate( + String resourceGroupName, String accountName, DatabaseAccountCreateUpdateParameters createUpdateParameters); + + /** + * Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates + * on an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateParameters The parameters to provide for the current database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseAccountGetResultsInner createOrUpdate( + String resourceGroupName, + String accountName, + DatabaseAccountCreateUpdateParameters createUpdateParameters, + Context context); + + /** + * Deletes an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String accountName); + + /** + * Deletes an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String accountName, Context context); + + /** + * Deletes an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String accountName); + + /** + * Deletes an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String accountName, Context context); + + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a + * write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values + * must be unique for each of the regions in which the database account exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param failoverParameters The new failover policies for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginFailoverPriorityChange( + String resourceGroupName, String accountName, FailoverPolicies failoverParameters); + + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a + * write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values + * must be unique for each of the regions in which the database account exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param failoverParameters The new failover policies for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginFailoverPriorityChange( + String resourceGroupName, String accountName, FailoverPolicies failoverParameters, Context context); + + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a + * write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values + * must be unique for each of the regions in which the database account exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param failoverParameters The new failover policies for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void failoverPriorityChange(String resourceGroupName, String accountName, FailoverPolicies failoverParameters); + + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a + * write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values + * must be unique for each of the regions in which the database account exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param failoverParameters The new failover policies for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void failoverPriorityChange( + String resourceGroupName, String accountName, FailoverPolicies failoverParameters, Context context); + + /** + * Lists all the Azure Cosmos DB database accounts available under the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all the Azure Cosmos DB database accounts available under the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Lists all the Azure Cosmos DB database accounts available under the given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all the Azure Cosmos DB database accounts available under the given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists the access keys for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the access keys for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseAccountListKeysResultInner listKeys(String resourceGroupName, String accountName); + + /** + * Lists the access keys for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the access keys for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listKeysWithResponse( + String resourceGroupName, String accountName, Context context); + + /** + * Lists the connection strings for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connection strings for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseAccountListConnectionStringsResultInner listConnectionStrings(String resourceGroupName, String accountName); + + /** + * Lists the connection strings for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connection strings for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listConnectionStringsWithResponse( + String resourceGroupName, String accountName, Context context); + + /** + * Offline the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param regionParameterForOffline Cosmos DB region to offline for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginOfflineRegion( + String resourceGroupName, String accountName, RegionForOnlineOffline regionParameterForOffline); + + /** + * Offline the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param regionParameterForOffline Cosmos DB region to offline for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginOfflineRegion( + String resourceGroupName, + String accountName, + RegionForOnlineOffline regionParameterForOffline, + Context context); + + /** + * Offline the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param regionParameterForOffline Cosmos DB region to offline for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void offlineRegion(String resourceGroupName, String accountName, RegionForOnlineOffline regionParameterForOffline); + + /** + * Offline the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param regionParameterForOffline Cosmos DB region to offline for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void offlineRegion( + String resourceGroupName, + String accountName, + RegionForOnlineOffline regionParameterForOffline, + Context context); + + /** + * Online the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param regionParameterForOnline Cosmos DB region to online for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginOnlineRegion( + String resourceGroupName, String accountName, RegionForOnlineOffline regionParameterForOnline); + + /** + * Online the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param regionParameterForOnline Cosmos DB region to online for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginOnlineRegion( + String resourceGroupName, String accountName, RegionForOnlineOffline regionParameterForOnline, Context context); + + /** + * Online the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param regionParameterForOnline Cosmos DB region to online for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void onlineRegion(String resourceGroupName, String accountName, RegionForOnlineOffline regionParameterForOnline); + + /** + * Online the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param regionParameterForOnline Cosmos DB region to online for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void onlineRegion( + String resourceGroupName, String accountName, RegionForOnlineOffline regionParameterForOnline, Context context); + + /** + * Lists the read-only access keys for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the read-only access keys for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseAccountListReadOnlyKeysResultInner getReadOnlyKeys(String resourceGroupName, String accountName); + + /** + * Lists the read-only access keys for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the read-only access keys for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getReadOnlyKeysWithResponse( + String resourceGroupName, String accountName, Context context); + + /** + * Lists the read-only access keys for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the read-only access keys for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseAccountListReadOnlyKeysResultInner listReadOnlyKeys(String resourceGroupName, String accountName); + + /** + * Lists the read-only access keys for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the read-only access keys for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listReadOnlyKeysWithResponse( + String resourceGroupName, String accountName, Context context); + + /** + * Regenerates an access key for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyToRegenerate The name of the key to regenerate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginRegenerateKey( + String resourceGroupName, String accountName, DatabaseAccountRegenerateKeyParameters keyToRegenerate); + + /** + * Regenerates an access key for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyToRegenerate The name of the key to regenerate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginRegenerateKey( + String resourceGroupName, + String accountName, + DatabaseAccountRegenerateKeyParameters keyToRegenerate, + Context context); + + /** + * Regenerates an access key for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyToRegenerate The name of the key to regenerate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void regenerateKey( + String resourceGroupName, String accountName, DatabaseAccountRegenerateKeyParameters keyToRegenerate); + + /** + * Regenerates an access key for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyToRegenerate The name of the key to regenerate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void regenerateKey( + String resourceGroupName, + String accountName, + DatabaseAccountRegenerateKeyParameters keyToRegenerate, + Context context); + + /** + * Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase + * letters, numbers, and the '-' character, and must be between 3 and 50 characters. + * + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whether resource exists. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + boolean checkNameExists(String accountName); + + /** + * Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase + * letters, numbers, and the '-' character, and must be between 3 and 50 characters. + * + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkNameExistsWithResponse(String accountName, Context context); + + /** + * Retrieves the metrics determined by the given filter for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics(String resourceGroupName, String accountName, String filter); + + /** + * Retrieves the metrics determined by the given filter for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, String accountName, String filter, Context context); + + /** + * Retrieves the usages (most recent data) for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listUsages(String resourceGroupName, String accountName); + + /** + * Retrieves the usages (most recent data) for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listUsages(String resourceGroupName, String accountName, String filter, Context context); + + /** + * Retrieves metric definitions for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetricDefinitions(String resourceGroupName, String accountName); + + /** + * Retrieves metric definitions for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/DatabasesClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/DatabasesClient.java new file mode 100644 index 0000000000000..df5a79b206d25 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/DatabasesClient.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricDefinitionInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.UsageInner; + +/** An instance of this class provides access to all the operations defined in DatabasesClient. */ +public interface DatabasesClient { + /** + * Retrieves the metrics determined by the given filter for the given database account and database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, String accountName, String databaseRid, String filter); + + /** + * Retrieves the metrics determined by the given filter for the given database account and database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, String accountName, String databaseRid, String filter, Context context); + + /** + * Retrieves the usages (most recent data) for the given database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listUsages(String resourceGroupName, String accountName, String databaseRid); + + /** + * Retrieves the usages (most recent data) for the given database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listUsages( + String resourceGroupName, String accountName, String databaseRid, String filter, Context context); + + /** + * Retrieves metric definitions for the given database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, String databaseRid); + + /** + * Retrieves metric definitions for the given database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, String databaseRid, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/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..43f3a4aa48e7c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/GremlinResourcesClient.java @@ -0,0 +1,943 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.cosmos.generated.fluent.models.GremlinDatabaseGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.GremlinGraphGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ThroughputSettingsGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.GremlinDatabaseCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.GremlinGraphCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; + +/** An instance of this class provides access to all the operations defined in GremlinResourcesClient. */ +public interface GremlinResourcesClient { + /** + * Lists the Gremlin databases under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the Gremlin databases and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listGremlinDatabases(String resourceGroupName, String accountName); + + /** + * Lists the Gremlin databases under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the Gremlin databases and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listGremlinDatabases( + String resourceGroupName, String accountName, Context context); + + /** + * Gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GremlinDatabaseGetResultsInner getGremlinDatabase( + String resourceGroupName, String accountName, String databaseName); + + /** + * Gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getGremlinDatabaseWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Create or update an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateGremlinDatabaseParameters The parameters to provide for the current Gremlin database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, GremlinDatabaseGetResultsInner> + beginCreateUpdateGremlinDatabase( + String resourceGroupName, + String accountName, + String databaseName, + GremlinDatabaseCreateUpdateParameters createUpdateGremlinDatabaseParameters); + + /** + * Create or update an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateGremlinDatabaseParameters The parameters to provide for the current Gremlin database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, GremlinDatabaseGetResultsInner> + beginCreateUpdateGremlinDatabase( + String resourceGroupName, + String accountName, + String databaseName, + GremlinDatabaseCreateUpdateParameters createUpdateGremlinDatabaseParameters, + Context context); + + /** + * Create or update an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateGremlinDatabaseParameters The parameters to provide for the current Gremlin database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GremlinDatabaseGetResultsInner createUpdateGremlinDatabase( + String resourceGroupName, + String accountName, + String databaseName, + GremlinDatabaseCreateUpdateParameters createUpdateGremlinDatabaseParameters); + + /** + * Create or update an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateGremlinDatabaseParameters The parameters to provide for the current Gremlin database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GremlinDatabaseGetResultsInner createUpdateGremlinDatabase( + String resourceGroupName, + String accountName, + String databaseName, + GremlinDatabaseCreateUpdateParameters createUpdateGremlinDatabaseParameters, + Context context); + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDeleteGremlinDatabase( + String resourceGroupName, String accountName, String databaseName); + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDeleteGremlinDatabase( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteGremlinDatabase(String resourceGroupName, String accountName, String databaseName); + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteGremlinDatabase(String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Gets the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account with the + * provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner getGremlinDatabaseThroughput( + String resourceGroupName, String accountName, String databaseName); + + /** + * Gets the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account with the + * provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getGremlinDatabaseThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin + * database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateGremlinDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin + * database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateGremlinDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin + * database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner updateGremlinDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin + * database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner updateGremlinDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * Migrate an Azure Cosmos DB Gremlin database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateGremlinDatabaseToAutoscale(String resourceGroupName, String accountName, String databaseName); + + /** + * Migrate an Azure Cosmos DB Gremlin database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateGremlinDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Migrate an Azure Cosmos DB Gremlin database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateGremlinDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName); + + /** + * Migrate an Azure Cosmos DB Gremlin database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateGremlinDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Migrate an Azure Cosmos DB Gremlin database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateGremlinDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName); + + /** + * Migrate an Azure Cosmos DB Gremlin database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateGremlinDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Migrate an Azure Cosmos DB Gremlin database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateGremlinDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName); + + /** + * Migrate an Azure Cosmos DB Gremlin database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateGremlinDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Lists the Gremlin graph under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the graphs and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listGremlinGraphs( + String resourceGroupName, String accountName, String databaseName); + + /** + * Lists the Gremlin graph under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the graphs and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listGremlinGraphs( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Gets the Gremlin graph under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin graph under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GremlinGraphGetResultsInner getGremlinGraph( + String resourceGroupName, String accountName, String databaseName, String graphName); + + /** + * Gets the Gremlin graph under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin graph under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getGremlinGraphWithResponse( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context); + + /** + * Create or update an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param createUpdateGremlinGraphParameters The parameters to provide for the current Gremlin graph. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin graph. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, GremlinGraphGetResultsInner> beginCreateUpdateGremlinGraph( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters); + + /** + * Create or update an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param createUpdateGremlinGraphParameters The parameters to provide for the current Gremlin graph. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin graph. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, GremlinGraphGetResultsInner> beginCreateUpdateGremlinGraph( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters, + Context context); + + /** + * Create or update an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param createUpdateGremlinGraphParameters The parameters to provide for the current Gremlin graph. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin graph. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GremlinGraphGetResultsInner createUpdateGremlinGraph( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters); + + /** + * Create or update an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param createUpdateGremlinGraphParameters The parameters to provide for the current Gremlin graph. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin graph. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GremlinGraphGetResultsInner createUpdateGremlinGraph( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters, + Context context); + + /** + * Deletes an existing Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDeleteGremlinGraph( + String resourceGroupName, String accountName, String databaseName, String graphName); + + /** + * Deletes an existing Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDeleteGremlinGraph( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context); + + /** + * Deletes an existing Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteGremlinGraph(String resourceGroupName, String accountName, String databaseName, String graphName); + + /** + * Deletes an existing Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteGremlinGraph( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context); + + /** + * Gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner getGremlinGraphThroughput( + String resourceGroupName, String accountName, String databaseName, String graphName); + + /** + * Gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getGremlinGraphThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context); + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin graph. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateGremlinGraphThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin graph. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateGremlinGraphThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin graph. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner updateGremlinGraphThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin graph. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner updateGremlinGraphThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * Migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateGremlinGraphToAutoscale( + String resourceGroupName, String accountName, String databaseName, String graphName); + + /** + * Migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateGremlinGraphToAutoscale( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context); + + /** + * Migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateGremlinGraphToAutoscale( + String resourceGroupName, String accountName, String databaseName, String graphName); + + /** + * Migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateGremlinGraphToAutoscale( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context); + + /** + * Migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateGremlinGraphToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String graphName); + + /** + * Migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateGremlinGraphToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context); + + /** + * Migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateGremlinGraphToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String graphName); + + /** + * Migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateGremlinGraphToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/MongoDBResourcesClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/MongoDBResourcesClient.java new file mode 100644 index 0000000000000..c4cd677ae67e9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/MongoDBResourcesClient.java @@ -0,0 +1,954 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MongoDBCollectionGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MongoDBDatabaseGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ThroughputSettingsGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBCollectionCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBDatabaseCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; + +/** An instance of this class provides access to all the operations defined in MongoDBResourcesClient. */ +public interface MongoDBResourcesClient { + /** + * Lists the MongoDB databases under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the MongoDB databases and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMongoDBDatabases(String resourceGroupName, String accountName); + + /** + * Lists the MongoDB databases under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the MongoDB databases and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMongoDBDatabases( + String resourceGroupName, String accountName, Context context); + + /** + * Gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MongoDBDatabaseGetResultsInner getMongoDBDatabase( + String resourceGroupName, String accountName, String databaseName); + + /** + * Gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getMongoDBDatabaseWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Create or updates Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateMongoDBDatabaseParameters The parameters to provide for the current MongoDB database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, MongoDBDatabaseGetResultsInner> + beginCreateUpdateMongoDBDatabase( + String resourceGroupName, + String accountName, + String databaseName, + MongoDBDatabaseCreateUpdateParameters createUpdateMongoDBDatabaseParameters); + + /** + * Create or updates Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateMongoDBDatabaseParameters The parameters to provide for the current MongoDB database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, MongoDBDatabaseGetResultsInner> + beginCreateUpdateMongoDBDatabase( + String resourceGroupName, + String accountName, + String databaseName, + MongoDBDatabaseCreateUpdateParameters createUpdateMongoDBDatabaseParameters, + Context context); + + /** + * Create or updates Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateMongoDBDatabaseParameters The parameters to provide for the current MongoDB database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MongoDBDatabaseGetResultsInner createUpdateMongoDBDatabase( + String resourceGroupName, + String accountName, + String databaseName, + MongoDBDatabaseCreateUpdateParameters createUpdateMongoDBDatabaseParameters); + + /** + * Create or updates Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateMongoDBDatabaseParameters The parameters to provide for the current MongoDB database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MongoDBDatabaseGetResultsInner createUpdateMongoDBDatabase( + String resourceGroupName, + String accountName, + String databaseName, + MongoDBDatabaseCreateUpdateParameters createUpdateMongoDBDatabaseParameters, + Context context); + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDeleteMongoDBDatabase( + String resourceGroupName, String accountName, String databaseName); + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDeleteMongoDBDatabase( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteMongoDBDatabase(String resourceGroupName, String accountName, String databaseName); + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteMongoDBDatabase(String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Gets the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account with the + * provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner getMongoDBDatabaseThroughput( + String resourceGroupName, String accountName, String databaseName); + + /** + * Gets the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account with the + * provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getMongoDBDatabaseThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Update RUs per second of the an Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateMongoDBDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Update RUs per second of the an Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateMongoDBDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * Update RUs per second of the an Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner updateMongoDBDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Update RUs per second of the an Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner updateMongoDBDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * Migrate an Azure Cosmos DB MongoDB database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBDatabaseToAutoscale(String resourceGroupName, String accountName, String databaseName); + + /** + * Migrate an Azure Cosmos DB MongoDB database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Migrate an Azure Cosmos DB MongoDB database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateMongoDBDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName); + + /** + * Migrate an Azure Cosmos DB MongoDB database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateMongoDBDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Migrate an Azure Cosmos DB MongoDB database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName); + + /** + * Migrate an Azure Cosmos DB MongoDB database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Migrate an Azure Cosmos DB MongoDB database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateMongoDBDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName); + + /** + * Migrate an Azure Cosmos DB MongoDB database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateMongoDBDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Lists the MongoDB collection under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the MongoDB collections and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMongoDBCollections( + String resourceGroupName, String accountName, String databaseName); + + /** + * Lists the MongoDB collection under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the MongoDB collections and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMongoDBCollections( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Gets the MongoDB collection under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the MongoDB collection under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MongoDBCollectionGetResultsInner getMongoDBCollection( + String resourceGroupName, String accountName, String databaseName, String collectionName); + + /** + * Gets the MongoDB collection under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the MongoDB collection under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getMongoDBCollectionWithResponse( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context); + + /** + * Create or update an Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param createUpdateMongoDBCollectionParameters The parameters to provide for the current MongoDB Collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB collection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, MongoDBCollectionGetResultsInner> + beginCreateUpdateMongoDBCollection( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters); + + /** + * Create or update an Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param createUpdateMongoDBCollectionParameters The parameters to provide for the current MongoDB Collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB collection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, MongoDBCollectionGetResultsInner> + beginCreateUpdateMongoDBCollection( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters, + Context context); + + /** + * Create or update an Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param createUpdateMongoDBCollectionParameters The parameters to provide for the current MongoDB Collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB collection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MongoDBCollectionGetResultsInner createUpdateMongoDBCollection( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters); + + /** + * Create or update an Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param createUpdateMongoDBCollectionParameters The parameters to provide for the current MongoDB Collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB collection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MongoDBCollectionGetResultsInner createUpdateMongoDBCollection( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters, + Context context); + + /** + * Deletes an existing Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDeleteMongoDBCollection( + String resourceGroupName, String accountName, String databaseName, String collectionName); + + /** + * Deletes an existing Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDeleteMongoDBCollection( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context); + + /** + * Deletes an existing Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteMongoDBCollection( + String resourceGroupName, String accountName, String databaseName, String collectionName); + + /** + * Deletes an existing Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteMongoDBCollection( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context); + + /** + * Gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the + * provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner getMongoDBCollectionThroughput( + String resourceGroupName, String accountName, String databaseName, String collectionName); + + /** + * Gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the + * provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getMongoDBCollectionThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context); + + /** + * Update the RUs per second of an Azure Cosmos DB MongoDB collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateMongoDBCollectionThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Update the RUs per second of an Azure Cosmos DB MongoDB collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateMongoDBCollectionThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * Update the RUs per second of an Azure Cosmos DB MongoDB collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner updateMongoDBCollectionThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Update the RUs per second of an Azure Cosmos DB MongoDB collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner updateMongoDBCollectionThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * Migrate an Azure Cosmos DB MongoDB collection from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBCollectionToAutoscale( + String resourceGroupName, String accountName, String databaseName, String collectionName); + + /** + * Migrate an Azure Cosmos DB MongoDB collection from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBCollectionToAutoscale( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context); + + /** + * Migrate an Azure Cosmos DB MongoDB collection from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateMongoDBCollectionToAutoscale( + String resourceGroupName, String accountName, String databaseName, String collectionName); + + /** + * Migrate an Azure Cosmos DB MongoDB collection from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateMongoDBCollectionToAutoscale( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context); + + /** + * Migrate an Azure Cosmos DB MongoDB collection from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBCollectionToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String collectionName); + + /** + * Migrate an Azure Cosmos DB MongoDB collection from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBCollectionToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context); + + /** + * Migrate an Azure Cosmos DB MongoDB collection from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateMongoDBCollectionToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String collectionName); + + /** + * Migrate an Azure Cosmos DB MongoDB collection from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateMongoDBCollectionToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/NotebookWorkspacesClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/NotebookWorkspacesClient.java new file mode 100644 index 0000000000000..289eb80a1b14d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/NotebookWorkspacesClient.java @@ -0,0 +1,367 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.cosmos.generated.fluent.models.NotebookWorkspaceConnectionInfoResultInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.NotebookWorkspaceInner; +import com.azure.resourcemanager.cosmos.generated.models.NotebookWorkspaceCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.NotebookWorkspaceName; + +/** An instance of this class provides access to all the operations defined in NotebookWorkspacesClient. */ +public interface NotebookWorkspacesClient { + /** + * Gets the notebook workspace resources of an existing Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notebook workspace resources of an existing Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabaseAccount(String resourceGroupName, String accountName); + + /** + * Gets the notebook workspace resources of an existing Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notebook workspace resources of an existing Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabaseAccount( + String resourceGroupName, String accountName, Context context); + + /** + * Gets the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notebook workspace for a Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NotebookWorkspaceInner get( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName); + + /** + * Gets the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notebook workspace for a Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context); + + /** + * Creates the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param notebookCreateUpdateParameters The notebook workspace to create for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a notebook workspace resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, NotebookWorkspaceInner> beginCreateOrUpdate( + String resourceGroupName, + String accountName, + NotebookWorkspaceName notebookWorkspaceName, + NotebookWorkspaceCreateUpdateParameters notebookCreateUpdateParameters); + + /** + * Creates the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param notebookCreateUpdateParameters The notebook workspace to create for the current database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a notebook workspace resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, NotebookWorkspaceInner> beginCreateOrUpdate( + String resourceGroupName, + String accountName, + NotebookWorkspaceName notebookWorkspaceName, + NotebookWorkspaceCreateUpdateParameters notebookCreateUpdateParameters, + Context context); + + /** + * Creates the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param notebookCreateUpdateParameters The notebook workspace to create for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a notebook workspace resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NotebookWorkspaceInner createOrUpdate( + String resourceGroupName, + String accountName, + NotebookWorkspaceName notebookWorkspaceName, + NotebookWorkspaceCreateUpdateParameters notebookCreateUpdateParameters); + + /** + * Creates the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param notebookCreateUpdateParameters The notebook workspace to create for the current database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a notebook workspace resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NotebookWorkspaceInner createOrUpdate( + String resourceGroupName, + String accountName, + NotebookWorkspaceName notebookWorkspaceName, + NotebookWorkspaceCreateUpdateParameters notebookCreateUpdateParameters, + Context context); + + /** + * Deletes the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName); + + /** + * Deletes the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context); + + /** + * Deletes the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName); + + /** + * Deletes the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context); + + /** + * Retrieves the connection info for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connection info for the given notebook workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NotebookWorkspaceConnectionInfoResultInner listConnectionInfo( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName); + + /** + * Retrieves the connection info for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connection info for the given notebook workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listConnectionInfoWithResponse( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context); + + /** + * Regenerates the auth token for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginRegenerateAuthToken( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName); + + /** + * Regenerates the auth token for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginRegenerateAuthToken( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context); + + /** + * Regenerates the auth token for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void regenerateAuthToken(String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName); + + /** + * Regenerates the auth token for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void regenerateAuthToken( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context); + + /** + * Starts the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginStart( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName); + + /** + * Starts the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginStart( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context); + + /** + * Starts the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void start(String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName); + + /** + * Starts the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void start( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/OperationsClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/OperationsClient.java new file mode 100644 index 0000000000000..f8018e4162588 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/OperationsClient.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.OperationInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Lists all of the available Cosmos DB Resource Provider operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Resource Provider operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all of the available Cosmos DB Resource Provider operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Resource Provider operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PartitionKeyRangeIdRegionsClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PartitionKeyRangeIdRegionsClient.java new file mode 100644 index 0000000000000..58b422f3e7ee8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PartitionKeyRangeIdRegionsClient.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionMetricInner; + +/** An instance of this class provides access to all the operations defined in PartitionKeyRangeIdRegionsClient. */ +public interface PartitionKeyRangeIdRegionsClient { + /** + * Retrieves the metrics determined by the given filter for the given partition key range id and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter); + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter, + Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PartitionKeyRangeIdsClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PartitionKeyRangeIdsClient.java new file mode 100644 index 0000000000000..23d5345a64cf6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PartitionKeyRangeIdsClient.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionMetricInner; + +/** An instance of this class provides access to all the operations defined in PartitionKeyRangeIdsClient. */ +public interface PartitionKeyRangeIdsClient { + /** + * Retrieves the metrics determined by the given filter for the given partition key range id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter); + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter, + Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PercentileSourceTargetsClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PercentileSourceTargetsClient.java new file mode 100644 index 0000000000000..6a70d24b6dc7a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PercentileSourceTargetsClient.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PercentileMetricInner; + +/** An instance of this class provides access to all the operations defined in PercentileSourceTargetsClient. */ +public interface PercentileSourceTargetsClient { + /** + * Retrieves the metrics determined by the given filter for the given account, source and target region. This url is + * only for PBS and Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param sourceRegion Source region from which data is written. Cosmos DB region, with spaces between words and + * each word capitalized. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each + * word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, String accountName, String sourceRegion, String targetRegion, String filter); + + /** + * Retrieves the metrics determined by the given filter for the given account, source and target region. This url is + * only for PBS and Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param sourceRegion Source region from which data is written. Cosmos DB region, with spaces between words and + * each word capitalized. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each + * word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String sourceRegion, + String targetRegion, + String filter, + Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PercentileTargetsClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PercentileTargetsClient.java new file mode 100644 index 0000000000000..4ada663aeb2e5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PercentileTargetsClient.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PercentileMetricInner; + +/** An instance of this class provides access to all the operations defined in PercentileTargetsClient. */ +public interface PercentileTargetsClient { + /** + * Retrieves the metrics determined by the given filter for the given account target region. This url is only for + * PBS and Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each + * word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, String accountName, String targetRegion, String filter); + + /** + * Retrieves the metrics determined by the given filter for the given account target region. This url is only for + * PBS and Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each + * word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, String accountName, String targetRegion, String filter, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PercentilesClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PercentilesClient.java new file mode 100644 index 0000000000000..7217806035694 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PercentilesClient.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PercentileMetricInner; + +/** An instance of this class provides access to all the operations defined in PercentilesClient. */ +public interface PercentilesClient { + /** + * Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and + * Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics(String resourceGroupName, String accountName, String filter); + + /** + * Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and + * Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, String accountName, String filter, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PrivateEndpointConnectionsClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PrivateEndpointConnectionsClient.java new file mode 100644 index 0000000000000..4d51968e3ef5d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PrivateEndpointConnectionsClient.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PrivateEndpointConnectionInner; + +/** An instance of this class provides access to all the operations defined in PrivateEndpointConnectionsClient. */ +public interface PrivateEndpointConnectionsClient { + /** + * List all private endpoint connections on a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private endpoint connections. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabaseAccount(String resourceGroupName, String accountName); + + /** + * List all private endpoint connections on a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private endpoint connections. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabaseAccount( + String resourceGroupName, String accountName, Context context); + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner get( + String resourceGroupName, String accountName, String privateEndpointConnectionName); + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String accountName, String privateEndpointConnectionName, Context context); + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters); + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters A private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context); + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner createOrUpdate( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters); + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters A private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner createOrUpdate( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String accountName, String privateEndpointConnectionName); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String accountName, String privateEndpointConnectionName, Context context); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String accountName, String privateEndpointConnectionName); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String accountName, String privateEndpointConnectionName, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PrivateLinkResourcesClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PrivateLinkResourcesClient.java new file mode 100644 index 0000000000000..19d4b673e55a1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PrivateLinkResourcesClient.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PrivateLinkResourceInner; + +/** An instance of this class provides access to all the operations defined in PrivateLinkResourcesClient. */ +public interface PrivateLinkResourcesClient { + /** + * Gets the private link resources that need to be created for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabaseAccount(String resourceGroupName, String accountName); + + /** + * Gets the private link resources that need to be created for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabaseAccount( + String resourceGroupName, String accountName, Context context); + + /** + * Gets the private link resources that need to be created for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param groupName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateLinkResourceInner get(String resourceGroupName, String accountName, String groupName); + + /** + * Gets the private link resources that need to be created for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param groupName The name of the private link resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String accountName, String groupName, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableDatabaseAccountsClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableDatabaseAccountsClient.java new file mode 100644 index 0000000000000..e1a81199344c4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableDatabaseAccountsClient.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableDatabaseAccountGetResultInner; + +/** An instance of this class provides access to all the operations defined in RestorableDatabaseAccountsClient. */ +public interface RestorableDatabaseAccountsClient { + /** + * Lists all the restorable Azure Cosmos DB database accounts available under the subscription and in a region. This + * call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the restorable database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByLocation(String location); + + /** + * Lists all the restorable Azure Cosmos DB database accounts available under the subscription and in a region. This + * call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the restorable database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByLocation(String location, Context context); + + /** + * Lists all the restorable Azure Cosmos DB database accounts available under the subscription. This call requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the restorable database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all the restorable Azure Cosmos DB database accounts available under the subscription. This call requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the restorable database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Retrieves the properties of an existing Azure Cosmos DB restorable database account. This call requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read/*' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Azure Cosmos DB restorable database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RestorableDatabaseAccountGetResultInner getByLocation(String location, String instanceId); + + /** + * Retrieves the properties of an existing Azure Cosmos DB restorable database account. This call requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read/*' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Azure Cosmos DB restorable database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByLocationWithResponse( + String location, String instanceId, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableMongodbCollectionsClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableMongodbCollectionsClient.java new file mode 100644 index 0000000000000..9d78a201e544d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableMongodbCollectionsClient.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableMongodbCollectionGetResultInner; + +/** An instance of this class provides access to all the operations defined in RestorableMongodbCollectionsClient. */ +public interface RestorableMongodbCollectionsClient { + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB collections under a specific + * database. This helps in scenario where container was accidentally deleted. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the MongoDB collection events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String location, String instanceId); + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB collections under a specific + * database. This helps in scenario where container was accidentally deleted. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restorableMongodbDatabaseRid The resource ID of the MongoDB database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the MongoDB collection events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String location, String instanceId, String restorableMongodbDatabaseRid, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableMongodbDatabasesClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableMongodbDatabasesClient.java new file mode 100644 index 0000000000000..b7afb413fcaac --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableMongodbDatabasesClient.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableMongodbDatabaseGetResultInner; + +/** An instance of this class provides access to all the operations defined in RestorableMongodbDatabasesClient. */ +public interface RestorableMongodbDatabasesClient { + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB databases under the restorable + * account. This helps in scenario where database was accidentally deleted to get the deletion time. This API + * requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the MongoDB database events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String location, String instanceId); + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB databases under the restorable + * account. This helps in scenario where database was accidentally deleted to get the deletion time. This API + * requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the MongoDB database events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String location, String instanceId, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableMongodbResourcesClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableMongodbResourcesClient.java new file mode 100644 index 0000000000000..500f18611ecbe --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableMongodbResourcesClient.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseRestoreResourceInner; + +/** An instance of this class provides access to all the operations defined in RestorableMongodbResourcesClient. */ +public interface RestorableMongodbResourcesClient { + /** + * Return a list of database and collection combo that exist on the account at the given timestamp and location. + * This helps in scenarios to validate what resources exist at given timestamp and location. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the restorable MongoDB resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String location, String instanceId); + + /** + * Return a list of database and collection combo that exist on the account at the given timestamp and location. + * This helps in scenarios to validate what resources exist at given timestamp and location. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restoreLocation The location where the restorable resources are located. + * @param restoreTimestampInUtc The timestamp when the restorable resources existed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the restorable MongoDB resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String location, String instanceId, String restoreLocation, String restoreTimestampInUtc, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableSqlContainersClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableSqlContainersClient.java new file mode 100644 index 0000000000000..0ff310ccfaf9c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableSqlContainersClient.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableSqlContainerGetResultInner; + +/** An instance of this class provides access to all the operations defined in RestorableSqlContainersClient. */ +public interface RestorableSqlContainersClient { + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB SQL containers under a specific database. + * This helps in scenario where container was accidentally deleted. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the SQL container events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String location, String instanceId); + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB SQL containers under a specific database. + * This helps in scenario where container was accidentally deleted. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restorableSqlDatabaseRid The resource ID of the SQL database. + * @param startTime The snapshot create timestamp after which snapshots need to be listed. + * @param endTime The snapshot create timestamp before which snapshots need to be listed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the SQL container events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String location, + String instanceId, + String restorableSqlDatabaseRid, + String startTime, + String endTime, + Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableSqlDatabasesClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableSqlDatabasesClient.java new file mode 100644 index 0000000000000..900814ff66fac --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableSqlDatabasesClient.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableSqlDatabaseGetResultInner; + +/** An instance of this class provides access to all the operations defined in RestorableSqlDatabasesClient. */ +public interface RestorableSqlDatabasesClient { + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB SQL databases under the restorable account. + * This helps in scenario where database was accidentally deleted to get the deletion time. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the SQL database events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String location, String instanceId); + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB SQL databases under the restorable account. + * This helps in scenario where database was accidentally deleted to get the deletion time. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the SQL database events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String location, String instanceId, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableSqlResourcesClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableSqlResourcesClient.java new file mode 100644 index 0000000000000..d7584af724787 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableSqlResourcesClient.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseRestoreResourceInner; + +/** An instance of this class provides access to all the operations defined in RestorableSqlResourcesClient. */ +public interface RestorableSqlResourcesClient { + /** + * Return a list of database and container combo that exist on the account at the given timestamp and location. This + * helps in scenarios to validate what resources exist at given timestamp and location. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the restorable SQL resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String location, String instanceId); + + /** + * Return a list of database and container combo that exist on the account at the given timestamp and location. This + * helps in scenarios to validate what resources exist at given timestamp and location. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restoreLocation The location where the restorable resources are located. + * @param restoreTimestampInUtc The timestamp when the restorable resources existed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the restorable SQL resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String location, String instanceId, String restoreLocation, String restoreTimestampInUtc, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/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..406afc2a972fb --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/SqlResourcesClient.java @@ -0,0 +1,2210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.cosmos.generated.fluent.models.BackupInformationInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlContainerGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlDatabaseGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlRoleAssignmentGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlRoleDefinitionGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlStoredProcedureGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlTriggerGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlUserDefinedFunctionGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ThroughputSettingsGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.ContinuousBackupRestoreLocation; +import com.azure.resourcemanager.cosmos.generated.models.SqlContainerCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.SqlDatabaseCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.SqlRoleAssignmentCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.SqlRoleDefinitionCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.SqlStoredProcedureCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.SqlTriggerCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.SqlUserDefinedFunctionCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; + +/** An instance of this class provides access to all the operations defined in SqlResourcesClient. */ +public interface SqlResourcesClient { + /** + * Lists the SQL databases under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the SQL databases and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listSqlDatabases(String resourceGroupName, String accountName); + + /** + * Lists the SQL databases under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the SQL databases and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listSqlDatabases( + String resourceGroupName, String accountName, Context context); + + /** + * Gets the SQL database under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL database under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlDatabaseGetResultsInner getSqlDatabase(String resourceGroupName, String accountName, String databaseName); + + /** + * Gets the SQL database under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL database under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getSqlDatabaseWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Create or update an Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateSqlDatabaseParameters The parameters to provide for the current SQL database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, SqlDatabaseGetResultsInner> beginCreateUpdateSqlDatabase( + String resourceGroupName, + String accountName, + String databaseName, + SqlDatabaseCreateUpdateParameters createUpdateSqlDatabaseParameters); + + /** + * Create or update an Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateSqlDatabaseParameters The parameters to provide for the current SQL database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, SqlDatabaseGetResultsInner> beginCreateUpdateSqlDatabase( + String resourceGroupName, + String accountName, + String databaseName, + SqlDatabaseCreateUpdateParameters createUpdateSqlDatabaseParameters, + Context context); + + /** + * Create or update an Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateSqlDatabaseParameters The parameters to provide for the current SQL database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlDatabaseGetResultsInner createUpdateSqlDatabase( + String resourceGroupName, + String accountName, + String databaseName, + SqlDatabaseCreateUpdateParameters createUpdateSqlDatabaseParameters); + + /** + * Create or update an Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateSqlDatabaseParameters The parameters to provide for the current SQL database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlDatabaseGetResultsInner createUpdateSqlDatabase( + String resourceGroupName, + String accountName, + String databaseName, + SqlDatabaseCreateUpdateParameters createUpdateSqlDatabaseParameters, + Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDeleteSqlDatabase( + String resourceGroupName, String accountName, String databaseName); + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDeleteSqlDatabase( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteSqlDatabase(String resourceGroupName, String accountName, String databaseName); + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteSqlDatabase(String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Gets the RUs per second of the SQL database under an existing Azure Cosmos DB database account with the provided + * name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the SQL database under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner getSqlDatabaseThroughput( + String resourceGroupName, String accountName, String databaseName); + + /** + * Gets the RUs per second of the SQL database under an existing Azure Cosmos DB database account with the provided + * name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the SQL database under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getSqlDatabaseThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Update RUs per second of an Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateSqlDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Update RUs per second of an Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateSqlDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * Update RUs per second of an Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner updateSqlDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Update RUs per second of an Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner updateSqlDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * Migrate an Azure Cosmos DB SQL database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateSqlDatabaseToAutoscale(String resourceGroupName, String accountName, String databaseName); + + /** + * Migrate an Azure Cosmos DB SQL database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateSqlDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Migrate an Azure Cosmos DB SQL database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateSqlDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName); + + /** + * Migrate an Azure Cosmos DB SQL database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateSqlDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Migrate an Azure Cosmos DB SQL database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateSqlDatabaseToManualThroughput(String resourceGroupName, String accountName, String databaseName); + + /** + * Migrate an Azure Cosmos DB SQL database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateSqlDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Migrate an Azure Cosmos DB SQL database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateSqlDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName); + + /** + * Migrate an Azure Cosmos DB SQL database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateSqlDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Lists the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the containers and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listSqlContainers( + String resourceGroupName, String accountName, String databaseName); + + /** + * Lists the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the containers and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listSqlContainers( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Gets the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL container under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlContainerGetResultsInner getSqlContainer( + String resourceGroupName, String accountName, String databaseName, String containerName); + + /** + * Gets the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL container under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getSqlContainerWithResponse( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context); + + /** + * Create or update an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param createUpdateSqlContainerParameters The parameters to provide for the current SQL container. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, SqlContainerGetResultsInner> beginCreateUpdateSqlContainer( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters); + + /** + * Create or update an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param createUpdateSqlContainerParameters The parameters to provide for the current SQL container. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, SqlContainerGetResultsInner> beginCreateUpdateSqlContainer( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters, + Context context); + + /** + * Create or update an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param createUpdateSqlContainerParameters The parameters to provide for the current SQL container. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlContainerGetResultsInner createUpdateSqlContainer( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters); + + /** + * Create or update an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param createUpdateSqlContainerParameters The parameters to provide for the current SQL container. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlContainerGetResultsInner createUpdateSqlContainer( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters, + Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDeleteSqlContainer( + String resourceGroupName, String accountName, String databaseName, String containerName); + + /** + * Deletes an existing Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDeleteSqlContainer( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteSqlContainer(String resourceGroupName, String accountName, String databaseName, String containerName); + + /** + * Deletes an existing Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteSqlContainer( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context); + + /** + * Gets the RUs per second of the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the SQL container under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner getSqlContainerThroughput( + String resourceGroupName, String accountName, String databaseName, String containerName); + + /** + * Gets the RUs per second of the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the SQL container under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getSqlContainerThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context); + + /** + * Update RUs per second of an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL container. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateSqlContainerThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Update RUs per second of an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL container. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateSqlContainerThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * Update RUs per second of an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL container. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner updateSqlContainerThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Update RUs per second of an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL container. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner updateSqlContainerThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * Migrate an Azure Cosmos DB SQL container from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateSqlContainerToAutoscale( + String resourceGroupName, String accountName, String databaseName, String containerName); + + /** + * Migrate an Azure Cosmos DB SQL container from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateSqlContainerToAutoscale( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context); + + /** + * Migrate an Azure Cosmos DB SQL container from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateSqlContainerToAutoscale( + String resourceGroupName, String accountName, String databaseName, String containerName); + + /** + * Migrate an Azure Cosmos DB SQL container from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateSqlContainerToAutoscale( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context); + + /** + * Migrate an Azure Cosmos DB SQL container from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateSqlContainerToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String containerName); + + /** + * Migrate an Azure Cosmos DB SQL container from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateSqlContainerToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context); + + /** + * Migrate an Azure Cosmos DB SQL container from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateSqlContainerToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String containerName); + + /** + * Migrate an Azure Cosmos DB SQL container from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateSqlContainerToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context); + + /** + * Lists the SQL storedProcedure under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the storedProcedures and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listSqlStoredProcedures( + String resourceGroupName, String accountName, String databaseName, String containerName); + + /** + * Lists the SQL storedProcedure under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the storedProcedures and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listSqlStoredProcedures( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context); + + /** + * Gets the SQL storedProcedure under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL storedProcedure under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlStoredProcedureGetResultsInner getSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName); + + /** + * Gets the SQL storedProcedure under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL storedProcedure under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getSqlStoredProcedureWithResponse( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + Context context); + + /** + * Create or update an Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @param createUpdateSqlStoredProcedureParameters The parameters to provide for the current SQL storedProcedure. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB storedProcedure. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, SqlStoredProcedureGetResultsInner> + beginCreateUpdateSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + SqlStoredProcedureCreateUpdateParameters createUpdateSqlStoredProcedureParameters); + + /** + * Create or update an Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @param createUpdateSqlStoredProcedureParameters The parameters to provide for the current SQL storedProcedure. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB storedProcedure. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, SqlStoredProcedureGetResultsInner> + beginCreateUpdateSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + SqlStoredProcedureCreateUpdateParameters createUpdateSqlStoredProcedureParameters, + Context context); + + /** + * Create or update an Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @param createUpdateSqlStoredProcedureParameters The parameters to provide for the current SQL storedProcedure. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB storedProcedure. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlStoredProcedureGetResultsInner createUpdateSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + SqlStoredProcedureCreateUpdateParameters createUpdateSqlStoredProcedureParameters); + + /** + * Create or update an Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @param createUpdateSqlStoredProcedureParameters The parameters to provide for the current SQL storedProcedure. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB storedProcedure. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlStoredProcedureGetResultsInner createUpdateSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + SqlStoredProcedureCreateUpdateParameters createUpdateSqlStoredProcedureParameters, + Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDeleteSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName); + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDeleteSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName); + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + Context context); + + /** + * Lists the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the userDefinedFunctions and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listSqlUserDefinedFunctions( + String resourceGroupName, String accountName, String databaseName, String containerName); + + /** + * Lists the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the userDefinedFunctions and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listSqlUserDefinedFunctions( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context); + + /** + * Gets the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlUserDefinedFunctionGetResultsInner getSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName); + + /** + * Gets the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getSqlUserDefinedFunctionWithResponse( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + Context context); + + /** + * Create or update an Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param createUpdateSqlUserDefinedFunctionParameters The parameters to provide for the current SQL + * userDefinedFunction. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB userDefinedFunction. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, SqlUserDefinedFunctionGetResultsInner> + beginCreateUpdateSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters); + + /** + * Create or update an Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param createUpdateSqlUserDefinedFunctionParameters The parameters to provide for the current SQL + * userDefinedFunction. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB userDefinedFunction. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, SqlUserDefinedFunctionGetResultsInner> + beginCreateUpdateSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters, + Context context); + + /** + * Create or update an Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param createUpdateSqlUserDefinedFunctionParameters The parameters to provide for the current SQL + * userDefinedFunction. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB userDefinedFunction. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlUserDefinedFunctionGetResultsInner createUpdateSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters); + + /** + * Create or update an Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param createUpdateSqlUserDefinedFunctionParameters The parameters to provide for the current SQL + * userDefinedFunction. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB userDefinedFunction. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlUserDefinedFunctionGetResultsInner createUpdateSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters, + Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDeleteSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName); + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDeleteSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName); + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + Context context); + + /** + * Lists the SQL trigger under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the triggers and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listSqlTriggers( + String resourceGroupName, String accountName, String databaseName, String containerName); + + /** + * Lists the SQL trigger under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the triggers and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listSqlTriggers( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context); + + /** + * Gets the SQL trigger under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL trigger under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlTriggerGetResultsInner getSqlTrigger( + String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName); + + /** + * Gets the SQL trigger under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL trigger under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getSqlTriggerWithResponse( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + Context context); + + /** + * Create or update an Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @param createUpdateSqlTriggerParameters The parameters to provide for the current SQL trigger. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB trigger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, SqlTriggerGetResultsInner> beginCreateUpdateSqlTrigger( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters); + + /** + * Create or update an Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @param createUpdateSqlTriggerParameters The parameters to provide for the current SQL trigger. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB trigger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, SqlTriggerGetResultsInner> beginCreateUpdateSqlTrigger( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters, + Context context); + + /** + * Create or update an Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @param createUpdateSqlTriggerParameters The parameters to provide for the current SQL trigger. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB trigger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlTriggerGetResultsInner createUpdateSqlTrigger( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters); + + /** + * Create or update an Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @param createUpdateSqlTriggerParameters The parameters to provide for the current SQL trigger. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB trigger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlTriggerGetResultsInner createUpdateSqlTrigger( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters, + Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDeleteSqlTrigger( + String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName); + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDeleteSqlTrigger( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteSqlTrigger( + String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName); + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteSqlTrigger( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + Context context); + + /** + * Retrieves the properties of an existing Azure Cosmos DB SQL Role Definition with the given Id. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlRoleDefinitionGetResultsInner getSqlRoleDefinition( + String roleDefinitionId, String resourceGroupName, String accountName); + + /** + * Retrieves the properties of an existing Azure Cosmos DB SQL Role Definition with the given Id. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getSqlRoleDefinitionWithResponse( + String roleDefinitionId, String resourceGroupName, String accountName, Context context); + + /** + * Creates or updates an Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleDefinitionParameters The properties required to create or update a Role Definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, SqlRoleDefinitionGetResultsInner> + beginCreateUpdateSqlRoleDefinition( + String roleDefinitionId, + String resourceGroupName, + String accountName, + SqlRoleDefinitionCreateUpdateParameters createUpdateSqlRoleDefinitionParameters); + + /** + * Creates or updates an Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleDefinitionParameters The properties required to create or update a Role Definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, SqlRoleDefinitionGetResultsInner> + beginCreateUpdateSqlRoleDefinition( + String roleDefinitionId, + String resourceGroupName, + String accountName, + SqlRoleDefinitionCreateUpdateParameters createUpdateSqlRoleDefinitionParameters, + Context context); + + /** + * Creates or updates an Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleDefinitionParameters The properties required to create or update a Role Definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlRoleDefinitionGetResultsInner createUpdateSqlRoleDefinition( + String roleDefinitionId, + String resourceGroupName, + String accountName, + SqlRoleDefinitionCreateUpdateParameters createUpdateSqlRoleDefinitionParameters); + + /** + * Creates or updates an Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleDefinitionParameters The properties required to create or update a Role Definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlRoleDefinitionGetResultsInner createUpdateSqlRoleDefinition( + String roleDefinitionId, + String resourceGroupName, + String accountName, + SqlRoleDefinitionCreateUpdateParameters createUpdateSqlRoleDefinitionParameters, + Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDeleteSqlRoleDefinition( + String roleDefinitionId, String resourceGroupName, String accountName); + + /** + * Deletes an existing Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDeleteSqlRoleDefinition( + String roleDefinitionId, String resourceGroupName, String accountName, Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteSqlRoleDefinition(String roleDefinitionId, String resourceGroupName, String accountName); + + /** + * Deletes an existing Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteSqlRoleDefinition( + String roleDefinitionId, String resourceGroupName, String accountName, Context context); + + /** + * Retrieves the list of all Azure Cosmos DB SQL Role Definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the relevant Role Definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listSqlRoleDefinitions( + String resourceGroupName, String accountName); + + /** + * Retrieves the list of all Azure Cosmos DB SQL Role Definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the relevant Role Definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listSqlRoleDefinitions( + String resourceGroupName, String accountName, Context context); + + /** + * Retrieves the properties of an existing Azure Cosmos DB SQL Role Assignment with the given Id. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlRoleAssignmentGetResultsInner getSqlRoleAssignment( + String roleAssignmentId, String resourceGroupName, String accountName); + + /** + * Retrieves the properties of an existing Azure Cosmos DB SQL Role Assignment with the given Id. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getSqlRoleAssignmentWithResponse( + String roleAssignmentId, String resourceGroupName, String accountName, Context context); + + /** + * Creates or updates an Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleAssignmentParameters The properties required to create or update a Role Assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, SqlRoleAssignmentGetResultsInner> + beginCreateUpdateSqlRoleAssignment( + String roleAssignmentId, + String resourceGroupName, + String accountName, + SqlRoleAssignmentCreateUpdateParameters createUpdateSqlRoleAssignmentParameters); + + /** + * Creates or updates an Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleAssignmentParameters The properties required to create or update a Role Assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, SqlRoleAssignmentGetResultsInner> + beginCreateUpdateSqlRoleAssignment( + String roleAssignmentId, + String resourceGroupName, + String accountName, + SqlRoleAssignmentCreateUpdateParameters createUpdateSqlRoleAssignmentParameters, + Context context); + + /** + * Creates or updates an Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleAssignmentParameters The properties required to create or update a Role Assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlRoleAssignmentGetResultsInner createUpdateSqlRoleAssignment( + String roleAssignmentId, + String resourceGroupName, + String accountName, + SqlRoleAssignmentCreateUpdateParameters createUpdateSqlRoleAssignmentParameters); + + /** + * Creates or updates an Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleAssignmentParameters The properties required to create or update a Role Assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlRoleAssignmentGetResultsInner createUpdateSqlRoleAssignment( + String roleAssignmentId, + String resourceGroupName, + String accountName, + SqlRoleAssignmentCreateUpdateParameters createUpdateSqlRoleAssignmentParameters, + Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDeleteSqlRoleAssignment( + String roleAssignmentId, String resourceGroupName, String accountName); + + /** + * Deletes an existing Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDeleteSqlRoleAssignment( + String roleAssignmentId, String resourceGroupName, String accountName, Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteSqlRoleAssignment(String roleAssignmentId, String resourceGroupName, String accountName); + + /** + * Deletes an existing Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteSqlRoleAssignment( + String roleAssignmentId, String resourceGroupName, String accountName, Context context); + + /** + * Retrieves the list of all Azure Cosmos DB SQL Role Assignments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the relevant Role Assignments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listSqlRoleAssignments( + String resourceGroupName, String accountName); + + /** + * Retrieves the list of all Azure Cosmos DB SQL Role Assignments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the relevant Role Assignments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listSqlRoleAssignments( + String resourceGroupName, String accountName, Context context); + + /** + * Retrieves continuous backup information for a container resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param location The name of the continuous backup restore location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup information of a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, BackupInformationInner> beginRetrieveContinuousBackupInformation( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ContinuousBackupRestoreLocation location); + + /** + * Retrieves continuous backup information for a container resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param location The name of the continuous backup restore location. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup information of a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + 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..d046814f11407 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/TableResourcesClient.java @@ -0,0 +1,454 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.cosmos.generated.fluent.models.TableGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ThroughputSettingsGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.TableCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; + +/** An instance of this class provides access to all the operations defined in TableResourcesClient. */ +public interface TableResourcesClient { + /** + * Lists the Tables under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the Table and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listTables(String resourceGroupName, String accountName); + + /** + * Lists the Tables under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the Table and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listTables(String resourceGroupName, String accountName, Context context); + + /** + * Gets the Tables under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Tables under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TableGetResultsInner getTable(String resourceGroupName, String accountName, String tableName); + + /** + * Gets the Tables under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Tables under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getTableWithResponse( + String resourceGroupName, String accountName, String tableName, Context context); + + /** + * Create or update an Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param createUpdateTableParameters The parameters to provide for the current Table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, TableGetResultsInner> beginCreateUpdateTable( + String resourceGroupName, + String accountName, + String tableName, + TableCreateUpdateParameters createUpdateTableParameters); + + /** + * Create or update an Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param createUpdateTableParameters The parameters to provide for the current Table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, TableGetResultsInner> beginCreateUpdateTable( + String resourceGroupName, + String accountName, + String tableName, + TableCreateUpdateParameters createUpdateTableParameters, + Context context); + + /** + * Create or update an Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param createUpdateTableParameters The parameters to provide for the current Table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TableGetResultsInner createUpdateTable( + String resourceGroupName, + String accountName, + String tableName, + TableCreateUpdateParameters createUpdateTableParameters); + + /** + * Create or update an Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param createUpdateTableParameters The parameters to provide for the current Table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TableGetResultsInner createUpdateTable( + String resourceGroupName, + String accountName, + String tableName, + TableCreateUpdateParameters createUpdateTableParameters, + Context context); + + /** + * Deletes an existing Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDeleteTable(String resourceGroupName, String accountName, String tableName); + + /** + * Deletes an existing Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDeleteTable( + String resourceGroupName, String accountName, String tableName, Context context); + + /** + * Deletes an existing Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteTable(String resourceGroupName, String accountName, String tableName); + + /** + * Deletes an existing Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteTable(String resourceGroupName, String accountName, String tableName, Context context); + + /** + * Gets the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided + * name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner getTableThroughput( + String resourceGroupName, String accountName, String tableName); + + /** + * Gets the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided + * name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getTableThroughputWithResponse( + String resourceGroupName, String accountName, String tableName, Context context); + + /** + * Update RUs per second of an Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current Table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateTableThroughput( + String resourceGroupName, + String accountName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Update RUs per second of an Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current Table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateTableThroughput( + String resourceGroupName, + String accountName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * Update RUs per second of an Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current Table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner updateTableThroughput( + String resourceGroupName, + String accountName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Update RUs per second of an Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current Table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner updateTableThroughput( + String resourceGroupName, + String accountName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * Migrate an Azure Cosmos DB Table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateTableToAutoscale(String resourceGroupName, String accountName, String tableName); + + /** + * Migrate an Azure Cosmos DB Table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateTableToAutoscale(String resourceGroupName, String accountName, String tableName, Context context); + + /** + * Migrate an Azure Cosmos DB Table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateTableToAutoscale( + String resourceGroupName, String accountName, String tableName); + + /** + * Migrate an Azure Cosmos DB Table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateTableToAutoscale( + String resourceGroupName, String accountName, String tableName, Context context); + + /** + * Migrate an Azure Cosmos DB Table from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateTableToManualThroughput(String resourceGroupName, String accountName, String tableName); + + /** + * Migrate an Azure Cosmos DB Table from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateTableToManualThroughput( + String resourceGroupName, String accountName, String tableName, Context context); + + /** + * Migrate an Azure Cosmos DB Table from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateTableToManualThroughput( + String resourceGroupName, String accountName, String tableName); + + /** + * Migrate an Azure Cosmos DB Table from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateTableToManualThroughput( + String resourceGroupName, String accountName, String tableName, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/BackupInformationInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/BackupInformationInner.java new file mode 100644 index 0000000000000..19775273edb83 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/BackupInformationInner.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ContinuousBackupInformation; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Backup information of a resource. */ +@Immutable +public final class BackupInformationInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BackupInformationInner.class); + + /* + * Information about the status of continuous backups. + */ + @JsonProperty(value = "continuousBackupInformation", access = JsonProperty.Access.WRITE_ONLY) + private ContinuousBackupInformation continuousBackupInformation; + + /** + * Get the continuousBackupInformation property: Information about the status of continuous backups. + * + * @return the continuousBackupInformation value. + */ + public ContinuousBackupInformation continuousBackupInformation() { + return this.continuousBackupInformation; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (continuousBackupInformation() != null) { + continuousBackupInformation().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/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..8e40aea4490dd --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraKeyspaceGetResultsInner.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.CassandraKeyspaceGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.CassandraKeyspaceGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An Azure Cosmos DB Cassandra keyspace. */ +@JsonFlatten +@Fluent +public class CassandraKeyspaceGetResultsInner extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CassandraKeyspaceGetResultsInner.class); + + /* + * The resource property. + */ + @JsonProperty(value = "properties.resource") + private CassandraKeyspaceGetPropertiesResource resource; + + /* + * The options property. + */ + @JsonProperty(value = "properties.options") + private CassandraKeyspaceGetPropertiesOptions options; + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public CassandraKeyspaceGetPropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the CassandraKeyspaceGetResultsInner object itself. + */ + public CassandraKeyspaceGetResultsInner 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 CassandraKeyspaceGetResultsInner object itself. + */ + public CassandraKeyspaceGetResultsInner withOptions(CassandraKeyspaceGetPropertiesOptions options) { + this.options = options; + return this; + } + + /** {@inheritDoc} */ + @Override + public CassandraKeyspaceGetResultsInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public CassandraKeyspaceGetResultsInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.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..a285516ccdff1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraTableGetResultsInner.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.CassandraTableGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.CassandraTableGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An Azure Cosmos DB Cassandra table. */ +@JsonFlatten +@Fluent +public class CassandraTableGetResultsInner extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CassandraTableGetResultsInner.class); + + /* + * The resource property. + */ + @JsonProperty(value = "properties.resource") + private CassandraTableGetPropertiesResource resource; + + /* + * The options property. + */ + @JsonProperty(value = "properties.options") + private CassandraTableGetPropertiesOptions options; + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public CassandraTableGetPropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the CassandraTableGetResultsInner object itself. + */ + public CassandraTableGetResultsInner 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 CassandraTableGetResultsInner object itself. + */ + public CassandraTableGetResultsInner withOptions(CassandraTableGetPropertiesOptions options) { + this.options = options; + return this; + } + + /** {@inheritDoc} */ + @Override + public CassandraTableGetResultsInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public CassandraTableGetResultsInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.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/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..e5e4722d203c6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountGetResultsInner.java @@ -0,0 +1,983 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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.annotation.JsonFlatten; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.AnalyticalStorageConfiguration; +import com.azure.resourcemanager.cosmos.generated.models.ApiProperties; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.BackupPolicy; +import com.azure.resourcemanager.cosmos.generated.models.Capability; +import com.azure.resourcemanager.cosmos.generated.models.ConnectorOffer; +import com.azure.resourcemanager.cosmos.generated.models.ConsistencyPolicy; +import com.azure.resourcemanager.cosmos.generated.models.CorsPolicy; +import com.azure.resourcemanager.cosmos.generated.models.CreateMode; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountKind; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountOfferType; +import com.azure.resourcemanager.cosmos.generated.models.FailoverPolicy; +import com.azure.resourcemanager.cosmos.generated.models.IpAddressOrRange; +import com.azure.resourcemanager.cosmos.generated.models.Location; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentity; +import com.azure.resourcemanager.cosmos.generated.models.NetworkAclBypass; +import com.azure.resourcemanager.cosmos.generated.models.PublicNetworkAccess; +import com.azure.resourcemanager.cosmos.generated.models.RestoreParameters; +import com.azure.resourcemanager.cosmos.generated.models.VirtualNetworkRule; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** An Azure Cosmos DB database account. */ +@JsonFlatten +@Fluent +public class DatabaseAccountGetResultsInner extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseAccountGetResultsInner.class); + + /* + * Indicates the type of database account. This can only be set at database + * account creation. + */ + @JsonProperty(value = "kind") + private DatabaseAccountKind kind; + + /* + * Identity for the resource. + */ + @JsonProperty(value = "identity") + private ManagedServiceIdentity identity; + + /* + * The system meta data relating to this resource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * 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 = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The connection endpoint for the Cosmos DB database account. + */ + @JsonProperty(value = "properties.documentEndpoint", access = JsonProperty.Access.WRITE_ONLY) + private String documentEndpoint; + + /* + * The offer type for the Cosmos DB database account. Default value: + * Standard. + */ + @JsonProperty(value = "properties.databaseAccountOfferType", access = JsonProperty.Access.WRITE_ONLY) + private DatabaseAccountOfferType databaseAccountOfferType; + + /* + * List of IpRules. + */ + @JsonProperty(value = "properties.ipRules") + private List ipRules; + + /* + * Flag to indicate whether to enable/disable Virtual Network ACL rules. + */ + @JsonProperty(value = "properties.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 = "properties.enableAutomaticFailover") + private Boolean enableAutomaticFailover; + + /* + * The consistency policy for the Cosmos DB database account. + */ + @JsonProperty(value = "properties.consistencyPolicy") + private ConsistencyPolicy consistencyPolicy; + + /* + * List of Cosmos DB capabilities for the account + */ + @JsonProperty(value = "properties.capabilities") + private List capabilities; + + /* + * An array that contains the write location for the Cosmos DB account. + */ + @JsonProperty(value = "properties.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 = "properties.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 = "properties.locations", access = JsonProperty.Access.WRITE_ONLY) + private List locations; + + /* + * An array that contains the regions ordered by their failover priorities. + */ + @JsonProperty(value = "properties.failoverPolicies", access = JsonProperty.Access.WRITE_ONLY) + private List failoverPolicies; + + /* + * List of Virtual Network ACL rules configured for the Cosmos DB account. + */ + @JsonProperty(value = "properties.virtualNetworkRules") + private List virtualNetworkRules; + + /* + * List of Private Endpoint Connections configured for the Cosmos DB + * account. + */ + @JsonProperty(value = "properties.privateEndpointConnections", access = JsonProperty.Access.WRITE_ONLY) + private List privateEndpointConnections; + + /* + * Enables the account to write in multiple locations + */ + @JsonProperty(value = "properties.enableMultipleWriteLocations") + private Boolean enableMultipleWriteLocations; + + /* + * Enables the cassandra connector on the Cosmos DB C* account + */ + @JsonProperty(value = "properties.enableCassandraConnector") + private Boolean enableCassandraConnector; + + /* + * The cassandra connector offer type for the Cosmos DB database C* + * account. + */ + @JsonProperty(value = "properties.connectorOffer") + private ConnectorOffer connectorOffer; + + /* + * Disable write operations on metadata resources (databases, containers, + * throughput) via account keys + */ + @JsonProperty(value = "properties.disableKeyBasedMetadataWriteAccess") + private Boolean disableKeyBasedMetadataWriteAccess; + + /* + * The URI of the key vault + */ + @JsonProperty(value = "properties.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 = "properties.defaultIdentity") + private String defaultIdentity; + + /* + * Whether requests from Public Network are allowed + */ + @JsonProperty(value = "properties.publicNetworkAccess") + private PublicNetworkAccess publicNetworkAccess; + + /* + * Flag to indicate whether Free Tier is enabled. + */ + @JsonProperty(value = "properties.enableFreeTier") + private Boolean enableFreeTier; + + /* + * API specific properties. + */ + @JsonProperty(value = "properties.apiProperties") + private ApiProperties apiProperties; + + /* + * Flag to indicate whether to enable storage analytics. + */ + @JsonProperty(value = "properties.enableAnalyticalStorage") + private Boolean enableAnalyticalStorage; + + /* + * Analytical storage specific properties. + */ + @JsonProperty(value = "properties.analyticalStorageConfiguration") + private AnalyticalStorageConfiguration analyticalStorageConfiguration; + + /* + * A unique identifier assigned to the database account + */ + @JsonProperty(value = "properties.instanceId", access = JsonProperty.Access.WRITE_ONLY) + private String instanceId; + + /* + * Enum to indicate the mode of account creation. + */ + @JsonProperty(value = "properties.createMode") + private CreateMode createMode; + + /* + * Parameters to indicate the information about the restore. + */ + @JsonProperty(value = "properties.restoreParameters") + private RestoreParameters restoreParameters; + + /* + * The object representing the policy for taking backups on an account. + */ + @JsonProperty(value = "properties.backupPolicy") + private BackupPolicy backupPolicy; + + /* + * The CORS policy for the Cosmos DB database account. + */ + @JsonProperty(value = "properties.cors") + private List cors; + + /* + * Indicates what services are allowed to bypass firewall checks. + */ + @JsonProperty(value = "properties.networkAclBypass") + private NetworkAclBypass networkAclBypass; + + /* + * An array that contains the Resource Ids for Network Acl Bypass for the + * Cosmos DB account. + */ + @JsonProperty(value = "properties.networkAclBypassResourceIds") + private List networkAclBypassResourceIds; + + /* + * Opt-out of local authentication and ensure only MSI and AAD can be used + * exclusively for authentication. + */ + @JsonProperty(value = "properties.disableLocalAuth") + private Boolean disableLocalAuth; + + /** + * 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 systemData property: The system meta data relating to this resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * 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 DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner 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 DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner 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 DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner 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 DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner 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 DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner 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 DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner 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 DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner 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 DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner 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 DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner 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 DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner 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 DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner 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 DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner 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 DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner 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 DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner 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 DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner 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 DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner 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 DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner 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 DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner 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 DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner 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 DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner 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 DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner 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 DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner 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 DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner 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 DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner withDisableLocalAuth(Boolean disableLocalAuth) { + this.disableLocalAuth = disableLocalAuth; + return this; + } + + /** {@inheritDoc} */ + @Override + public DatabaseAccountGetResultsInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public DatabaseAccountGetResultsInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (identity() != null) { + identity().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()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountListConnectionStringsResultInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountListConnectionStringsResultInner.java new file mode 100644 index 0000000000000..853872708750a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountListConnectionStringsResultInner.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountConnectionString; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The connection strings for the given database account. */ +@Fluent +public final class DatabaseAccountListConnectionStringsResultInner { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(DatabaseAccountListConnectionStringsResultInner.class); + + /* + * An array that contains the connection strings for the Cosmos DB account. + */ + @JsonProperty(value = "connectionStrings") + private List connectionStrings; + + /** + * Get the connectionStrings property: An array that contains the connection strings for the Cosmos DB account. + * + * @return the connectionStrings value. + */ + public List connectionStrings() { + return this.connectionStrings; + } + + /** + * Set the connectionStrings property: An array that contains the connection strings for the Cosmos DB account. + * + * @param connectionStrings the connectionStrings value to set. + * @return the DatabaseAccountListConnectionStringsResultInner object itself. + */ + public DatabaseAccountListConnectionStringsResultInner withConnectionStrings( + List connectionStrings) { + this.connectionStrings = connectionStrings; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (connectionStrings() != null) { + connectionStrings().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountListKeysResultInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountListKeysResultInner.java new file mode 100644 index 0000000000000..c2dc41808d004 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountListKeysResultInner.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The access keys for the given database account. */ +@Immutable +public final class DatabaseAccountListKeysResultInner extends DatabaseAccountListReadOnlyKeysResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseAccountListKeysResultInner.class); + + /* + * Base 64 encoded value of the primary read-write key. + */ + @JsonProperty(value = "primaryMasterKey", access = JsonProperty.Access.WRITE_ONLY) + private String primaryMasterKey; + + /* + * Base 64 encoded value of the secondary read-write key. + */ + @JsonProperty(value = "secondaryMasterKey", access = JsonProperty.Access.WRITE_ONLY) + private String secondaryMasterKey; + + /** + * Get the primaryMasterKey property: Base 64 encoded value of the primary read-write key. + * + * @return the primaryMasterKey value. + */ + public String primaryMasterKey() { + return this.primaryMasterKey; + } + + /** + * Get the secondaryMasterKey property: Base 64 encoded value of the secondary read-write key. + * + * @return the secondaryMasterKey value. + */ + public String secondaryMasterKey() { + return this.secondaryMasterKey; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountListReadOnlyKeysResultInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountListReadOnlyKeysResultInner.java new file mode 100644 index 0000000000000..f65ed483bcfff --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountListReadOnlyKeysResultInner.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The read-only access keys for the given database account. */ +@Immutable +public class DatabaseAccountListReadOnlyKeysResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseAccountListReadOnlyKeysResultInner.class); + + /* + * Base 64 encoded value of the primary read-only key. + */ + @JsonProperty(value = "primaryReadonlyMasterKey", access = JsonProperty.Access.WRITE_ONLY) + private String primaryReadonlyMasterKey; + + /* + * Base 64 encoded value of the secondary read-only key. + */ + @JsonProperty(value = "secondaryReadonlyMasterKey", access = JsonProperty.Access.WRITE_ONLY) + private String secondaryReadonlyMasterKey; + + /** + * Get the primaryReadonlyMasterKey property: Base 64 encoded value of the primary read-only key. + * + * @return the primaryReadonlyMasterKey value. + */ + public String primaryReadonlyMasterKey() { + return this.primaryReadonlyMasterKey; + } + + /** + * Get the secondaryReadonlyMasterKey property: Base 64 encoded value of the secondary read-only key. + * + * @return the secondaryReadonlyMasterKey value. + */ + public String secondaryReadonlyMasterKey() { + return this.secondaryReadonlyMasterKey; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseRestoreResourceInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseRestoreResourceInner.java new file mode 100644 index 0000000000000..273c9373b100e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseRestoreResourceInner.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Specific Databases to restore. */ +@Fluent +public final class DatabaseRestoreResourceInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseRestoreResourceInner.class); + + /* + * The name of the database available for restore. + */ + @JsonProperty(value = "databaseName") + private String databaseName; + + /* + * The names of the collections available for restore. + */ + @JsonProperty(value = "collectionNames") + private List collectionNames; + + /** + * Get the databaseName property: The name of the database available for restore. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Set the databaseName property: The name of the database available for restore. + * + * @param databaseName the databaseName value to set. + * @return the DatabaseRestoreResourceInner object itself. + */ + public DatabaseRestoreResourceInner withDatabaseName(String databaseName) { + this.databaseName = databaseName; + return this; + } + + /** + * Get the collectionNames property: The names of the collections available for restore. + * + * @return the collectionNames value. + */ + public List collectionNames() { + return this.collectionNames; + } + + /** + * Set the collectionNames property: The names of the collections available for restore. + * + * @param collectionNames the collectionNames value to set. + * @return the DatabaseRestoreResourceInner object itself. + */ + public DatabaseRestoreResourceInner withCollectionNames(List collectionNames) { + this.collectionNames = collectionNames; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/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..64ed4df786376 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/GremlinDatabaseGetResultsInner.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.GremlinDatabaseGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.GremlinDatabaseGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An Azure Cosmos DB Gremlin database. */ +@JsonFlatten +@Fluent +public class GremlinDatabaseGetResultsInner extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GremlinDatabaseGetResultsInner.class); + + /* + * The resource property. + */ + @JsonProperty(value = "properties.resource") + private GremlinDatabaseGetPropertiesResource resource; + + /* + * The options property. + */ + @JsonProperty(value = "properties.options") + private GremlinDatabaseGetPropertiesOptions options; + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public GremlinDatabaseGetPropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the GremlinDatabaseGetResultsInner object itself. + */ + public GremlinDatabaseGetResultsInner 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 GremlinDatabaseGetResultsInner object itself. + */ + public GremlinDatabaseGetResultsInner withOptions(GremlinDatabaseGetPropertiesOptions options) { + this.options = options; + return this; + } + + /** {@inheritDoc} */ + @Override + public GremlinDatabaseGetResultsInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public GremlinDatabaseGetResultsInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.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..d2b6a532dcd1c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/GremlinGraphGetResultsInner.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.GremlinGraphGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.GremlinGraphGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An Azure Cosmos DB Gremlin graph. */ +@JsonFlatten +@Fluent +public class GremlinGraphGetResultsInner extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GremlinGraphGetResultsInner.class); + + /* + * The resource property. + */ + @JsonProperty(value = "properties.resource") + private GremlinGraphGetPropertiesResource resource; + + /* + * The options property. + */ + @JsonProperty(value = "properties.options") + private GremlinGraphGetPropertiesOptions options; + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public GremlinGraphGetPropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the GremlinGraphGetResultsInner object itself. + */ + public GremlinGraphGetResultsInner 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 GremlinGraphGetResultsInner object itself. + */ + public GremlinGraphGetResultsInner withOptions(GremlinGraphGetPropertiesOptions options) { + this.options = options; + return this; + } + + /** {@inheritDoc} */ + @Override + public GremlinGraphGetResultsInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public GremlinGraphGetResultsInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.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/MetricDefinitionInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MetricDefinitionInner.java new file mode 100644 index 0000000000000..2810b36183b68 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MetricDefinitionInner.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.MetricAvailability; +import com.azure.resourcemanager.cosmos.generated.models.MetricName; +import com.azure.resourcemanager.cosmos.generated.models.PrimaryAggregationType; +import com.azure.resourcemanager.cosmos.generated.models.UnitType; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The definition of a metric. */ +@Immutable +public final class MetricDefinitionInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricDefinitionInner.class); + + /* + * The list of metric availabilities for the account. + */ + @JsonProperty(value = "metricAvailabilities", access = JsonProperty.Access.WRITE_ONLY) + private List metricAvailabilities; + + /* + * The primary aggregation type of the metric. + */ + @JsonProperty(value = "primaryAggregationType", access = JsonProperty.Access.WRITE_ONLY) + private PrimaryAggregationType primaryAggregationType; + + /* + * The unit of the metric. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private UnitType unit; + + /* + * The resource uri of the database. + */ + @JsonProperty(value = "resourceUri", access = JsonProperty.Access.WRITE_ONLY) + private String resourceUri; + + /* + * The name information for the metric. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private MetricName name; + + /** + * Get the metricAvailabilities property: The list of metric availabilities for the account. + * + * @return the metricAvailabilities value. + */ + public List metricAvailabilities() { + return this.metricAvailabilities; + } + + /** + * Get the primaryAggregationType property: The primary aggregation type of the metric. + * + * @return the primaryAggregationType value. + */ + public PrimaryAggregationType primaryAggregationType() { + return this.primaryAggregationType; + } + + /** + * Get the unit property: The unit of the metric. + * + * @return the unit value. + */ + public UnitType unit() { + return this.unit; + } + + /** + * Get the resourceUri property: The resource uri of the database. + * + * @return the resourceUri value. + */ + public String resourceUri() { + return this.resourceUri; + } + + /** + * Get the name property: The name information for the metric. + * + * @return the name value. + */ + public MetricName name() { + return this.name; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (metricAvailabilities() != null) { + metricAvailabilities().forEach(e -> e.validate()); + } + if (name() != null) { + name().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MetricInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MetricInner.java new file mode 100644 index 0000000000000..6925f3968c08a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MetricInner.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.MetricName; +import com.azure.resourcemanager.cosmos.generated.models.MetricValue; +import com.azure.resourcemanager.cosmos.generated.models.UnitType; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Metric data. */ +@Immutable +public class MetricInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricInner.class); + + /* + * The start time for the metric (ISO-8601 format). + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * The end time for the metric (ISO-8601 format). + */ + @JsonProperty(value = "endTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime endTime; + + /* + * The time grain to be used to summarize the metric values. + */ + @JsonProperty(value = "timeGrain", access = JsonProperty.Access.WRITE_ONLY) + private String timeGrain; + + /* + * The unit of the metric. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private UnitType unit; + + /* + * The name information for the metric. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private MetricName name; + + /* + * The metric values for the specified time window and timestep. + */ + @JsonProperty(value = "metricValues", access = JsonProperty.Access.WRITE_ONLY) + private List metricValues; + + /** + * Get the startTime property: The start time for the metric (ISO-8601 format). + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Get the endTime property: The end time for the metric (ISO-8601 format). + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Get the timeGrain property: The time grain to be used to summarize the metric values. + * + * @return the timeGrain value. + */ + public String timeGrain() { + return this.timeGrain; + } + + /** + * Get the unit property: The unit of the metric. + * + * @return the unit value. + */ + public UnitType unit() { + return this.unit; + } + + /** + * Get the name property: The name information for the metric. + * + * @return the name value. + */ + public MetricName name() { + return this.name; + } + + /** + * Get the metricValues property: The metric values for the specified time window and timestep. + * + * @return the metricValues value. + */ + public List metricValues() { + return this.metricValues; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() != null) { + name().validate(); + } + if (metricValues() != null) { + metricValues().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/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..a055d33689de1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoDBCollectionGetResultsInner.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An Azure Cosmos DB MongoDB collection. */ +@JsonFlatten +@Fluent +public class MongoDBCollectionGetResultsInner extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MongoDBCollectionGetResultsInner.class); + + /* + * The resource property. + */ + @JsonProperty(value = "properties.resource") + private MongoDBCollectionGetPropertiesResource resource; + + /* + * The options property. + */ + @JsonProperty(value = "properties.options") + private MongoDBCollectionGetPropertiesOptions options; + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public MongoDBCollectionGetPropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the MongoDBCollectionGetResultsInner object itself. + */ + public MongoDBCollectionGetResultsInner 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 MongoDBCollectionGetResultsInner object itself. + */ + public MongoDBCollectionGetResultsInner withOptions(MongoDBCollectionGetPropertiesOptions options) { + this.options = options; + return this; + } + + /** {@inheritDoc} */ + @Override + public MongoDBCollectionGetResultsInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public MongoDBCollectionGetResultsInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.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..3fa09fc2d1336 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoDBDatabaseGetResultsInner.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An Azure Cosmos DB MongoDB database. */ +@JsonFlatten +@Fluent +public class MongoDBDatabaseGetResultsInner extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MongoDBDatabaseGetResultsInner.class); + + /* + * The resource property. + */ + @JsonProperty(value = "properties.resource") + private MongoDBDatabaseGetPropertiesResource resource; + + /* + * The options property. + */ + @JsonProperty(value = "properties.options") + private MongoDBDatabaseGetPropertiesOptions options; + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public MongoDBDatabaseGetPropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the MongoDBDatabaseGetResultsInner object itself. + */ + public MongoDBDatabaseGetResultsInner 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 MongoDBDatabaseGetResultsInner object itself. + */ + public MongoDBDatabaseGetResultsInner withOptions(MongoDBDatabaseGetPropertiesOptions options) { + this.options = options; + return this; + } + + /** {@inheritDoc} */ + @Override + public MongoDBDatabaseGetResultsInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public MongoDBDatabaseGetResultsInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.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/NotebookWorkspaceConnectionInfoResultInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/NotebookWorkspaceConnectionInfoResultInner.java new file mode 100644 index 0000000000000..227e967d846bf --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/NotebookWorkspaceConnectionInfoResultInner.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The connection info for the given notebook workspace. */ +@Immutable +public final class NotebookWorkspaceConnectionInfoResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NotebookWorkspaceConnectionInfoResultInner.class); + + /* + * Specifies auth token used for connecting to Notebook server (uses + * token-based auth). + */ + @JsonProperty(value = "authToken", access = JsonProperty.Access.WRITE_ONLY) + private String authToken; + + /* + * Specifies the endpoint of Notebook server. + */ + @JsonProperty(value = "notebookServerEndpoint", access = JsonProperty.Access.WRITE_ONLY) + private String notebookServerEndpoint; + + /** + * Get the authToken property: Specifies auth token used for connecting to Notebook server (uses token-based auth). + * + * @return the authToken value. + */ + public String authToken() { + return this.authToken; + } + + /** + * Get the notebookServerEndpoint property: Specifies the endpoint of Notebook server. + * + * @return the notebookServerEndpoint value. + */ + public String notebookServerEndpoint() { + return this.notebookServerEndpoint; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/NotebookWorkspaceInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/NotebookWorkspaceInner.java new file mode 100644 index 0000000000000..765f2ff70f9da --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/NotebookWorkspaceInner.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ArmProxyResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A notebook workspace resource. */ +@JsonFlatten +@Immutable +public class NotebookWorkspaceInner extends ArmProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NotebookWorkspaceInner.class); + + /* + * Specifies the endpoint of Notebook server. + */ + @JsonProperty(value = "properties.notebookServerEndpoint", access = JsonProperty.Access.WRITE_ONLY) + private String notebookServerEndpoint; + + /* + * Status of the notebook workspace. Possible values are: Creating, Online, + * Deleting, Failed, Updating. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /** + * Get the notebookServerEndpoint property: Specifies the endpoint of Notebook server. + * + * @return the notebookServerEndpoint value. + */ + public String notebookServerEndpoint() { + return this.notebookServerEndpoint; + } + + /** + * Get the status property: Status of the notebook workspace. Possible values are: Creating, Online, Deleting, + * Failed, Updating. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @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/OperationInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/OperationInner.java new file mode 100644 index 0000000000000..cab13ebb9565c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/OperationInner.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** REST API operation. */ +@Fluent +public final class OperationInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationInner.class); + + /* + * Operation name: {provider}/{resource}/{operation} + */ + @JsonProperty(value = "name") + private String name; + + /* + * The object that represents the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get the name property: Operation name: {provider}/{resource}/{operation}. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Operation name: {provider}/{resource}/{operation}. + * + * @param name the name value to set. + * @return the OperationInner object itself. + */ + public OperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the display property: The object that represents the operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: The object that represents the operation. + * + * @param display the display value to set. + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PartitionMetricInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PartitionMetricInner.java new file mode 100644 index 0000000000000..ab67ade34ed7b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PartitionMetricInner.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The metric values for a single partition. */ +@Immutable +public final class PartitionMetricInner extends MetricInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PartitionMetricInner.class); + + /* + * The partition id (GUID identifier) of the metric values. + */ + @JsonProperty(value = "partitionId", access = JsonProperty.Access.WRITE_ONLY) + private String partitionId; + + /* + * The partition key range id (integer identifier) of the metric values. + */ + @JsonProperty(value = "partitionKeyRangeId", access = JsonProperty.Access.WRITE_ONLY) + private String partitionKeyRangeId; + + /** + * Get the partitionId property: The partition id (GUID identifier) of the metric values. + * + * @return the partitionId value. + */ + public String partitionId() { + return this.partitionId; + } + + /** + * Get the partitionKeyRangeId property: The partition key range id (integer identifier) of the metric values. + * + * @return the partitionKeyRangeId value. + */ + public String partitionKeyRangeId() { + return this.partitionKeyRangeId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PartitionUsageInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PartitionUsageInner.java new file mode 100644 index 0000000000000..148057d26c762 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PartitionUsageInner.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The partition level usage data for a usage request. */ +@Immutable +public final class PartitionUsageInner extends UsageInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PartitionUsageInner.class); + + /* + * The partition id (GUID identifier) of the usages. + */ + @JsonProperty(value = "partitionId", access = JsonProperty.Access.WRITE_ONLY) + private String partitionId; + + /* + * The partition key range id (integer identifier) of the usages. + */ + @JsonProperty(value = "partitionKeyRangeId", access = JsonProperty.Access.WRITE_ONLY) + private String partitionKeyRangeId; + + /** + * Get the partitionId property: The partition id (GUID identifier) of the usages. + * + * @return the partitionId value. + */ + public String partitionId() { + return this.partitionId; + } + + /** + * Get the partitionKeyRangeId property: The partition key range id (integer identifier) of the usages. + * + * @return the partitionKeyRangeId value. + */ + public String partitionKeyRangeId() { + return this.partitionKeyRangeId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PercentileMetricInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PercentileMetricInner.java new file mode 100644 index 0000000000000..450b61b5bc849 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PercentileMetricInner.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.MetricName; +import com.azure.resourcemanager.cosmos.generated.models.PercentileMetricValue; +import com.azure.resourcemanager.cosmos.generated.models.UnitType; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Percentile Metric data. */ +@Immutable +public final class PercentileMetricInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PercentileMetricInner.class); + + /* + * The start time for the metric (ISO-8601 format). + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * The end time for the metric (ISO-8601 format). + */ + @JsonProperty(value = "endTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime endTime; + + /* + * The time grain to be used to summarize the metric values. + */ + @JsonProperty(value = "timeGrain", access = JsonProperty.Access.WRITE_ONLY) + private String timeGrain; + + /* + * The unit of the metric. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private UnitType unit; + + /* + * The name information for the metric. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private MetricName name; + + /* + * The percentile metric values for the specified time window and timestep. + */ + @JsonProperty(value = "metricValues", access = JsonProperty.Access.WRITE_ONLY) + private List metricValues; + + /** + * Get the startTime property: The start time for the metric (ISO-8601 format). + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Get the endTime property: The end time for the metric (ISO-8601 format). + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Get the timeGrain property: The time grain to be used to summarize the metric values. + * + * @return the timeGrain value. + */ + public String timeGrain() { + return this.timeGrain; + } + + /** + * Get the unit property: The unit of the metric. + * + * @return the unit value. + */ + public UnitType unit() { + return this.unit; + } + + /** + * Get the name property: The name information for the metric. + * + * @return the name value. + */ + public MetricName name() { + return this.name; + } + + /** + * Get the metricValues property: The percentile metric values for the specified time window and timestep. + * + * @return the metricValues value. + */ + public List metricValues() { + return this.metricValues; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() != null) { + name().validate(); + } + if (metricValues() != null) { + metricValues().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PrivateEndpointConnectionInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PrivateEndpointConnectionInner.java new file mode 100644 index 0000000000000..b3229e955b7b4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PrivateEndpointConnectionInner.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.PrivateEndpointProperty; +import com.azure.resourcemanager.cosmos.generated.models.PrivateLinkServiceConnectionStateProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A private endpoint connection. */ +@JsonFlatten +@Fluent +public class PrivateEndpointConnectionInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionInner.class); + + /* + * Private endpoint which the connection belongs to. + */ + @JsonProperty(value = "properties.privateEndpoint") + private PrivateEndpointProperty privateEndpoint; + + /* + * Connection State of the Private Endpoint Connection. + */ + @JsonProperty(value = "properties.privateLinkServiceConnectionState") + private PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState; + + /* + * Group id of the private endpoint. + */ + @JsonProperty(value = "properties.groupId") + private String groupId; + + /* + * Provisioning state of the private endpoint. + */ + @JsonProperty(value = "properties.provisioningState") + private String provisioningState; + + /** + * Get the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @return the privateEndpoint value. + */ + public PrivateEndpointProperty privateEndpoint() { + return this.privateEndpoint; + } + + /** + * Set the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @param privateEndpoint the privateEndpoint value to set. + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner 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 PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner 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 PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner 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 PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner 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..fa65b0cda89d3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PrivateLinkResourceInner.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.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ArmProxyResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A private link resource. */ +@JsonFlatten +@Immutable +public class PrivateLinkResourceInner extends ArmProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkResourceInner.class); + + /* + * The private link resource group id. + */ + @JsonProperty(value = "properties.groupId", access = JsonProperty.Access.WRITE_ONLY) + private String groupId; + + /* + * The private link resource required member names. + */ + @JsonProperty(value = "properties.requiredMembers", access = JsonProperty.Access.WRITE_ONLY) + private List requiredMembers; + + /* + * The private link resource required zone names. + */ + @JsonProperty(value = "properties.requiredZoneNames", access = JsonProperty.Access.WRITE_ONLY) + private List requiredZoneNames; + + /** + * Get the groupId property: The private link resource group id. + * + * @return the groupId value. + */ + public String groupId() { + return this.groupId; + } + + /** + * Get the requiredMembers property: The private link resource required member names. + * + * @return the requiredMembers value. + */ + public List requiredMembers() { + return this.requiredMembers; + } + + /** + * Get the requiredZoneNames property: The private link resource required zone names. + * + * @return the requiredZoneNames value. + */ + public List requiredZoneNames() { + return this.requiredZoneNames; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @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/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..7dd4687f48267 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableDatabaseAccountGetResultInner.java @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ApiType; +import com.azure.resourcemanager.cosmos.generated.models.RestorableLocationResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** A Azure Cosmos DB restorable database account. */ +@JsonFlatten +@Fluent +public class RestorableDatabaseAccountGetResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableDatabaseAccountGetResultInner.class); + + /* + * 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; + + /* + * The name of the global database account + */ + @JsonProperty(value = "properties.accountName") + private String accountName; + + /* + * The creation time of the restorable database account (ISO-8601 format). + */ + @JsonProperty(value = "properties.creationTime") + private OffsetDateTime creationTime; + + /* + * The time at which the restorable database account has been deleted + * (ISO-8601 format). + */ + @JsonProperty(value = "properties.deletionTime") + private OffsetDateTime deletionTime; + + /* + * The API type of the restorable database account. + */ + @JsonProperty(value = "properties.apiType", access = JsonProperty.Access.WRITE_ONLY) + private ApiType apiType; + + /* + * List of regions where the of the database account can be restored from. + */ + @JsonProperty(value = "properties.restorableLocations", access = JsonProperty.Access.WRITE_ONLY) + private List restorableLocations; + + /** + * 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.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) { + 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 RestorableDatabaseAccountGetResultInner object itself. + */ + public RestorableDatabaseAccountGetResultInner 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 RestorableDatabaseAccountGetResultInner object itself. + */ + public RestorableDatabaseAccountGetResultInner withDeletionTime(OffsetDateTime deletionTime) { + this.deletionTime = deletionTime; + return this; + } + + /** + * Get the apiType property: The API type of the restorable database account. + * + * @return the apiType value. + */ + public ApiType apiType() { + return this.apiType; + } + + /** + * Get the restorableLocations property: List of regions where the of the database account can be restored from. + * + * @return the restorableLocations value. + */ + public List restorableLocations() { + return this.restorableLocations; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (restorableLocations() != null) { + restorableLocations().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableMongodbCollectionGetResultInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableMongodbCollectionGetResultInner.java new file mode 100644 index 0000000000000..a79d84fb2b913 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableMongodbCollectionGetResultInner.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbCollectionPropertiesResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An Azure Cosmos DB MongoDB collection event. */ +@JsonFlatten +@Fluent +public class RestorableMongodbCollectionGetResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableMongodbCollectionGetResultInner.class); + + /* + * 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 resource of an Azure Cosmos DB MongoDB collection event + */ + @JsonProperty(value = "properties.resource") + private RestorableMongodbCollectionPropertiesResource resource; + + /** + * 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.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) { + 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..f369a16661e26 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableMongodbDatabaseGetResultInner.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbDatabasePropertiesResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An Azure Cosmos DB MongoDB database event. */ +@JsonFlatten +@Fluent +public class RestorableMongodbDatabaseGetResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableMongodbDatabaseGetResultInner.class); + + /* + * 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 resource of an Azure Cosmos DB MongoDB database event + */ + @JsonProperty(value = "properties.resource") + private RestorableMongodbDatabasePropertiesResource resource; + + /** + * 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.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) { + this.resource = resource; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resource() != null) { + resource().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableSqlContainerGetResultInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableSqlContainerGetResultInner.java new file mode 100644 index 0000000000000..d6229dc9cdc8e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableSqlContainerGetResultInner.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlContainerPropertiesResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An Azure Cosmos DB SQL container event. */ +@JsonFlatten +@Fluent +public class RestorableSqlContainerGetResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableSqlContainerGetResultInner.class); + + /* + * 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 resource of an Azure Cosmos DB SQL container event + */ + @JsonProperty(value = "properties.resource") + private RestorableSqlContainerPropertiesResource resource; + + /** + * 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.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) { + 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..ebae49a116178 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableSqlDatabaseGetResultInner.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlDatabasePropertiesResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An Azure Cosmos DB SQL database event. */ +@JsonFlatten +@Fluent +public class RestorableSqlDatabaseGetResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableSqlDatabaseGetResultInner.class); + + /* + * 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 resource of an Azure Cosmos DB SQL database event + */ + @JsonProperty(value = "properties.resource") + private RestorableSqlDatabasePropertiesResource resource; + + /** + * 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.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) { + 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/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..795ab8cfe63c2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlContainerGetResultsInner.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An Azure Cosmos DB container. */ +@JsonFlatten +@Fluent +public class SqlContainerGetResultsInner extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlContainerGetResultsInner.class); + + /* + * The resource property. + */ + @JsonProperty(value = "properties.resource") + private SqlContainerGetPropertiesResource resource; + + /* + * The options property. + */ + @JsonProperty(value = "properties.options") + private SqlContainerGetPropertiesOptions options; + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public SqlContainerGetPropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the SqlContainerGetResultsInner object itself. + */ + public SqlContainerGetResultsInner 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 SqlContainerGetResultsInner object itself. + */ + public SqlContainerGetResultsInner withOptions(SqlContainerGetPropertiesOptions options) { + this.options = options; + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlContainerGetResultsInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlContainerGetResultsInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.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..48c0226b08fb3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlDatabaseGetResultsInner.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An Azure Cosmos DB SQL database. */ +@JsonFlatten +@Fluent +public class SqlDatabaseGetResultsInner extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlDatabaseGetResultsInner.class); + + /* + * The resource property. + */ + @JsonProperty(value = "properties.resource") + private SqlDatabaseGetPropertiesResource resource; + + /* + * The options property. + */ + @JsonProperty(value = "properties.options") + private SqlDatabaseGetPropertiesOptions options; + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public SqlDatabaseGetPropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the SqlDatabaseGetResultsInner object itself. + */ + public SqlDatabaseGetResultsInner 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 SqlDatabaseGetResultsInner object itself. + */ + public SqlDatabaseGetResultsInner withOptions(SqlDatabaseGetPropertiesOptions options) { + this.options = options; + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlDatabaseGetResultsInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlDatabaseGetResultsInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.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/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..f57f42fe0d733 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlRoleAssignmentGetResultsInner.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ArmProxyResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An Azure Cosmos DB Role Assignment. */ +@JsonFlatten +@Fluent +public class SqlRoleAssignmentGetResultsInner extends ArmProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlRoleAssignmentGetResultsInner.class); + + /* + * The unique identifier for the associated Role Definition. + */ + @JsonProperty(value = "properties.roleDefinitionId") + private String roleDefinitionId; + + /* + * The data plane resource path for which access is being granted through + * this Role Assignment. + */ + @JsonProperty(value = "properties.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 = "properties.principalId") + private String principalId; + + /** + * Get the roleDefinitionId property: The unique identifier for the associated Role Definition. + * + * @return the roleDefinitionId value. + */ + public String roleDefinitionId() { + return this.roleDefinitionId; + } + + /** + * Set the roleDefinitionId property: The unique identifier for the associated Role Definition. + * + * @param roleDefinitionId the roleDefinitionId value to set. + * @return the SqlRoleAssignmentGetResultsInner object itself. + */ + public SqlRoleAssignmentGetResultsInner 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 SqlRoleAssignmentGetResultsInner object itself. + */ + public SqlRoleAssignmentGetResultsInner 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 SqlRoleAssignmentGetResultsInner object itself. + */ + public SqlRoleAssignmentGetResultsInner withPrincipalId(String principalId) { + this.principalId = principalId; + 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/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..55856a2acb340 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlRoleDefinitionGetResultsInner.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ArmProxyResource; +import com.azure.resourcemanager.cosmos.generated.models.Permission; +import com.azure.resourcemanager.cosmos.generated.models.RoleDefinitionType; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** An Azure Cosmos DB SQL Role Definition. */ +@JsonFlatten +@Fluent +public class SqlRoleDefinitionGetResultsInner extends ArmProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlRoleDefinitionGetResultsInner.class); + + /* + * A user-friendly name for the Role Definition. Must be unique for the + * database account. + */ + @JsonProperty(value = "properties.roleName") + private String roleName; + + /* + * Indicates whether the Role Definition was built-in or user created. + */ + @JsonProperty(value = "properties.type") + private RoleDefinitionType typePropertiesType; + + /* + * 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 = "properties.assignableScopes") + private List assignableScopes; + + /* + * The set of operations allowed through this Role Definition. + */ + @JsonProperty(value = "properties.permissions") + private List permissions; + + /** + * Get the roleName property: A user-friendly name for the Role Definition. Must be unique for the database account. + * + * @return the roleName value. + */ + public String roleName() { + return this.roleName; + } + + /** + * Set the roleName property: A user-friendly name for the Role Definition. Must be unique for the database account. + * + * @param roleName the roleName value to set. + * @return the SqlRoleDefinitionGetResultsInner object itself. + */ + public SqlRoleDefinitionGetResultsInner withRoleName(String roleName) { + this.roleName = roleName; + return this; + } + + /** + * Get the typePropertiesType property: Indicates whether the Role Definition was built-in or user created. + * + * @return the typePropertiesType value. + */ + public RoleDefinitionType typePropertiesType() { + return this.typePropertiesType; + } + + /** + * Set the typePropertiesType property: Indicates whether the Role Definition was built-in or user created. + * + * @param typePropertiesType the typePropertiesType value to set. + * @return the SqlRoleDefinitionGetResultsInner object itself. + */ + public SqlRoleDefinitionGetResultsInner withTypePropertiesType(RoleDefinitionType typePropertiesType) { + this.typePropertiesType = typePropertiesType; + 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 SqlRoleDefinitionGetResultsInner object itself. + */ + public SqlRoleDefinitionGetResultsInner 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 SqlRoleDefinitionGetResultsInner object itself. + */ + public SqlRoleDefinitionGetResultsInner withPermissions(List permissions) { + this.permissions = permissions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.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/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..9688b332bbe25 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlStoredProcedureGetResultsInner.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.SqlStoredProcedureGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An Azure Cosmos DB storedProcedure. */ +@JsonFlatten +@Fluent +public class SqlStoredProcedureGetResultsInner extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlStoredProcedureGetResultsInner.class); + + /* + * The resource property. + */ + @JsonProperty(value = "properties.resource") + private SqlStoredProcedureGetPropertiesResource resource; + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public SqlStoredProcedureGetPropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the SqlStoredProcedureGetResultsInner object itself. + */ + public SqlStoredProcedureGetResultsInner withResource(SqlStoredProcedureGetPropertiesResource resource) { + this.resource = resource; + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlStoredProcedureGetResultsInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlStoredProcedureGetResultsInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.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..7d30d27db144d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlTriggerGetResultsInner.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.SqlTriggerGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An Azure Cosmos DB trigger. */ +@JsonFlatten +@Fluent +public class SqlTriggerGetResultsInner extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlTriggerGetResultsInner.class); + + /* + * The resource property. + */ + @JsonProperty(value = "properties.resource") + private SqlTriggerGetPropertiesResource resource; + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public SqlTriggerGetPropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the SqlTriggerGetResultsInner object itself. + */ + public SqlTriggerGetResultsInner withResource(SqlTriggerGetPropertiesResource resource) { + this.resource = resource; + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlTriggerGetResultsInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlTriggerGetResultsInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.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..3fc19cb208e77 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlUserDefinedFunctionGetResultsInner.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.SqlUserDefinedFunctionGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An Azure Cosmos DB userDefinedFunction. */ +@JsonFlatten +@Fluent +public class SqlUserDefinedFunctionGetResultsInner extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlUserDefinedFunctionGetResultsInner.class); + + /* + * The resource property. + */ + @JsonProperty(value = "properties.resource") + private SqlUserDefinedFunctionGetPropertiesResource resource; + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public SqlUserDefinedFunctionGetPropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the SqlUserDefinedFunctionGetResultsInner object itself. + */ + public SqlUserDefinedFunctionGetResultsInner withResource(SqlUserDefinedFunctionGetPropertiesResource resource) { + this.resource = resource; + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlUserDefinedFunctionGetResultsInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlUserDefinedFunctionGetResultsInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.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/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..ad5c7ac7b716c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/TableGetResultsInner.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An Azure Cosmos DB Table. */ +@JsonFlatten +@Fluent +public class TableGetResultsInner extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TableGetResultsInner.class); + + /* + * The resource property. + */ + @JsonProperty(value = "properties.resource") + private TableGetPropertiesResource resource; + + /* + * The options property. + */ + @JsonProperty(value = "properties.options") + private TableGetPropertiesOptions options; + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public TableGetPropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the TableGetResultsInner object itself. + */ + public TableGetResultsInner 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 TableGetResultsInner object itself. + */ + public TableGetResultsInner withOptions(TableGetPropertiesOptions options) { + this.options = options; + return this; + } + + /** {@inheritDoc} */ + @Override + public TableGetResultsInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public TableGetResultsInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.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/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..9c854677ba0e8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ThroughputSettingsGetResultsInner.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An Azure Cosmos DB resource throughput. */ +@JsonFlatten +@Fluent +public class ThroughputSettingsGetResultsInner extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ThroughputSettingsGetResultsInner.class); + + /* + * The resource property. + */ + @JsonProperty(value = "properties.resource") + private ThroughputSettingsGetPropertiesResource resource; + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public ThroughputSettingsGetPropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the ThroughputSettingsGetResultsInner object itself. + */ + public ThroughputSettingsGetResultsInner withResource(ThroughputSettingsGetPropertiesResource resource) { + this.resource = resource; + return this; + } + + /** {@inheritDoc} */ + @Override + public ThroughputSettingsGetResultsInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ThroughputSettingsGetResultsInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.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/UsageInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/UsageInner.java new file mode 100644 index 0000000000000..1f54217289a62 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/UsageInner.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.MetricName; +import com.azure.resourcemanager.cosmos.generated.models.UnitType; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The usage data for a usage request. */ +@Immutable +public class UsageInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UsageInner.class); + + /* + * The unit of the metric. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private UnitType unit; + + /* + * The name information for the metric. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private MetricName name; + + /* + * The quota period used to summarize the usage values. + */ + @JsonProperty(value = "quotaPeriod", access = JsonProperty.Access.WRITE_ONLY) + private String quotaPeriod; + + /* + * Maximum value for this metric + */ + @JsonProperty(value = "limit", access = JsonProperty.Access.WRITE_ONLY) + private Long limit; + + /* + * Current value for this metric + */ + @JsonProperty(value = "currentValue", access = JsonProperty.Access.WRITE_ONLY) + private Long currentValue; + + /** + * Get the unit property: The unit of the metric. + * + * @return the unit value. + */ + public UnitType unit() { + return this.unit; + } + + /** + * Get the name property: The name information for the metric. + * + * @return the name value. + */ + public MetricName name() { + return this.name; + } + + /** + * Get the quotaPeriod property: The quota period used to summarize the usage values. + * + * @return the quotaPeriod value. + */ + public String quotaPeriod() { + return this.quotaPeriod; + } + + /** + * Get the limit property: Maximum value for this metric. + * + * @return the limit value. + */ + public Long limit() { + return this.limit; + } + + /** + * Get the currentValue property: Current value for this metric. + * + * @return the currentValue value. + */ + public Long currentValue() { + return this.currentValue; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() != null) { + name().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/package-info.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/package-info.java new file mode 100644 index 0000000000000..5140b0ddb6664 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the inner data models for CosmosDBManagementClient. Azure Cosmos DB Database Service Resource + * Provider REST API. + */ +package com.azure.resourcemanager.cosmos.generated.fluent.models; diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/package-info.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/package-info.java new file mode 100644 index 0000000000000..98db5a655ee9c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the service clients for CosmosDBManagementClient. Azure Cosmos DB Database Service Resource + * Provider REST API. + */ +package com.azure.resourcemanager.cosmos.generated.fluent; diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/BackupInformationImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/BackupInformationImpl.java new file mode 100644 index 0000000000000..0a04e870558a4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/BackupInformationImpl.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.BackupInformationInner; +import com.azure.resourcemanager.cosmos.generated.models.BackupInformation; +import com.azure.resourcemanager.cosmos.generated.models.ContinuousBackupInformation; + +public final class BackupInformationImpl implements BackupInformation { + private BackupInformationInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + BackupInformationImpl( + BackupInformationInner innerObject, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public ContinuousBackupInformation continuousBackupInformation() { + return this.innerModel().continuousBackupInformation(); + } + + public BackupInformationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/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..c31760ce26d48 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraKeyspaceGetResultsImpl.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.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 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..fc17dbd99de0e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraResourcesClientImpl.java @@ -0,0 +1,4528 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.cosmos.generated.fluent.CassandraResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.CassandraKeyspaceGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.CassandraTableGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.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 { + private final ClientLogger logger = new ClientLogger(CassandraResourcesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final CassandraResourcesService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of CassandraResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CassandraResourcesClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy.create(CassandraResourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientCassandraResources to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface CassandraResourcesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/cassandraKeyspaces") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listCassandraKeyspaces( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getCassandraKeyspace( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("keyspaceName") String keyspaceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createUpdateCassandraKeyspace( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("keyspaceName") String keyspaceName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") + CassandraKeyspaceCreateUpdateParameters createUpdateCassandraKeyspaceParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> deleteCassandraKeyspace( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("keyspaceName") String keyspaceName, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getCassandraKeyspaceThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("keyspaceName") String keyspaceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> updateCassandraKeyspaceThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("keyspaceName") String keyspaceName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ThroughputSettingsUpdateParameters updateThroughputParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default" + + "/migrateToAutoscale") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> migrateCassandraKeyspaceToAutoscale( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("keyspaceName") String keyspaceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default" + + "/migrateToManualThroughput") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> migrateCassandraKeyspaceToManualThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("keyspaceName") String keyspaceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listCassandraTables( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("keyspaceName") String keyspaceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getCassandraTable( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("keyspaceName") String keyspaceName, + @PathParam("tableName") String tableName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createUpdateCassandraTable( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("keyspaceName") String keyspaceName, + @PathParam("tableName") String tableName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> deleteCassandraTable( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("keyspaceName") String keyspaceName, + @PathParam("tableName") String tableName, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}" + + "/throughputSettings/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getCassandraTableThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("keyspaceName") String keyspaceName, + @PathParam("tableName") String tableName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}" + + "/throughputSettings/default") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> updateCassandraTableThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("keyspaceName") String keyspaceName, + @PathParam("tableName") String tableName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ThroughputSettingsUpdateParameters updateThroughputParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}" + + "/throughputSettings/default/migrateToAutoscale") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> migrateCassandraTableToAutoscale( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("keyspaceName") String keyspaceName, + @PathParam("tableName") String tableName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}" + + "/throughputSettings/default/migrateToManualThroughput") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> migrateCassandraTableToManualThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("keyspaceName") String keyspaceName, + @PathParam("tableName") String tableName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the Cassandra keyspaces under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the Cassandra keyspaces and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listCassandraKeyspacesSinglePageAsync( + String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listCassandraKeyspaces( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the Cassandra keyspaces under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the Cassandra keyspaces and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listCassandraKeyspacesSinglePageAsync( + String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listCassandraKeyspaces( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Lists the Cassandra keyspaces under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the Cassandra keyspaces and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listCassandraKeyspacesAsync( + String resourceGroupName, String accountName) { + return new PagedFlux<>(() -> listCassandraKeyspacesSinglePageAsync(resourceGroupName, accountName)); + } + + /** + * Lists the Cassandra keyspaces under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the Cassandra keyspaces and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listCassandraKeyspacesAsync( + String resourceGroupName, String accountName, Context context) { + return new PagedFlux<>(() -> listCassandraKeyspacesSinglePageAsync(resourceGroupName, accountName, context)); + } + + /** + * Lists the Cassandra keyspaces under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the Cassandra keyspaces and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listCassandraKeyspaces( + String resourceGroupName, String accountName) { + return new PagedIterable<>(listCassandraKeyspacesAsync(resourceGroupName, accountName)); + } + + /** + * Lists the Cassandra keyspaces under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the Cassandra keyspaces and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listCassandraKeyspaces( + String resourceGroupName, String accountName, Context context) { + return new PagedIterable<>(listCassandraKeyspacesAsync(resourceGroupName, accountName, context)); + } + + /** + * Gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getCassandraKeyspaceWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getCassandraKeyspace( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getCassandraKeyspaceWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getCassandraKeyspace( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getCassandraKeyspaceAsync( + String resourceGroupName, String accountName, String keyspaceName) { + return getCassandraKeyspaceWithResponseAsync(resourceGroupName, accountName, keyspaceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CassandraKeyspaceGetResultsInner getCassandraKeyspace( + String resourceGroupName, String accountName, String keyspaceName) { + return getCassandraKeyspaceAsync(resourceGroupName, accountName, keyspaceName).block(); + } + + /** + * Gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getCassandraKeyspaceWithResponse( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + return getCassandraKeyspaceWithResponseAsync(resourceGroupName, accountName, keyspaceName, context).block(); + } + + /** + * Create or update an Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param createUpdateCassandraKeyspaceParameters The parameters to provide for the current Cassandra keyspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra keyspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateCassandraKeyspaceWithResponseAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + CassandraKeyspaceCreateUpdateParameters createUpdateCassandraKeyspaceParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (createUpdateCassandraKeyspaceParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateCassandraKeyspaceParameters is required and cannot be null.")); + } else { + createUpdateCassandraKeyspaceParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createUpdateCassandraKeyspace( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + this.client.getApiVersion(), + createUpdateCassandraKeyspaceParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update an Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param createUpdateCassandraKeyspaceParameters The parameters to provide for the current Cassandra keyspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra keyspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateCassandraKeyspaceWithResponseAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + CassandraKeyspaceCreateUpdateParameters createUpdateCassandraKeyspaceParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (createUpdateCassandraKeyspaceParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateCassandraKeyspaceParameters is required and cannot be null.")); + } else { + createUpdateCassandraKeyspaceParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createUpdateCassandraKeyspace( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + this.client.getApiVersion(), + createUpdateCassandraKeyspaceParameters, + accept, + context); + } + + /** + * Create or update an Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param createUpdateCassandraKeyspaceParameters The parameters to provide for the current Cassandra keyspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra keyspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, CassandraKeyspaceGetResultsInner> + beginCreateUpdateCassandraKeyspaceAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + CassandraKeyspaceCreateUpdateParameters createUpdateCassandraKeyspaceParameters) { + Mono>> mono = + createUpdateCassandraKeyspaceWithResponseAsync( + resourceGroupName, accountName, keyspaceName, createUpdateCassandraKeyspaceParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + CassandraKeyspaceGetResultsInner.class, + CassandraKeyspaceGetResultsInner.class, + Context.NONE); + } + + /** + * Create or update an Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param createUpdateCassandraKeyspaceParameters The parameters to provide for the current Cassandra keyspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra keyspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, CassandraKeyspaceGetResultsInner> + beginCreateUpdateCassandraKeyspaceAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + CassandraKeyspaceCreateUpdateParameters createUpdateCassandraKeyspaceParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createUpdateCassandraKeyspaceWithResponseAsync( + resourceGroupName, accountName, keyspaceName, createUpdateCassandraKeyspaceParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + CassandraKeyspaceGetResultsInner.class, + CassandraKeyspaceGetResultsInner.class, + context); + } + + /** + * Create or update an Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param createUpdateCassandraKeyspaceParameters The parameters to provide for the current Cassandra keyspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra keyspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, CassandraKeyspaceGetResultsInner> + beginCreateUpdateCassandraKeyspace( + String resourceGroupName, + String accountName, + String keyspaceName, + CassandraKeyspaceCreateUpdateParameters createUpdateCassandraKeyspaceParameters) { + return beginCreateUpdateCassandraKeyspaceAsync( + resourceGroupName, accountName, keyspaceName, createUpdateCassandraKeyspaceParameters) + .getSyncPoller(); + } + + /** + * Create or update an Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param createUpdateCassandraKeyspaceParameters The parameters to provide for the current Cassandra keyspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra keyspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, CassandraKeyspaceGetResultsInner> + beginCreateUpdateCassandraKeyspace( + String resourceGroupName, + String accountName, + String keyspaceName, + CassandraKeyspaceCreateUpdateParameters createUpdateCassandraKeyspaceParameters, + Context context) { + return beginCreateUpdateCassandraKeyspaceAsync( + resourceGroupName, accountName, keyspaceName, createUpdateCassandraKeyspaceParameters, context) + .getSyncPoller(); + } + + /** + * Create or update an Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param createUpdateCassandraKeyspaceParameters The parameters to provide for the current Cassandra keyspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra keyspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateCassandraKeyspaceAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + CassandraKeyspaceCreateUpdateParameters createUpdateCassandraKeyspaceParameters) { + return beginCreateUpdateCassandraKeyspaceAsync( + resourceGroupName, accountName, keyspaceName, createUpdateCassandraKeyspaceParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update an Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param createUpdateCassandraKeyspaceParameters The parameters to provide for the current Cassandra keyspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra keyspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateCassandraKeyspaceAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + CassandraKeyspaceCreateUpdateParameters createUpdateCassandraKeyspaceParameters, + Context context) { + return beginCreateUpdateCassandraKeyspaceAsync( + resourceGroupName, accountName, keyspaceName, createUpdateCassandraKeyspaceParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update an Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param createUpdateCassandraKeyspaceParameters The parameters to provide for the current Cassandra keyspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra keyspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CassandraKeyspaceGetResultsInner createUpdateCassandraKeyspace( + String resourceGroupName, + String accountName, + String keyspaceName, + CassandraKeyspaceCreateUpdateParameters createUpdateCassandraKeyspaceParameters) { + return createUpdateCassandraKeyspaceAsync( + resourceGroupName, accountName, keyspaceName, createUpdateCassandraKeyspaceParameters) + .block(); + } + + /** + * Create or update an Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param createUpdateCassandraKeyspaceParameters The parameters to provide for the current Cassandra keyspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra keyspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CassandraKeyspaceGetResultsInner createUpdateCassandraKeyspace( + String resourceGroupName, + String accountName, + String keyspaceName, + CassandraKeyspaceCreateUpdateParameters createUpdateCassandraKeyspaceParameters, + Context context) { + return createUpdateCassandraKeyspaceAsync( + resourceGroupName, accountName, keyspaceName, createUpdateCassandraKeyspaceParameters, context) + .block(); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteCassandraKeyspaceWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .deleteCassandraKeyspace( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + this.client.getApiVersion(), + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteCassandraKeyspaceWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + context = this.client.mergeContext(context); + return service + .deleteCassandraKeyspace( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + this.client.getApiVersion(), + context); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteCassandraKeyspaceAsync( + String resourceGroupName, String accountName, String keyspaceName) { + Mono>> mono = + deleteCassandraKeyspaceWithResponseAsync(resourceGroupName, accountName, keyspaceName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteCassandraKeyspaceAsync( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteCassandraKeyspaceWithResponseAsync(resourceGroupName, accountName, keyspaceName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDeleteCassandraKeyspace( + String resourceGroupName, String accountName, String keyspaceName) { + return beginDeleteCassandraKeyspaceAsync(resourceGroupName, accountName, keyspaceName).getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDeleteCassandraKeyspace( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + return beginDeleteCassandraKeyspaceAsync(resourceGroupName, accountName, keyspaceName, context).getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteCassandraKeyspaceAsync(String resourceGroupName, String accountName, String keyspaceName) { + return beginDeleteCassandraKeyspaceAsync(resourceGroupName, accountName, keyspaceName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteCassandraKeyspaceAsync( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + return beginDeleteCassandraKeyspaceAsync(resourceGroupName, accountName, keyspaceName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteCassandraKeyspace(String resourceGroupName, String accountName, String keyspaceName) { + deleteCassandraKeyspaceAsync(resourceGroupName, accountName, keyspaceName).block(); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteCassandraKeyspace( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + deleteCassandraKeyspaceAsync(resourceGroupName, accountName, keyspaceName, context).block(); + } + + /** + * Gets the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database account with the + * provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getCassandraKeyspaceThroughputWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getCassandraKeyspaceThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database account with the + * provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getCassandraKeyspaceThroughputWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getCassandraKeyspaceThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database account with the + * provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getCassandraKeyspaceThroughputAsync( + String resourceGroupName, String accountName, String keyspaceName) { + return getCassandraKeyspaceThroughputWithResponseAsync(resourceGroupName, accountName, keyspaceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database account with the + * provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner getCassandraKeyspaceThroughput( + String resourceGroupName, String accountName, String keyspaceName) { + return getCassandraKeyspaceThroughputAsync(resourceGroupName, accountName, keyspaceName).block(); + } + + /** + * Gets the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database account with the + * provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getCassandraKeyspaceThroughputWithResponse( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + return getCassandraKeyspaceThroughputWithResponseAsync(resourceGroupName, accountName, keyspaceName, context) + .block(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * Keyspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateCassandraKeyspaceThroughputWithResponseAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (updateThroughputParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter updateThroughputParameters is required and cannot be null.")); + } else { + updateThroughputParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateCassandraKeyspaceThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + this.client.getApiVersion(), + updateThroughputParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * Keyspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateCassandraKeyspaceThroughputWithResponseAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (updateThroughputParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter updateThroughputParameters is required and cannot be null.")); + } else { + updateThroughputParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateCassandraKeyspaceThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + this.client.getApiVersion(), + updateThroughputParameters, + accept, + context); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * Keyspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginUpdateCassandraKeyspaceThroughputAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + Mono>> mono = + updateCassandraKeyspaceThroughputWithResponseAsync( + resourceGroupName, accountName, keyspaceName, updateThroughputParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * Keyspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginUpdateCassandraKeyspaceThroughputAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateCassandraKeyspaceThroughputWithResponseAsync( + resourceGroupName, accountName, keyspaceName, updateThroughputParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * Keyspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateCassandraKeyspaceThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateCassandraKeyspaceThroughputAsync( + resourceGroupName, accountName, keyspaceName, updateThroughputParameters) + .getSyncPoller(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * Keyspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateCassandraKeyspaceThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return beginUpdateCassandraKeyspaceThroughputAsync( + resourceGroupName, accountName, keyspaceName, updateThroughputParameters, context) + .getSyncPoller(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * Keyspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateCassandraKeyspaceThroughputAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateCassandraKeyspaceThroughputAsync( + resourceGroupName, accountName, keyspaceName, updateThroughputParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * Keyspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateCassandraKeyspaceThroughputAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return beginUpdateCassandraKeyspaceThroughputAsync( + resourceGroupName, accountName, keyspaceName, updateThroughputParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * Keyspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner updateCassandraKeyspaceThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return updateCassandraKeyspaceThroughputAsync( + resourceGroupName, accountName, keyspaceName, updateThroughputParameters) + .block(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * Keyspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner updateCassandraKeyspaceThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return updateCassandraKeyspaceThroughputAsync( + resourceGroupName, accountName, keyspaceName, updateThroughputParameters, context) + .block(); + } + + /** + * Migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateCassandraKeyspaceToAutoscaleWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateCassandraKeyspaceToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateCassandraKeyspaceToAutoscaleWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateCassandraKeyspaceToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateCassandraKeyspaceToAutoscaleAsync( + String resourceGroupName, String accountName, String keyspaceName) { + Mono>> mono = + migrateCassandraKeyspaceToAutoscaleWithResponseAsync(resourceGroupName, accountName, keyspaceName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * Migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateCassandraKeyspaceToAutoscaleAsync( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + migrateCassandraKeyspaceToAutoscaleWithResponseAsync(resourceGroupName, accountName, keyspaceName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * Migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateCassandraKeyspaceToAutoscale(String resourceGroupName, String accountName, String keyspaceName) { + return beginMigrateCassandraKeyspaceToAutoscaleAsync(resourceGroupName, accountName, keyspaceName) + .getSyncPoller(); + } + + /** + * Migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateCassandraKeyspaceToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + return beginMigrateCassandraKeyspaceToAutoscaleAsync(resourceGroupName, accountName, keyspaceName, context) + .getSyncPoller(); + } + + /** + * Migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateCassandraKeyspaceToAutoscaleAsync( + String resourceGroupName, String accountName, String keyspaceName) { + return beginMigrateCassandraKeyspaceToAutoscaleAsync(resourceGroupName, accountName, keyspaceName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateCassandraKeyspaceToAutoscaleAsync( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + return beginMigrateCassandraKeyspaceToAutoscaleAsync(resourceGroupName, accountName, keyspaceName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateCassandraKeyspaceToAutoscale( + String resourceGroupName, String accountName, String keyspaceName) { + return migrateCassandraKeyspaceToAutoscaleAsync(resourceGroupName, accountName, keyspaceName).block(); + } + + /** + * Migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateCassandraKeyspaceToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + return migrateCassandraKeyspaceToAutoscaleAsync(resourceGroupName, accountName, keyspaceName, context).block(); + } + + /** + * Migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateCassandraKeyspaceToManualThroughputWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateCassandraKeyspaceToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateCassandraKeyspaceToManualThroughputWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateCassandraKeyspaceToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateCassandraKeyspaceToManualThroughputAsync( + String resourceGroupName, String accountName, String keyspaceName) { + Mono>> mono = + migrateCassandraKeyspaceToManualThroughputWithResponseAsync(resourceGroupName, accountName, keyspaceName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * Migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateCassandraKeyspaceToManualThroughputAsync( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + migrateCassandraKeyspaceToManualThroughputWithResponseAsync( + resourceGroupName, accountName, keyspaceName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * Migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateCassandraKeyspaceToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName) { + return beginMigrateCassandraKeyspaceToManualThroughputAsync(resourceGroupName, accountName, keyspaceName) + .getSyncPoller(); + } + + /** + * Migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateCassandraKeyspaceToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + return beginMigrateCassandraKeyspaceToManualThroughputAsync( + resourceGroupName, accountName, keyspaceName, context) + .getSyncPoller(); + } + + /** + * Migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateCassandraKeyspaceToManualThroughputAsync( + String resourceGroupName, String accountName, String keyspaceName) { + return beginMigrateCassandraKeyspaceToManualThroughputAsync(resourceGroupName, accountName, keyspaceName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateCassandraKeyspaceToManualThroughputAsync( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + return beginMigrateCassandraKeyspaceToManualThroughputAsync( + resourceGroupName, accountName, keyspaceName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateCassandraKeyspaceToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName) { + return migrateCassandraKeyspaceToManualThroughputAsync(resourceGroupName, accountName, keyspaceName).block(); + } + + /** + * Migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateCassandraKeyspaceToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + return migrateCassandraKeyspaceToManualThroughputAsync(resourceGroupName, accountName, keyspaceName, context) + .block(); + } + + /** + * Lists the Cassandra table under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the Cassandra tables and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listCassandraTablesSinglePageAsync( + String resourceGroupName, String accountName, String keyspaceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listCassandraTables( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the Cassandra table under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the Cassandra tables and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listCassandraTablesSinglePageAsync( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listCassandraTables( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Lists the Cassandra table under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the Cassandra tables and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listCassandraTablesAsync( + String resourceGroupName, String accountName, String keyspaceName) { + return new PagedFlux<>(() -> listCassandraTablesSinglePageAsync(resourceGroupName, accountName, keyspaceName)); + } + + /** + * Lists the Cassandra table under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the Cassandra tables and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listCassandraTablesAsync( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + return new PagedFlux<>( + () -> listCassandraTablesSinglePageAsync(resourceGroupName, accountName, keyspaceName, context)); + } + + /** + * Lists the Cassandra table under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the Cassandra tables and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listCassandraTables( + String resourceGroupName, String accountName, String keyspaceName) { + return new PagedIterable<>(listCassandraTablesAsync(resourceGroupName, accountName, keyspaceName)); + } + + /** + * Lists the Cassandra table under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the Cassandra tables and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listCassandraTables( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + return new PagedIterable<>(listCassandraTablesAsync(resourceGroupName, accountName, keyspaceName, context)); + } + + /** + * Gets the Cassandra table under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra table under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getCassandraTableWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getCassandraTable( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + tableName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the Cassandra table under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra table under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getCassandraTableWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getCassandraTable( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + tableName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the Cassandra table under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra table under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getCassandraTableAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + return getCassandraTableWithResponseAsync(resourceGroupName, accountName, keyspaceName, tableName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the Cassandra table under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra table under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CassandraTableGetResultsInner getCassandraTable( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + return getCassandraTableAsync(resourceGroupName, accountName, keyspaceName, tableName).block(); + } + + /** + * Gets the Cassandra table under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra table under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getCassandraTableWithResponse( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + return getCassandraTableWithResponseAsync(resourceGroupName, accountName, keyspaceName, tableName, context) + .block(); + } + + /** + * Create or update an Azure Cosmos DB Cassandra Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param createUpdateCassandraTableParameters The parameters to provide for the current Cassandra Table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateCassandraTableWithResponseAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (createUpdateCassandraTableParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateCassandraTableParameters is required and cannot be null.")); + } else { + createUpdateCassandraTableParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createUpdateCassandraTable( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + tableName, + this.client.getApiVersion(), + createUpdateCassandraTableParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update an Azure Cosmos DB Cassandra Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param createUpdateCassandraTableParameters The parameters to provide for the current Cassandra Table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateCassandraTableWithResponseAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (createUpdateCassandraTableParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateCassandraTableParameters is required and cannot be null.")); + } else { + createUpdateCassandraTableParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createUpdateCassandraTable( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + tableName, + this.client.getApiVersion(), + createUpdateCassandraTableParameters, + accept, + context); + } + + /** + * Create or update an Azure Cosmos DB Cassandra Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param createUpdateCassandraTableParameters The parameters to provide for the current Cassandra Table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, CassandraTableGetResultsInner> + beginCreateUpdateCassandraTableAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters) { + Mono>> mono = + createUpdateCassandraTableWithResponseAsync( + resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + CassandraTableGetResultsInner.class, + CassandraTableGetResultsInner.class, + Context.NONE); + } + + /** + * Create or update an Azure Cosmos DB Cassandra Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param createUpdateCassandraTableParameters The parameters to provide for the current Cassandra Table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, CassandraTableGetResultsInner> + beginCreateUpdateCassandraTableAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createUpdateCassandraTableWithResponseAsync( + resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + CassandraTableGetResultsInner.class, + CassandraTableGetResultsInner.class, + context); + } + + /** + * Create or update an Azure Cosmos DB Cassandra Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param createUpdateCassandraTableParameters The parameters to provide for the current Cassandra Table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, CassandraTableGetResultsInner> + beginCreateUpdateCassandraTable( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters) { + return beginCreateUpdateCassandraTableAsync( + resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters) + .getSyncPoller(); + } + + /** + * Create or update an Azure Cosmos DB Cassandra Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param createUpdateCassandraTableParameters The parameters to provide for the current Cassandra Table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, CassandraTableGetResultsInner> + beginCreateUpdateCassandraTable( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters, + Context context) { + return beginCreateUpdateCassandraTableAsync( + resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters, context) + .getSyncPoller(); + } + + /** + * Create or update an Azure Cosmos DB Cassandra Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param createUpdateCassandraTableParameters The parameters to provide for the current Cassandra Table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateCassandraTableAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters) { + return beginCreateUpdateCassandraTableAsync( + resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update an Azure Cosmos DB Cassandra Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param createUpdateCassandraTableParameters The parameters to provide for the current Cassandra Table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateCassandraTableAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters, + Context context) { + return beginCreateUpdateCassandraTableAsync( + resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update an Azure Cosmos DB Cassandra Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param createUpdateCassandraTableParameters The parameters to provide for the current Cassandra Table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CassandraTableGetResultsInner createUpdateCassandraTable( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters) { + return createUpdateCassandraTableAsync( + resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters) + .block(); + } + + /** + * Create or update an Azure Cosmos DB Cassandra Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param createUpdateCassandraTableParameters The parameters to provide for the current Cassandra Table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CassandraTableGetResultsInner createUpdateCassandraTable( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters, + Context context) { + return createUpdateCassandraTableAsync( + resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters, context) + .block(); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteCassandraTableWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .deleteCassandraTable( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + tableName, + this.client.getApiVersion(), + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteCassandraTableWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + context = this.client.mergeContext(context); + return service + .deleteCassandraTable( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + tableName, + this.client.getApiVersion(), + context); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteCassandraTableAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + Mono>> mono = + deleteCassandraTableWithResponseAsync(resourceGroupName, accountName, keyspaceName, tableName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteCassandraTableAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteCassandraTableWithResponseAsync(resourceGroupName, accountName, keyspaceName, tableName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDeleteCassandraTable( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + return beginDeleteCassandraTableAsync(resourceGroupName, accountName, keyspaceName, tableName).getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDeleteCassandraTable( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + return beginDeleteCassandraTableAsync(resourceGroupName, accountName, keyspaceName, tableName, context) + .getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteCassandraTableAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + return beginDeleteCassandraTableAsync(resourceGroupName, accountName, keyspaceName, tableName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteCassandraTableAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + return beginDeleteCassandraTableAsync(resourceGroupName, accountName, keyspaceName, tableName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteCassandraTable( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + deleteCassandraTableAsync(resourceGroupName, accountName, keyspaceName, tableName).block(); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteCassandraTable( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + deleteCassandraTableAsync(resourceGroupName, accountName, keyspaceName, tableName, context).block(); + } + + /** + * Gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the + * provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getCassandraTableThroughputWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getCassandraTableThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + tableName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the + * provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getCassandraTableThroughputWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getCassandraTableThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + tableName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the + * provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getCassandraTableThroughputAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + return getCassandraTableThroughputWithResponseAsync(resourceGroupName, accountName, keyspaceName, tableName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the + * provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner getCassandraTableThroughput( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + return getCassandraTableThroughputAsync(resourceGroupName, accountName, keyspaceName, tableName).block(); + } + + /** + * Gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the + * provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getCassandraTableThroughputWithResponse( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + return getCassandraTableThroughputWithResponseAsync( + resourceGroupName, accountName, keyspaceName, tableName, context) + .block(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateCassandraTableThroughputWithResponseAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (updateThroughputParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter updateThroughputParameters is required and cannot be null.")); + } else { + updateThroughputParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateCassandraTableThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + tableName, + this.client.getApiVersion(), + updateThroughputParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateCassandraTableThroughputWithResponseAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (updateThroughputParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter updateThroughputParameters is required and cannot be null.")); + } else { + updateThroughputParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateCassandraTableThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + tableName, + this.client.getApiVersion(), + updateThroughputParameters, + accept, + context); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginUpdateCassandraTableThroughputAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + Mono>> mono = + updateCassandraTableThroughputWithResponseAsync( + resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginUpdateCassandraTableThroughputAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateCassandraTableThroughputWithResponseAsync( + resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateCassandraTableThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateCassandraTableThroughputAsync( + resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters) + .getSyncPoller(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateCassandraTableThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return beginUpdateCassandraTableThroughputAsync( + resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters, context) + .getSyncPoller(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateCassandraTableThroughputAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateCassandraTableThroughputAsync( + resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateCassandraTableThroughputAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return beginUpdateCassandraTableThroughputAsync( + resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner updateCassandraTableThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return updateCassandraTableThroughputAsync( + resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters) + .block(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner updateCassandraTableThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return updateCassandraTableThroughputAsync( + resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters, context) + .block(); + } + + /** + * Migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateCassandraTableToAutoscaleWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateCassandraTableToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + tableName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateCassandraTableToAutoscaleWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateCassandraTableToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + tableName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateCassandraTableToAutoscaleAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + Mono>> mono = + migrateCassandraTableToAutoscaleWithResponseAsync(resourceGroupName, accountName, keyspaceName, tableName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * Migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateCassandraTableToAutoscaleAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + migrateCassandraTableToAutoscaleWithResponseAsync( + resourceGroupName, accountName, keyspaceName, tableName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * Migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateCassandraTableToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + return beginMigrateCassandraTableToAutoscaleAsync(resourceGroupName, accountName, keyspaceName, tableName) + .getSyncPoller(); + } + + /** + * Migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateCassandraTableToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + return beginMigrateCassandraTableToAutoscaleAsync( + resourceGroupName, accountName, keyspaceName, tableName, context) + .getSyncPoller(); + } + + /** + * Migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateCassandraTableToAutoscaleAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + return beginMigrateCassandraTableToAutoscaleAsync(resourceGroupName, accountName, keyspaceName, tableName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateCassandraTableToAutoscaleAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + return beginMigrateCassandraTableToAutoscaleAsync( + resourceGroupName, accountName, keyspaceName, tableName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateCassandraTableToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + return migrateCassandraTableToAutoscaleAsync(resourceGroupName, accountName, keyspaceName, tableName).block(); + } + + /** + * Migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateCassandraTableToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + return migrateCassandraTableToAutoscaleAsync(resourceGroupName, accountName, keyspaceName, tableName, context) + .block(); + } + + /** + * Migrate an Azure Cosmos DB Cassandra table from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateCassandraTableToManualThroughputWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateCassandraTableToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + tableName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Migrate an Azure Cosmos DB Cassandra table from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateCassandraTableToManualThroughputWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateCassandraTableToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + tableName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Migrate an Azure Cosmos DB Cassandra table from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateCassandraTableToManualThroughputAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + Mono>> mono = + migrateCassandraTableToManualThroughputWithResponseAsync( + resourceGroupName, accountName, keyspaceName, tableName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * Migrate an Azure Cosmos DB Cassandra table from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateCassandraTableToManualThroughputAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + migrateCassandraTableToManualThroughputWithResponseAsync( + resourceGroupName, accountName, keyspaceName, tableName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * Migrate an Azure Cosmos DB Cassandra table from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateCassandraTableToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + return beginMigrateCassandraTableToManualThroughputAsync( + resourceGroupName, accountName, keyspaceName, tableName) + .getSyncPoller(); + } + + /** + * Migrate an Azure Cosmos DB Cassandra table from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateCassandraTableToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + return beginMigrateCassandraTableToManualThroughputAsync( + resourceGroupName, accountName, keyspaceName, tableName, context) + .getSyncPoller(); + } + + /** + * Migrate an Azure Cosmos DB Cassandra table from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateCassandraTableToManualThroughputAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + return beginMigrateCassandraTableToManualThroughputAsync( + resourceGroupName, accountName, keyspaceName, tableName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Migrate an Azure Cosmos DB Cassandra table from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateCassandraTableToManualThroughputAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + return beginMigrateCassandraTableToManualThroughputAsync( + resourceGroupName, accountName, keyspaceName, tableName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Migrate an Azure Cosmos DB Cassandra table from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateCassandraTableToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + return migrateCassandraTableToManualThroughputAsync(resourceGroupName, accountName, keyspaceName, tableName) + .block(); + } + + /** + * Migrate an Azure Cosmos DB Cassandra table from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateCassandraTableToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + return migrateCassandraTableToManualThroughputAsync( + resourceGroupName, accountName, keyspaceName, tableName, context) + .block(); + } +} 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..50fa1c555f15a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraResourcesImpl.java @@ -0,0 +1,659 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class CassandraResourcesImpl implements CassandraResources { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CassandraResourcesImpl.class); + + private final CassandraResourcesClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public CassandraResourcesImpl( + CassandraResourcesClient innerClient, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listCassandraKeyspaces( + String resourceGroupName, String accountName) { + PagedIterable inner = + this.serviceClient().listCassandraKeyspaces(resourceGroupName, accountName); + return Utils.mapPage(inner, inner1 -> new CassandraKeyspaceGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listCassandraKeyspaces( + String resourceGroupName, String accountName, Context context) { + PagedIterable inner = + this.serviceClient().listCassandraKeyspaces(resourceGroupName, accountName, context); + return Utils.mapPage(inner, inner1 -> new CassandraKeyspaceGetResultsImpl(inner1, this.manager())); + } + + public CassandraKeyspaceGetResults getCassandraKeyspace( + String resourceGroupName, String accountName, String keyspaceName) { + CassandraKeyspaceGetResultsInner inner = + this.serviceClient().getCassandraKeyspace(resourceGroupName, accountName, keyspaceName); + if (inner != null) { + return new CassandraKeyspaceGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getCassandraKeyspaceWithResponse( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + Response inner = + this + .serviceClient() + .getCassandraKeyspaceWithResponse(resourceGroupName, accountName, keyspaceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CassandraKeyspaceGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteCassandraKeyspace(String resourceGroupName, String accountName, String keyspaceName) { + this.serviceClient().deleteCassandraKeyspace(resourceGroupName, accountName, keyspaceName); + } + + public void deleteCassandraKeyspace( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + this.serviceClient().deleteCassandraKeyspace(resourceGroupName, accountName, keyspaceName, context); + } + + public ThroughputSettingsGetResults getCassandraKeyspaceThroughput( + String resourceGroupName, String accountName, String keyspaceName) { + ThroughputSettingsGetResultsInner inner = + this.serviceClient().getCassandraKeyspaceThroughput(resourceGroupName, accountName, keyspaceName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getCassandraKeyspaceThroughputWithResponse( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + Response inner = + this + .serviceClient() + .getCassandraKeyspaceThroughputWithResponse(resourceGroupName, accountName, keyspaceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ThroughputSettingsGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ThroughputSettingsGetResults updateCassandraKeyspaceThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .updateCassandraKeyspaceThroughput( + resourceGroupName, accountName, keyspaceName, updateThroughputParameters); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults updateCassandraKeyspaceThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .updateCassandraKeyspaceThroughput( + resourceGroupName, accountName, keyspaceName, updateThroughputParameters, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateCassandraKeyspaceToAutoscale( + String resourceGroupName, String accountName, String keyspaceName) { + ThroughputSettingsGetResultsInner inner = + this.serviceClient().migrateCassandraKeyspaceToAutoscale(resourceGroupName, accountName, keyspaceName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateCassandraKeyspaceToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateCassandraKeyspaceToAutoscale(resourceGroupName, accountName, keyspaceName, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateCassandraKeyspaceToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateCassandraKeyspaceToManualThroughput(resourceGroupName, accountName, keyspaceName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateCassandraKeyspaceToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateCassandraKeyspaceToManualThroughput(resourceGroupName, accountName, keyspaceName, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listCassandraTables( + String resourceGroupName, String accountName, String keyspaceName) { + PagedIterable inner = + this.serviceClient().listCassandraTables(resourceGroupName, accountName, keyspaceName); + return Utils.mapPage(inner, inner1 -> new CassandraTableGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listCassandraTables( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + PagedIterable inner = + this.serviceClient().listCassandraTables(resourceGroupName, accountName, keyspaceName, context); + return Utils.mapPage(inner, inner1 -> new CassandraTableGetResultsImpl(inner1, this.manager())); + } + + public CassandraTableGetResults getCassandraTable( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + CassandraTableGetResultsInner inner = + this.serviceClient().getCassandraTable(resourceGroupName, accountName, keyspaceName, tableName); + if (inner != null) { + return new CassandraTableGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getCassandraTableWithResponse( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + Response inner = + this + .serviceClient() + .getCassandraTableWithResponse(resourceGroupName, accountName, keyspaceName, tableName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CassandraTableGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteCassandraTable( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + this.serviceClient().deleteCassandraTable(resourceGroupName, accountName, keyspaceName, tableName); + } + + public void deleteCassandraTable( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + this.serviceClient().deleteCassandraTable(resourceGroupName, accountName, keyspaceName, tableName, context); + } + + public ThroughputSettingsGetResults getCassandraTableThroughput( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + ThroughputSettingsGetResultsInner inner = + this.serviceClient().getCassandraTableThroughput(resourceGroupName, accountName, keyspaceName, tableName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getCassandraTableThroughputWithResponse( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + Response inner = + this + .serviceClient() + .getCassandraTableThroughputWithResponse( + resourceGroupName, accountName, keyspaceName, tableName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ThroughputSettingsGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ThroughputSettingsGetResults updateCassandraTableThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .updateCassandraTableThroughput( + resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults updateCassandraTableThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .updateCassandraTableThroughput( + resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateCassandraTableToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateCassandraTableToAutoscale(resourceGroupName, accountName, keyspaceName, tableName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateCassandraTableToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateCassandraTableToAutoscale(resourceGroupName, accountName, keyspaceName, tableName, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateCassandraTableToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateCassandraTableToManualThroughput(resourceGroupName, accountName, keyspaceName, tableName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateCassandraTableToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateCassandraTableToManualThroughput( + resourceGroupName, accountName, keyspaceName, tableName, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public 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..9f07d72b805de --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraTableGetResultsImpl.java @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 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/CollectionPartitionRegionsClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionPartitionRegionsClientImpl.java new file mode 100644 index 0000000000000..266425390ab8e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionPartitionRegionsClientImpl.java @@ -0,0 +1,360 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.CollectionPartitionRegionsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionMetricInner; +import com.azure.resourcemanager.cosmos.generated.models.PartitionMetricListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in CollectionPartitionRegionsClient. */ +public final class CollectionPartitionRegionsClientImpl implements CollectionPartitionRegionsClient { + private final ClientLogger logger = new ClientLogger(CollectionPartitionRegionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final CollectionPartitionRegionsService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of CollectionPartitionRegionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CollectionPartitionRegionsClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy + .create( + CollectionPartitionRegionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientCollectionPartitionRegions to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface CollectionPartitionRegionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}" + + "/partitions/metrics") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMetrics( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("region") String region, + @PathParam("databaseRid") String databaseRid, + @PathParam("collectionRid") String collectionRid, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Retrieves the metrics determined by the given filter for the given collection and region, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (region == null) { + return Mono.error(new IllegalArgumentException("Parameter region is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + if (collectionRid == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionRid is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + region, + databaseRid, + collectionRid, + this.client.getApiVersion(), + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the metrics determined by the given filter for the given collection and region, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (region == null) { + return Mono.error(new IllegalArgumentException("Parameter region is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + if (collectionRid == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionRid is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + region, + databaseRid, + collectionRid, + this.client.getApiVersion(), + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieves the metrics determined by the given filter for the given collection and region, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter) { + return new PagedFlux<>( + () -> + listMetricsSinglePageAsync(resourceGroupName, accountName, region, databaseRid, collectionRid, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given collection and region, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter, + Context context) { + return new PagedFlux<>( + () -> + listMetricsSinglePageAsync( + resourceGroupName, accountName, region, databaseRid, collectionRid, filter, context)); + } + + /** + * Retrieves the metrics determined by the given filter for the given collection and region, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter) { + return new PagedIterable<>( + listMetricsAsync(resourceGroupName, accountName, region, databaseRid, collectionRid, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given collection and region, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter, + Context context) { + return new PagedIterable<>( + listMetricsAsync(resourceGroupName, accountName, region, databaseRid, collectionRid, filter, context)); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionPartitionRegionsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionPartitionRegionsImpl.java new file mode 100644 index 0000000000000..317925c72d5cc --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionPartitionRegionsImpl.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.CollectionPartitionRegionsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionMetricInner; +import com.azure.resourcemanager.cosmos.generated.models.CollectionPartitionRegions; +import com.azure.resourcemanager.cosmos.generated.models.PartitionMetric; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class CollectionPartitionRegionsImpl implements CollectionPartitionRegions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CollectionPartitionRegionsImpl.class); + + private final CollectionPartitionRegionsClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public CollectionPartitionRegionsImpl( + CollectionPartitionRegionsClient innerClient, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter) { + PagedIterable inner = + this + .serviceClient() + .listMetrics(resourceGroupName, accountName, region, databaseRid, collectionRid, filter); + return Utils.mapPage(inner, inner1 -> new PartitionMetricImpl(inner1, this.manager())); + } + + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listMetrics(resourceGroupName, accountName, region, databaseRid, collectionRid, filter, context); + return Utils.mapPage(inner, inner1 -> new PartitionMetricImpl(inner1, this.manager())); + } + + private CollectionPartitionRegionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionPartitionsClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionPartitionsClientImpl.java new file mode 100644 index 0000000000000..5da22a2ed3ffd --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionPartitionsClientImpl.java @@ -0,0 +1,594 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.CollectionPartitionsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionMetricInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionUsageInner; +import com.azure.resourcemanager.cosmos.generated.models.PartitionMetricListResult; +import com.azure.resourcemanager.cosmos.generated.models.PartitionUsagesResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in CollectionPartitionsClient. */ +public final class CollectionPartitionsClientImpl implements CollectionPartitionsClient { + private final ClientLogger logger = new ClientLogger(CollectionPartitionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final CollectionPartitionsService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of CollectionPartitionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CollectionPartitionsClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy + .create(CollectionPartitionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientCollectionPartitions to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface CollectionPartitionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitions" + + "/metrics") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMetrics( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseRid") String databaseRid, + @PathParam("collectionRid") String collectionRid, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitions" + + "/usages") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listUsages( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseRid") String databaseRid, + @PathParam("collectionRid") String collectionRid, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Retrieves the metrics determined by the given filter for the given collection, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + if (collectionRid == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionRid is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + collectionRid, + this.client.getApiVersion(), + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the metrics determined by the given filter for the given collection, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + if (collectionRid == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionRid is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + collectionRid, + this.client.getApiVersion(), + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieves the metrics determined by the given filter for the given collection, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + return new PagedFlux<>( + () -> listMetricsSinglePageAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given collection, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context) { + return new PagedFlux<>( + () -> + listMetricsSinglePageAsync( + resourceGroupName, accountName, databaseRid, collectionRid, filter, context)); + } + + /** + * Retrieves the metrics determined by the given filter for the given collection, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + return new PagedIterable<>( + listMetricsAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given collection, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context) { + return new PagedIterable<>( + listMetricsAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter, context)); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition level usage request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listUsagesSinglePageAsync( + String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + if (collectionRid == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionRid is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listUsages( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + collectionRid, + this.client.getApiVersion(), + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition level usage request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listUsagesSinglePageAsync( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + if (collectionRid == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionRid is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listUsages( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + collectionRid, + this.client.getApiVersion(), + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition level usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listUsagesAsync( + String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + return new PagedFlux<>( + () -> listUsagesSinglePageAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter)); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition level usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listUsagesAsync( + String resourceGroupName, String accountName, String databaseRid, String collectionRid) { + final String filter = null; + return new PagedFlux<>( + () -> listUsagesSinglePageAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter)); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition level usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listUsagesAsync( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context) { + return new PagedFlux<>( + () -> + listUsagesSinglePageAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter, context)); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition level usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listUsages( + String resourceGroupName, String accountName, String databaseRid, String collectionRid) { + final String filter = null; + return new PagedIterable<>(listUsagesAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter)); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition level usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listUsages( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context) { + return new PagedIterable<>( + listUsagesAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter, context)); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionPartitionsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionPartitionsImpl.java new file mode 100644 index 0000000000000..2c50c6e22a063 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionPartitionsImpl.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.CollectionPartitionsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionMetricInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionUsageInner; +import com.azure.resourcemanager.cosmos.generated.models.CollectionPartitions; +import com.azure.resourcemanager.cosmos.generated.models.PartitionMetric; +import com.azure.resourcemanager.cosmos.generated.models.PartitionUsage; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class CollectionPartitionsImpl implements CollectionPartitions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CollectionPartitionsImpl.class); + + private final CollectionPartitionsClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public CollectionPartitionsImpl( + CollectionPartitionsClient innerClient, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + PagedIterable inner = + this.serviceClient().listMetrics(resourceGroupName, accountName, databaseRid, collectionRid, filter); + return Utils.mapPage(inner, inner1 -> new PartitionMetricImpl(inner1, this.manager())); + } + + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listMetrics(resourceGroupName, accountName, databaseRid, collectionRid, filter, context); + return Utils.mapPage(inner, inner1 -> new PartitionMetricImpl(inner1, this.manager())); + } + + public PagedIterable listUsages( + String resourceGroupName, String accountName, String databaseRid, String collectionRid) { + PagedIterable inner = + this.serviceClient().listUsages(resourceGroupName, accountName, databaseRid, collectionRid); + return Utils.mapPage(inner, inner1 -> new PartitionUsageImpl(inner1, this.manager())); + } + + public PagedIterable listUsages( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listUsages(resourceGroupName, accountName, databaseRid, collectionRid, filter, context); + return Utils.mapPage(inner, inner1 -> new PartitionUsageImpl(inner1, this.manager())); + } + + private CollectionPartitionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionRegionsClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionRegionsClientImpl.java new file mode 100644 index 0000000000000..b7241a0c74bd3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionRegionsClientImpl.java @@ -0,0 +1,358 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.CollectionRegionsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricInner; +import com.azure.resourcemanager.cosmos.generated.models.MetricListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in CollectionRegionsClient. */ +public final class CollectionRegionsClientImpl implements CollectionRegionsClient { + private final ClientLogger logger = new ClientLogger(CollectionRegionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final CollectionRegionsService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of CollectionRegionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CollectionRegionsClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy.create(CollectionRegionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientCollectionRegions to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface CollectionRegionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}" + + "/metrics") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMetrics( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("region") String region, + @PathParam("databaseRid") String databaseRid, + @PathParam("collectionRid") String collectionRid, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account, collection and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (region == null) { + return Mono.error(new IllegalArgumentException("Parameter region is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + if (collectionRid == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionRid is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + region, + databaseRid, + collectionRid, + this.client.getApiVersion(), + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account, collection and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (region == null) { + return Mono.error(new IllegalArgumentException("Parameter region is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + if (collectionRid == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionRid is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + region, + databaseRid, + collectionRid, + this.client.getApiVersion(), + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account, collection and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter) { + return new PagedFlux<>( + () -> + listMetricsSinglePageAsync(resourceGroupName, accountName, region, databaseRid, collectionRid, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account, collection and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter, + Context context) { + return new PagedFlux<>( + () -> + listMetricsSinglePageAsync( + resourceGroupName, accountName, region, databaseRid, collectionRid, filter, context)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account, collection and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter) { + return new PagedIterable<>( + listMetricsAsync(resourceGroupName, accountName, region, databaseRid, collectionRid, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account, collection and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter, + Context context) { + return new PagedIterable<>( + listMetricsAsync(resourceGroupName, accountName, region, databaseRid, collectionRid, filter, context)); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionRegionsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionRegionsImpl.java new file mode 100644 index 0000000000000..bce0f7f663369 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionRegionsImpl.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.CollectionRegionsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricInner; +import com.azure.resourcemanager.cosmos.generated.models.CollectionRegions; +import com.azure.resourcemanager.cosmos.generated.models.Metric; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class CollectionRegionsImpl implements CollectionRegions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CollectionRegionsImpl.class); + + private final CollectionRegionsClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public CollectionRegionsImpl( + CollectionRegionsClient innerClient, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter) { + PagedIterable inner = + this + .serviceClient() + .listMetrics(resourceGroupName, accountName, region, databaseRid, collectionRid, filter); + return Utils.mapPage(inner, inner1 -> new MetricImpl(inner1, this.manager())); + } + + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listMetrics(resourceGroupName, accountName, region, databaseRid, collectionRid, filter, context); + return Utils.mapPage(inner, inner1 -> new MetricImpl(inner1, this.manager())); + } + + private CollectionRegionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionsClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionsClientImpl.java new file mode 100644 index 0000000000000..d4928be0e6baa --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionsClientImpl.java @@ -0,0 +1,813 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.CollectionsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricDefinitionInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.UsageInner; +import com.azure.resourcemanager.cosmos.generated.models.MetricDefinitionsListResult; +import com.azure.resourcemanager.cosmos.generated.models.MetricListResult; +import com.azure.resourcemanager.cosmos.generated.models.UsagesResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in CollectionsClient. */ +public final class CollectionsClientImpl implements CollectionsClient { + private final ClientLogger logger = new ClientLogger(CollectionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final CollectionsService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of CollectionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CollectionsClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy.create(CollectionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientCollections to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface CollectionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/metrics") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMetrics( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseRid") String databaseRid, + @PathParam("collectionRid") String collectionRid, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/usages") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listUsages( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseRid") String databaseRid, + @PathParam("collectionRid") String collectionRid, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}" + + "/metricDefinitions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMetricDefinitions( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseRid") String databaseRid, + @PathParam("collectionRid") String collectionRid, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + if (collectionRid == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionRid is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + collectionRid, + this.client.getApiVersion(), + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + if (collectionRid == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionRid is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + collectionRid, + this.client.getApiVersion(), + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + return new PagedFlux<>( + () -> listMetricsSinglePageAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context) { + return new PagedFlux<>( + () -> + listMetricsSinglePageAsync( + resourceGroupName, accountName, databaseRid, collectionRid, filter, context)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + return new PagedIterable<>( + listMetricsAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context) { + return new PagedIterable<>( + listMetricsAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter, context)); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listUsagesSinglePageAsync( + String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + if (collectionRid == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionRid is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listUsages( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + collectionRid, + this.client.getApiVersion(), + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listUsagesSinglePageAsync( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + if (collectionRid == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionRid is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listUsages( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + collectionRid, + this.client.getApiVersion(), + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listUsagesAsync( + String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + return new PagedFlux<>( + () -> listUsagesSinglePageAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter)); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listUsagesAsync( + String resourceGroupName, String accountName, String databaseRid, String collectionRid) { + final String filter = null; + return new PagedFlux<>( + () -> listUsagesSinglePageAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter)); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listUsagesAsync( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context) { + return new PagedFlux<>( + () -> + listUsagesSinglePageAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter, context)); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listUsages( + String resourceGroupName, String accountName, String databaseRid, String collectionRid) { + final String filter = null; + return new PagedIterable<>(listUsagesAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter)); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listUsages( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context) { + return new PagedIterable<>( + listUsagesAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter, context)); + } + + /** + * Retrieves metric definitions for the given collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricDefinitionsSinglePageAsync( + String resourceGroupName, String accountName, String databaseRid, String collectionRid) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + if (collectionRid == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionRid is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetricDefinitions( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + collectionRid, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves metric definitions for the given collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricDefinitionsSinglePageAsync( + String resourceGroupName, String accountName, String databaseRid, String collectionRid, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + if (collectionRid == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionRid is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetricDefinitions( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + collectionRid, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieves metric definitions for the given collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricDefinitionsAsync( + String resourceGroupName, String accountName, String databaseRid, String collectionRid) { + return new PagedFlux<>( + () -> listMetricDefinitionsSinglePageAsync(resourceGroupName, accountName, databaseRid, collectionRid)); + } + + /** + * Retrieves metric definitions for the given collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricDefinitionsAsync( + String resourceGroupName, String accountName, String databaseRid, String collectionRid, Context context) { + return new PagedFlux<>( + () -> + listMetricDefinitionsSinglePageAsync( + resourceGroupName, accountName, databaseRid, collectionRid, context)); + } + + /** + * Retrieves metric definitions for the given collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, String databaseRid, String collectionRid) { + return new PagedIterable<>( + listMetricDefinitionsAsync(resourceGroupName, accountName, databaseRid, collectionRid)); + } + + /** + * Retrieves metric definitions for the given collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, String databaseRid, String collectionRid, Context context) { + return new PagedIterable<>( + listMetricDefinitionsAsync(resourceGroupName, accountName, databaseRid, collectionRid, context)); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionsImpl.java new file mode 100644 index 0000000000000..625c0bf9fb3d8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionsImpl.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.CollectionsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricDefinitionInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.UsageInner; +import com.azure.resourcemanager.cosmos.generated.models.Collections; +import com.azure.resourcemanager.cosmos.generated.models.Metric; +import com.azure.resourcemanager.cosmos.generated.models.MetricDefinition; +import com.azure.resourcemanager.cosmos.generated.models.Usage; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class CollectionsImpl implements Collections { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CollectionsImpl.class); + + private final CollectionsClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public CollectionsImpl( + CollectionsClient innerClient, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + PagedIterable inner = + this.serviceClient().listMetrics(resourceGroupName, accountName, databaseRid, collectionRid, filter); + return Utils.mapPage(inner, inner1 -> new MetricImpl(inner1, this.manager())); + } + + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listMetrics(resourceGroupName, accountName, databaseRid, collectionRid, filter, context); + return Utils.mapPage(inner, inner1 -> new MetricImpl(inner1, this.manager())); + } + + public PagedIterable listUsages( + String resourceGroupName, String accountName, String databaseRid, String collectionRid) { + PagedIterable inner = + this.serviceClient().listUsages(resourceGroupName, accountName, databaseRid, collectionRid); + return Utils.mapPage(inner, inner1 -> new UsageImpl(inner1, this.manager())); + } + + public PagedIterable listUsages( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listUsages(resourceGroupName, accountName, databaseRid, collectionRid, filter, context); + return Utils.mapPage(inner, inner1 -> new UsageImpl(inner1, this.manager())); + } + + public PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, String databaseRid, String collectionRid) { + PagedIterable inner = + this.serviceClient().listMetricDefinitions(resourceGroupName, accountName, databaseRid, collectionRid); + return Utils.mapPage(inner, inner1 -> new MetricDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, String databaseRid, String collectionRid, Context context) { + PagedIterable inner = + this + .serviceClient() + .listMetricDefinitions(resourceGroupName, accountName, databaseRid, collectionRid, context); + return Utils.mapPage(inner, inner1 -> new MetricDefinitionImpl(inner1, this.manager())); + } + + private CollectionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CosmosDBManagementClientBuilder.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CosmosDBManagementClientBuilder.java new file mode 100644 index 0000000000000..a936318552de4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CosmosDBManagementClientBuilder.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.CookiePolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** A builder for creating a new instance of the CosmosDBManagementClientImpl type. */ +@ServiceClientBuilder(serviceClients = {CosmosDBManagementClientImpl.class}) +public final class CosmosDBManagementClientBuilder { + /* + * The ID of the target subscription. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the CosmosDBManagementClientBuilder. + */ + public CosmosDBManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the CosmosDBManagementClientBuilder. + */ + public CosmosDBManagementClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the CosmosDBManagementClientBuilder. + */ + public CosmosDBManagementClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the CosmosDBManagementClientBuilder. + */ + public CosmosDBManagementClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the CosmosDBManagementClientBuilder. + */ + public CosmosDBManagementClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the CosmosDBManagementClientBuilder. + */ + public CosmosDBManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of CosmosDBManagementClientImpl with the provided parameters. + * + * @return an instance of CosmosDBManagementClientImpl. + */ + public CosmosDBManagementClientImpl buildClient() { + if (endpoint == null) { + this.endpoint = "https://management.azure.com"; + } + if (environment == null) { + this.environment = AzureEnvironment.AZURE; + } + if (defaultPollInterval == null) { + this.defaultPollInterval = Duration.ofSeconds(30); + } + if (pipeline == null) { + this.pipeline = + new HttpPipelineBuilder() + .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) + .build(); + } + if (serializerAdapter == null) { + this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); + } + CosmosDBManagementClientImpl client = + new CosmosDBManagementClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CosmosDBManagementClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CosmosDBManagementClientImpl.java new file mode 100644 index 0000000000000..edcb5cec04a50 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CosmosDBManagementClientImpl.java @@ -0,0 +1,671 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.cosmos.generated.fluent.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.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.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.SqlResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.TableResourcesClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.util.Map; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the CosmosDBManagementClientImpl type. */ +@ServiceClient(builder = CosmosDBManagementClientBuilder.class) +public final class CosmosDBManagementClientImpl implements CosmosDBManagementClient { + private final ClientLogger logger = new ClientLogger(CosmosDBManagementClientImpl.class); + + /** The ID of the target subscription. */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** Api Version. */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The DatabaseAccountsClient object to access its operations. */ + private final DatabaseAccountsClient databaseAccounts; + + /** + * Gets the DatabaseAccountsClient object to access its operations. + * + * @return the DatabaseAccountsClient object. + */ + public DatabaseAccountsClient getDatabaseAccounts() { + return this.databaseAccounts; + } + + /** The OperationsClient object to access its operations. */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** The DatabasesClient object to access its operations. */ + private final DatabasesClient databases; + + /** + * Gets the DatabasesClient object to access its operations. + * + * @return the DatabasesClient object. + */ + public DatabasesClient getDatabases() { + return this.databases; + } + + /** The CollectionsClient object to access its operations. */ + private final CollectionsClient collections; + + /** + * Gets the CollectionsClient object to access its operations. + * + * @return the CollectionsClient object. + */ + public CollectionsClient getCollections() { + return this.collections; + } + + /** The CollectionRegionsClient object to access its operations. */ + private final CollectionRegionsClient collectionRegions; + + /** + * Gets the CollectionRegionsClient object to access its operations. + * + * @return the CollectionRegionsClient object. + */ + public CollectionRegionsClient getCollectionRegions() { + return this.collectionRegions; + } + + /** The DatabaseAccountRegionsClient object to access its operations. */ + private final DatabaseAccountRegionsClient databaseAccountRegions; + + /** + * Gets the DatabaseAccountRegionsClient object to access its operations. + * + * @return the DatabaseAccountRegionsClient object. + */ + public DatabaseAccountRegionsClient getDatabaseAccountRegions() { + return this.databaseAccountRegions; + } + + /** The PercentileSourceTargetsClient object to access its operations. */ + private final PercentileSourceTargetsClient percentileSourceTargets; + + /** + * Gets the PercentileSourceTargetsClient object to access its operations. + * + * @return the PercentileSourceTargetsClient object. + */ + public PercentileSourceTargetsClient getPercentileSourceTargets() { + return this.percentileSourceTargets; + } + + /** The PercentileTargetsClient object to access its operations. */ + private final PercentileTargetsClient percentileTargets; + + /** + * Gets the PercentileTargetsClient object to access its operations. + * + * @return the PercentileTargetsClient object. + */ + public PercentileTargetsClient getPercentileTargets() { + return this.percentileTargets; + } + + /** The PercentilesClient object to access its operations. */ + private final PercentilesClient percentiles; + + /** + * Gets the PercentilesClient object to access its operations. + * + * @return the PercentilesClient object. + */ + public PercentilesClient getPercentiles() { + return this.percentiles; + } + + /** The CollectionPartitionRegionsClient object to access its operations. */ + private final CollectionPartitionRegionsClient collectionPartitionRegions; + + /** + * Gets the CollectionPartitionRegionsClient object to access its operations. + * + * @return the CollectionPartitionRegionsClient object. + */ + public CollectionPartitionRegionsClient getCollectionPartitionRegions() { + return this.collectionPartitionRegions; + } + + /** The CollectionPartitionsClient object to access its operations. */ + private final CollectionPartitionsClient collectionPartitions; + + /** + * Gets the CollectionPartitionsClient object to access its operations. + * + * @return the CollectionPartitionsClient object. + */ + public CollectionPartitionsClient getCollectionPartitions() { + return this.collectionPartitions; + } + + /** The PartitionKeyRangeIdsClient object to access its operations. */ + private final PartitionKeyRangeIdsClient partitionKeyRangeIds; + + /** + * Gets the PartitionKeyRangeIdsClient object to access its operations. + * + * @return the PartitionKeyRangeIdsClient object. + */ + public PartitionKeyRangeIdsClient getPartitionKeyRangeIds() { + return this.partitionKeyRangeIds; + } + + /** The PartitionKeyRangeIdRegionsClient object to access its operations. */ + private final PartitionKeyRangeIdRegionsClient partitionKeyRangeIdRegions; + + /** + * Gets the PartitionKeyRangeIdRegionsClient object to access its operations. + * + * @return the PartitionKeyRangeIdRegionsClient object. + */ + public PartitionKeyRangeIdRegionsClient getPartitionKeyRangeIdRegions() { + return this.partitionKeyRangeIdRegions; + } + + /** The 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 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; + } + + /** + * Initializes an instance of CosmosDBManagementClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId The ID of the target subscription. + * @param endpoint server parameter. + */ + CosmosDBManagementClientImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String subscriptionId, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2021-06-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.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); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + for (Map.Entry entry : this.getContext().getValues().entrySet()) { + context = context.addData(entry.getKey(), entry.getValue()); + } + return context; + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + logger.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/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..83a5e4c3d3945 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountGetResultsImpl.java @@ -0,0 +1,729 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.cosmos.generated.models.AnalyticalStorageConfiguration; +import com.azure.resourcemanager.cosmos.generated.models.ApiProperties; +import com.azure.resourcemanager.cosmos.generated.models.BackupPolicy; +import com.azure.resourcemanager.cosmos.generated.models.Capability; +import com.azure.resourcemanager.cosmos.generated.models.ConnectorOffer; +import com.azure.resourcemanager.cosmos.generated.models.ConsistencyPolicy; +import com.azure.resourcemanager.cosmos.generated.models.CorsPolicy; +import com.azure.resourcemanager.cosmos.generated.models.CreateMode; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountGetResults; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountKind; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountListConnectionStringsResult; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountListKeysResult; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountListReadOnlyKeysResult; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountOfferType; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountRegenerateKeyParameters; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.FailoverPolicies; +import com.azure.resourcemanager.cosmos.generated.models.FailoverPolicy; +import com.azure.resourcemanager.cosmos.generated.models.IpAddressOrRange; +import com.azure.resourcemanager.cosmos.generated.models.Location; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentity; +import com.azure.resourcemanager.cosmos.generated.models.NetworkAclBypass; +import com.azure.resourcemanager.cosmos.generated.models.PrivateEndpointConnection; +import com.azure.resourcemanager.cosmos.generated.models.PublicNetworkAccess; +import com.azure.resourcemanager.cosmos.generated.models.RegionForOnlineOffline; +import com.azure.resourcemanager.cosmos.generated.models.RestoreParameters; +import com.azure.resourcemanager.cosmos.generated.models.VirtualNetworkRule; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +public final class DatabaseAccountGetResultsImpl + implements DatabaseAccountGetResults, DatabaseAccountGetResults.Definition, DatabaseAccountGetResults.Update { + private DatabaseAccountGetResultsInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public 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 Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public DatabaseAccountGetResultsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String accountName; + + private DatabaseAccountCreateUpdateParameters createCreateUpdateParameters; + + private DatabaseAccountUpdateParameters updateUpdateParameters; + + public DatabaseAccountGetResultsImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public DatabaseAccountGetResults create() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseAccounts() + .createOrUpdate(resourceGroupName, accountName, createCreateUpdateParameters, Context.NONE); + return this; + } + + public DatabaseAccountGetResults create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseAccounts() + .createOrUpdate(resourceGroupName, accountName, createCreateUpdateParameters, context); + return this; + } + + DatabaseAccountGetResultsImpl( + String name, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = new DatabaseAccountGetResultsInner(); + this.serviceManager = serviceManager; + this.accountName = name; + this.createCreateUpdateParameters = new DatabaseAccountCreateUpdateParameters(); + } + + public DatabaseAccountGetResultsImpl update() { + this.updateUpdateParameters = new DatabaseAccountUpdateParameters(); + return this; + } + + public DatabaseAccountGetResults apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseAccounts() + .update(resourceGroupName, accountName, updateUpdateParameters, Context.NONE); + return this; + } + + public DatabaseAccountGetResults apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseAccounts() + .update(resourceGroupName, accountName, updateUpdateParameters, context); + return this; + } + + DatabaseAccountGetResultsImpl( + DatabaseAccountGetResultsInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + } + + public DatabaseAccountGetResults refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseAccounts() + .getByResourceGroupWithResponse(resourceGroupName, accountName, Context.NONE) + .getValue(); + return this; + } + + public DatabaseAccountGetResults refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseAccounts() + .getByResourceGroupWithResponse(resourceGroupName, accountName, context) + .getValue(); + return this; + } + + public void failoverPriorityChange(FailoverPolicies failoverParameters) { + serviceManager.databaseAccounts().failoverPriorityChange(resourceGroupName, accountName, failoverParameters); + } + + public void failoverPriorityChange(FailoverPolicies failoverParameters, Context context) { + serviceManager + .databaseAccounts() + .failoverPriorityChange(resourceGroupName, accountName, failoverParameters, context); + } + + public DatabaseAccountListKeysResult listKeys() { + return serviceManager.databaseAccounts().listKeys(resourceGroupName, accountName); + } + + public Response listKeysWithResponse(Context context) { + return serviceManager.databaseAccounts().listKeysWithResponse(resourceGroupName, accountName, context); + } + + public DatabaseAccountListConnectionStringsResult listConnectionStrings() { + return serviceManager.databaseAccounts().listConnectionStrings(resourceGroupName, accountName); + } + + public Response listConnectionStringsWithResponse(Context context) { + return serviceManager + .databaseAccounts() + .listConnectionStringsWithResponse(resourceGroupName, accountName, context); + } + + public void offlineRegion(RegionForOnlineOffline regionParameterForOffline) { + serviceManager.databaseAccounts().offlineRegion(resourceGroupName, accountName, regionParameterForOffline); + } + + public void offlineRegion(RegionForOnlineOffline regionParameterForOffline, Context context) { + serviceManager + .databaseAccounts() + .offlineRegion(resourceGroupName, accountName, regionParameterForOffline, context); + } + + public void onlineRegion(RegionForOnlineOffline regionParameterForOnline) { + serviceManager.databaseAccounts().onlineRegion(resourceGroupName, accountName, regionParameterForOnline); + } + + public void onlineRegion(RegionForOnlineOffline regionParameterForOnline, Context context) { + serviceManager + .databaseAccounts() + .onlineRegion(resourceGroupName, accountName, regionParameterForOnline, context); + } + + public DatabaseAccountListReadOnlyKeysResult listReadOnlyKeys() { + return serviceManager.databaseAccounts().listReadOnlyKeys(resourceGroupName, accountName); + } + + public Response listReadOnlyKeysWithResponse(Context context) { + return serviceManager.databaseAccounts().listReadOnlyKeysWithResponse(resourceGroupName, accountName, context); + } + + public void regenerateKey(DatabaseAccountRegenerateKeyParameters keyToRegenerate) { + serviceManager.databaseAccounts().regenerateKey(resourceGroupName, accountName, keyToRegenerate); + } + + public void regenerateKey(DatabaseAccountRegenerateKeyParameters keyToRegenerate, Context context) { + serviceManager.databaseAccounts().regenerateKey(resourceGroupName, accountName, keyToRegenerate, context); + } + + public DatabaseAccountGetResultsImpl withRegion(Region location) { + this.createCreateUpdateParameters.withLocation(location.toString()); + return this; + } + + public DatabaseAccountGetResultsImpl withRegion(String location) { + this.createCreateUpdateParameters.withLocation(location); + return this; + } + + public DatabaseAccountGetResultsImpl withLocations(List locations) { + if (isInCreateMode()) { + this.createCreateUpdateParameters.withLocations(locations); + return this; + } else { + this.updateUpdateParameters.withLocations(locations); + return this; + } + } + + public DatabaseAccountGetResultsImpl 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; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountListConnectionStringsResultImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountListConnectionStringsResultImpl.java new file mode 100644 index 0000000000000..aae6831ee85da --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountListConnectionStringsResultImpl.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountListConnectionStringsResultInner; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountConnectionString; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountListConnectionStringsResult; +import java.util.Collections; +import java.util.List; + +public final class DatabaseAccountListConnectionStringsResultImpl + implements DatabaseAccountListConnectionStringsResult { + private DatabaseAccountListConnectionStringsResultInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + DatabaseAccountListConnectionStringsResultImpl( + DatabaseAccountListConnectionStringsResultInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List connectionStrings() { + List inner = this.innerModel().connectionStrings(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public DatabaseAccountListConnectionStringsResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountListKeysResultImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountListKeysResultImpl.java new file mode 100644 index 0000000000000..b7698d1acbe39 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountListKeysResultImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountListKeysResultInner; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountListKeysResult; + +public final class DatabaseAccountListKeysResultImpl implements DatabaseAccountListKeysResult { + private DatabaseAccountListKeysResultInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + DatabaseAccountListKeysResultImpl( + DatabaseAccountListKeysResultInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String primaryReadonlyMasterKey() { + return this.innerModel().primaryReadonlyMasterKey(); + } + + public String secondaryReadonlyMasterKey() { + return this.innerModel().secondaryReadonlyMasterKey(); + } + + public String primaryMasterKey() { + return this.innerModel().primaryMasterKey(); + } + + public String secondaryMasterKey() { + return this.innerModel().secondaryMasterKey(); + } + + public DatabaseAccountListKeysResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountListReadOnlyKeysResultImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountListReadOnlyKeysResultImpl.java new file mode 100644 index 0000000000000..237c67a6a6171 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountListReadOnlyKeysResultImpl.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountListReadOnlyKeysResultInner; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountListReadOnlyKeysResult; + +public final class DatabaseAccountListReadOnlyKeysResultImpl implements DatabaseAccountListReadOnlyKeysResult { + private DatabaseAccountListReadOnlyKeysResultInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + DatabaseAccountListReadOnlyKeysResultImpl( + DatabaseAccountListReadOnlyKeysResultInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String primaryReadonlyMasterKey() { + return this.innerModel().primaryReadonlyMasterKey(); + } + + public String secondaryReadonlyMasterKey() { + return this.innerModel().secondaryReadonlyMasterKey(); + } + + public DatabaseAccountListReadOnlyKeysResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountRegionsClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountRegionsClientImpl.java new file mode 100644 index 0000000000000..ef6cf7b6cd84f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountRegionsClientImpl.java @@ -0,0 +1,289 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.DatabaseAccountRegionsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricInner; +import com.azure.resourcemanager.cosmos.generated.models.MetricListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DatabaseAccountRegionsClient. */ +public final class DatabaseAccountRegionsClientImpl implements DatabaseAccountRegionsClient { + private final ClientLogger logger = new ClientLogger(DatabaseAccountRegionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final DatabaseAccountRegionsService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of DatabaseAccountRegionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatabaseAccountRegionsClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy + .create(DatabaseAccountRegionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientDatabaseAccountRegions to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface DatabaseAccountRegionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/region/{region}/metrics") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMetrics( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("region") String region, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, String accountName, String region, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (region == null) { + return Mono.error(new IllegalArgumentException("Parameter region is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + region, + this.client.getApiVersion(), + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, String accountName, String region, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (region == null) { + return Mono.error(new IllegalArgumentException("Parameter region is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + region, + this.client.getApiVersion(), + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, String accountName, String region, String filter) { + return new PagedFlux<>(() -> listMetricsSinglePageAsync(resourceGroupName, accountName, region, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, String accountName, String region, String filter, Context context) { + return new PagedFlux<>( + () -> listMetricsSinglePageAsync(resourceGroupName, accountName, region, filter, context)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String region, String filter) { + return new PagedIterable<>(listMetricsAsync(resourceGroupName, accountName, region, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String region, String filter, Context context) { + return new PagedIterable<>(listMetricsAsync(resourceGroupName, accountName, region, filter, context)); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountRegionsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountRegionsImpl.java new file mode 100644 index 0000000000000..5e9dd0ed2dddd --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountRegionsImpl.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.DatabaseAccountRegionsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricInner; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountRegions; +import com.azure.resourcemanager.cosmos.generated.models.Metric; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class DatabaseAccountRegionsImpl implements DatabaseAccountRegions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseAccountRegionsImpl.class); + + private final DatabaseAccountRegionsClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public DatabaseAccountRegionsImpl( + DatabaseAccountRegionsClient innerClient, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String region, String filter) { + PagedIterable inner = + this.serviceClient().listMetrics(resourceGroupName, accountName, region, filter); + return Utils.mapPage(inner, inner1 -> new MetricImpl(inner1, this.manager())); + } + + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String region, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listMetrics(resourceGroupName, accountName, region, filter, context); + return Utils.mapPage(inner, inner1 -> new MetricImpl(inner1, this.manager())); + } + + private DatabaseAccountRegionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountsClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountsClientImpl.java new file mode 100644 index 0000000000000..e30601eb1fb09 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountsClientImpl.java @@ -0,0 +1,3974 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Head; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.cosmos.generated.fluent.DatabaseAccountsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountListConnectionStringsResultInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountListKeysResultInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountListReadOnlyKeysResultInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricDefinitionInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.UsageInner; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountRegenerateKeyParameters; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountsListResult; +import com.azure.resourcemanager.cosmos.generated.models.FailoverPolicies; +import com.azure.resourcemanager.cosmos.generated.models.MetricDefinitionsListResult; +import com.azure.resourcemanager.cosmos.generated.models.MetricListResult; +import com.azure.resourcemanager.cosmos.generated.models.RegionForOnlineOffline; +import com.azure.resourcemanager.cosmos.generated.models.UsagesResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DatabaseAccountsClient. */ +public final class DatabaseAccountsClientImpl implements DatabaseAccountsClient { + private final ClientLogger logger = new ClientLogger(DatabaseAccountsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final DatabaseAccountsService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of DatabaseAccountsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatabaseAccountsClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy.create(DatabaseAccountsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientDatabaseAccounts to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface DatabaseAccountsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DatabaseAccountUpdateParameters updateParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DatabaseAccountCreateUpdateParameters createUpdateParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/failoverPriorityChange") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> failoverPriorityChange( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") FailoverPolicies failoverParameters, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/databaseAccounts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/listKeys") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listKeys( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/listConnectionStrings") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listConnectionStrings( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/offlineRegion") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> offlineRegion( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") RegionForOnlineOffline regionParameterForOffline, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/onlineRegion") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> onlineRegion( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") RegionForOnlineOffline regionParameterForOnline, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/readonlykeys") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getReadOnlyKeys( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/readonlykeys") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listReadOnlyKeys( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/regenerateKey") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> regenerateKey( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DatabaseAccountRegenerateKeyParameters keyToRegenerate, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Head("/providers/Microsoft.DocumentDB/databaseAccountNames/{accountName}") + @ExpectedResponses({200, 404}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkNameExists( + @HostParam("$host") String endpoint, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/metrics") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMetrics( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/usages") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listUsages( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/metricDefinitions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMetricDefinitions( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String accountName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, accountName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseAccountGetResultsInner getByResourceGroup(String resourceGroupName, String accountName) { + return getByResourceGroupAsync(resourceGroupName, accountName).block(); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String accountName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, accountName, context).block(); + } + + /** + * Updates the properties of an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param updateParameters The parameters to provide for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String accountName, DatabaseAccountUpdateParameters updateParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (updateParameters == null) { + return Mono + .error(new IllegalArgumentException("Parameter updateParameters is required and cannot be null.")); + } else { + updateParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + updateParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates the properties of an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param updateParameters The parameters to provide for the current database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String accountName, + DatabaseAccountUpdateParameters updateParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (updateParameters == null) { + return Mono + .error(new IllegalArgumentException("Parameter updateParameters is required and cannot be null.")); + } else { + updateParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + updateParameters, + accept, + context); + } + + /** + * Updates the properties of an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param updateParameters The parameters to provide for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, DatabaseAccountGetResultsInner> beginUpdateAsync( + String resourceGroupName, String accountName, DatabaseAccountUpdateParameters updateParameters) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, accountName, updateParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DatabaseAccountGetResultsInner.class, + DatabaseAccountGetResultsInner.class, + Context.NONE); + } + + /** + * Updates the properties of an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param updateParameters The parameters to provide for the current database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, DatabaseAccountGetResultsInner> beginUpdateAsync( + String resourceGroupName, + String accountName, + DatabaseAccountUpdateParameters updateParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, accountName, updateParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DatabaseAccountGetResultsInner.class, + DatabaseAccountGetResultsInner.class, + context); + } + + /** + * Updates the properties of an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param updateParameters The parameters to provide for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, DatabaseAccountGetResultsInner> beginUpdate( + String resourceGroupName, String accountName, DatabaseAccountUpdateParameters updateParameters) { + return beginUpdateAsync(resourceGroupName, accountName, updateParameters).getSyncPoller(); + } + + /** + * Updates the properties of an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param updateParameters The parameters to provide for the current database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, DatabaseAccountGetResultsInner> beginUpdate( + String resourceGroupName, + String accountName, + DatabaseAccountUpdateParameters updateParameters, + Context context) { + return beginUpdateAsync(resourceGroupName, accountName, updateParameters, context).getSyncPoller(); + } + + /** + * Updates the properties of an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param updateParameters The parameters to provide for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String accountName, DatabaseAccountUpdateParameters updateParameters) { + return beginUpdateAsync(resourceGroupName, accountName, updateParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates the properties of an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param updateParameters The parameters to provide for the current database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String accountName, + DatabaseAccountUpdateParameters updateParameters, + Context context) { + return beginUpdateAsync(resourceGroupName, accountName, updateParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates the properties of an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param updateParameters The parameters to provide for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseAccountGetResultsInner update( + String resourceGroupName, String accountName, DatabaseAccountUpdateParameters updateParameters) { + return updateAsync(resourceGroupName, accountName, updateParameters).block(); + } + + /** + * Updates the properties of an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param updateParameters The parameters to provide for the current database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseAccountGetResultsInner update( + String resourceGroupName, + String accountName, + DatabaseAccountUpdateParameters updateParameters, + Context context) { + return updateAsync(resourceGroupName, accountName, updateParameters, context).block(); + } + + /** + * Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates + * on an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateParameters The parameters to provide for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String accountName, DatabaseAccountCreateUpdateParameters createUpdateParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (createUpdateParameters == null) { + return Mono + .error( + new IllegalArgumentException("Parameter createUpdateParameters is required and cannot be null.")); + } else { + createUpdateParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + createUpdateParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates + * on an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateParameters The parameters to provide for the current database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String accountName, + DatabaseAccountCreateUpdateParameters createUpdateParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (createUpdateParameters == null) { + return Mono + .error( + new IllegalArgumentException("Parameter createUpdateParameters is required and cannot be null.")); + } else { + createUpdateParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + createUpdateParameters, + accept, + context); + } + + /** + * Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates + * on an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateParameters The parameters to provide for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, DatabaseAccountGetResultsInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String accountName, + DatabaseAccountCreateUpdateParameters createUpdateParameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, accountName, createUpdateParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DatabaseAccountGetResultsInner.class, + DatabaseAccountGetResultsInner.class, + Context.NONE); + } + + /** + * Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates + * on an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateParameters The parameters to provide for the current database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, DatabaseAccountGetResultsInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String accountName, + DatabaseAccountCreateUpdateParameters createUpdateParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, accountName, createUpdateParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DatabaseAccountGetResultsInner.class, + DatabaseAccountGetResultsInner.class, + context); + } + + /** + * Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates + * on an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateParameters The parameters to provide for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, DatabaseAccountGetResultsInner> beginCreateOrUpdate( + String resourceGroupName, String accountName, DatabaseAccountCreateUpdateParameters createUpdateParameters) { + return beginCreateOrUpdateAsync(resourceGroupName, accountName, createUpdateParameters).getSyncPoller(); + } + + /** + * Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates + * on an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateParameters The parameters to provide for the current database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, DatabaseAccountGetResultsInner> beginCreateOrUpdate( + String resourceGroupName, + String accountName, + DatabaseAccountCreateUpdateParameters createUpdateParameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, accountName, createUpdateParameters, context) + .getSyncPoller(); + } + + /** + * Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates + * on an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateParameters The parameters to provide for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String accountName, DatabaseAccountCreateUpdateParameters createUpdateParameters) { + return beginCreateOrUpdateAsync(resourceGroupName, accountName, createUpdateParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates + * on an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateParameters The parameters to provide for the current database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String accountName, + DatabaseAccountCreateUpdateParameters createUpdateParameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, accountName, createUpdateParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates + * on an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateParameters The parameters to provide for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseAccountGetResultsInner createOrUpdate( + String resourceGroupName, String accountName, DatabaseAccountCreateUpdateParameters createUpdateParameters) { + return createOrUpdateAsync(resourceGroupName, accountName, createUpdateParameters).block(); + } + + /** + * Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates + * on an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateParameters The parameters to provide for the current database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseAccountGetResultsInner createOrUpdate( + String resourceGroupName, + String accountName, + DatabaseAccountCreateUpdateParameters createUpdateParameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, accountName, createUpdateParameters, context).block(); + } + + /** + * Deletes an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + context); + } + + /** + * Deletes an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String accountName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, accountName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String accountName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, accountName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete(String resourceGroupName, String accountName) { + return beginDeleteAsync(resourceGroupName, accountName).getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String accountName, Context context) { + return beginDeleteAsync(resourceGroupName, accountName, context).getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String accountName) { + return beginDeleteAsync(resourceGroupName, accountName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String accountName, Context context) { + return beginDeleteAsync(resourceGroupName, accountName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String accountName) { + deleteAsync(resourceGroupName, accountName).block(); + } + + /** + * Deletes an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String accountName, Context context) { + deleteAsync(resourceGroupName, accountName, context).block(); + } + + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a + * write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values + * must be unique for each of the regions in which the database account exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param failoverParameters The new failover policies for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> failoverPriorityChangeWithResponseAsync( + String resourceGroupName, String accountName, FailoverPolicies failoverParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (failoverParameters == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverParameters is required and cannot be null.")); + } else { + failoverParameters.validate(); + } + return FluxUtil + .withContext( + context -> + service + .failoverPriorityChange( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + failoverParameters, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a + * write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values + * must be unique for each of the regions in which the database account exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param failoverParameters The new failover policies for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> failoverPriorityChangeWithResponseAsync( + String resourceGroupName, String accountName, FailoverPolicies failoverParameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (failoverParameters == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverParameters is required and cannot be null.")); + } else { + failoverParameters.validate(); + } + context = this.client.mergeContext(context); + return service + .failoverPriorityChange( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + failoverParameters, + context); + } + + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a + * write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values + * must be unique for each of the regions in which the database account exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param failoverParameters The new failover policies for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginFailoverPriorityChangeAsync( + String resourceGroupName, String accountName, FailoverPolicies failoverParameters) { + Mono>> mono = + failoverPriorityChangeWithResponseAsync(resourceGroupName, accountName, failoverParameters); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a + * write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values + * must be unique for each of the regions in which the database account exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param failoverParameters The new failover policies for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginFailoverPriorityChangeAsync( + String resourceGroupName, String accountName, FailoverPolicies failoverParameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + failoverPriorityChangeWithResponseAsync(resourceGroupName, accountName, failoverParameters, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a + * write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values + * must be unique for each of the regions in which the database account exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param failoverParameters The new failover policies for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginFailoverPriorityChange( + String resourceGroupName, String accountName, FailoverPolicies failoverParameters) { + return beginFailoverPriorityChangeAsync(resourceGroupName, accountName, failoverParameters).getSyncPoller(); + } + + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a + * write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values + * must be unique for each of the regions in which the database account exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param failoverParameters The new failover policies for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginFailoverPriorityChange( + String resourceGroupName, String accountName, FailoverPolicies failoverParameters, Context context) { + return beginFailoverPriorityChangeAsync(resourceGroupName, accountName, failoverParameters, context) + .getSyncPoller(); + } + + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a + * write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values + * must be unique for each of the regions in which the database account exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param failoverParameters The new failover policies for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono failoverPriorityChangeAsync( + String resourceGroupName, String accountName, FailoverPolicies failoverParameters) { + return beginFailoverPriorityChangeAsync(resourceGroupName, accountName, failoverParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a + * write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values + * must be unique for each of the regions in which the database account exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param failoverParameters The new failover policies for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono failoverPriorityChangeAsync( + String resourceGroupName, String accountName, FailoverPolicies failoverParameters, Context context) { + return beginFailoverPriorityChangeAsync(resourceGroupName, accountName, failoverParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a + * write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values + * must be unique for each of the regions in which the database account exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param failoverParameters The new failover policies for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void failoverPriorityChange( + String resourceGroupName, String accountName, FailoverPolicies failoverParameters) { + failoverPriorityChangeAsync(resourceGroupName, accountName, failoverParameters).block(); + } + + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a + * write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values + * must be unique for each of the regions in which the database account exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param failoverParameters The new failover policies for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void failoverPriorityChange( + String resourceGroupName, String accountName, FailoverPolicies failoverParameters, Context context) { + failoverPriorityChangeAsync(resourceGroupName, accountName, failoverParameters, context).block(); + } + + /** + * Lists all the Azure Cosmos DB database accounts available under the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all the Azure Cosmos DB database accounts available under the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Lists all the Azure Cosmos DB database accounts available under the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync()); + } + + /** + * Lists all the Azure Cosmos DB database accounts available under the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context)); + } + + /** + * Lists all the Azure Cosmos DB database accounts available under the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all the Azure Cosmos DB database accounts available under the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Lists all the Azure Cosmos DB database accounts available under the given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all the Azure Cosmos DB database accounts available under the given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Lists all the Azure Cosmos DB database accounts available under the given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName)); + } + + /** + * Lists all the Azure Cosmos DB database accounts available under the given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context)); + } + + /** + * Lists all the Azure Cosmos DB database accounts available under the given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Lists all the Azure Cosmos DB database accounts available under the given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup( + String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Lists the access keys for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the access keys for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listKeysWithResponseAsync( + String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listKeys( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the access keys for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the access keys for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listKeysWithResponseAsync( + String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listKeys( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Lists the access keys for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the access keys for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listKeysAsync(String resourceGroupName, String accountName) { + return listKeysWithResponseAsync(resourceGroupName, accountName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Lists the access keys for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the access keys for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseAccountListKeysResultInner listKeys(String resourceGroupName, String accountName) { + return listKeysAsync(resourceGroupName, accountName).block(); + } + + /** + * Lists the access keys for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the access keys for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listKeysWithResponse( + String resourceGroupName, String accountName, Context context) { + return listKeysWithResponseAsync(resourceGroupName, accountName, context).block(); + } + + /** + * Lists the connection strings for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connection strings for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listConnectionStringsWithResponseAsync( + String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listConnectionStrings( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the connection strings for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connection strings for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listConnectionStringsWithResponseAsync( + String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listConnectionStrings( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Lists the connection strings for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connection strings for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listConnectionStringsAsync( + String resourceGroupName, String accountName) { + return listConnectionStringsWithResponseAsync(resourceGroupName, accountName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Lists the connection strings for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connection strings for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseAccountListConnectionStringsResultInner listConnectionStrings( + String resourceGroupName, String accountName) { + return listConnectionStringsAsync(resourceGroupName, accountName).block(); + } + + /** + * Lists the connection strings for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connection strings for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listConnectionStringsWithResponse( + String resourceGroupName, String accountName, Context context) { + return listConnectionStringsWithResponseAsync(resourceGroupName, accountName, context).block(); + } + + /** + * Offline the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param regionParameterForOffline Cosmos DB region to offline for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> offlineRegionWithResponseAsync( + String resourceGroupName, String accountName, RegionForOnlineOffline regionParameterForOffline) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (regionParameterForOffline == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter regionParameterForOffline is required and cannot be null.")); + } else { + regionParameterForOffline.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .offlineRegion( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + regionParameterForOffline, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Offline the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param regionParameterForOffline Cosmos DB region to offline for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> offlineRegionWithResponseAsync( + String resourceGroupName, + String accountName, + RegionForOnlineOffline regionParameterForOffline, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (regionParameterForOffline == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter regionParameterForOffline is required and cannot be null.")); + } else { + regionParameterForOffline.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .offlineRegion( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + regionParameterForOffline, + accept, + context); + } + + /** + * Offline the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param regionParameterForOffline Cosmos DB region to offline for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginOfflineRegionAsync( + String resourceGroupName, String accountName, RegionForOnlineOffline regionParameterForOffline) { + Mono>> mono = + offlineRegionWithResponseAsync(resourceGroupName, accountName, regionParameterForOffline); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Offline the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param regionParameterForOffline Cosmos DB region to offline for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginOfflineRegionAsync( + String resourceGroupName, + String accountName, + RegionForOnlineOffline regionParameterForOffline, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + offlineRegionWithResponseAsync(resourceGroupName, accountName, regionParameterForOffline, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Offline the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param regionParameterForOffline Cosmos DB region to offline for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginOfflineRegion( + String resourceGroupName, String accountName, RegionForOnlineOffline regionParameterForOffline) { + return beginOfflineRegionAsync(resourceGroupName, accountName, regionParameterForOffline).getSyncPoller(); + } + + /** + * Offline the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param regionParameterForOffline Cosmos DB region to offline for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginOfflineRegion( + String resourceGroupName, + String accountName, + RegionForOnlineOffline regionParameterForOffline, + Context context) { + return beginOfflineRegionAsync(resourceGroupName, accountName, regionParameterForOffline, context) + .getSyncPoller(); + } + + /** + * Offline the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param regionParameterForOffline Cosmos DB region to offline for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono offlineRegionAsync( + String resourceGroupName, String accountName, RegionForOnlineOffline regionParameterForOffline) { + return beginOfflineRegionAsync(resourceGroupName, accountName, regionParameterForOffline) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Offline the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param regionParameterForOffline Cosmos DB region to offline for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono offlineRegionAsync( + String resourceGroupName, + String accountName, + RegionForOnlineOffline regionParameterForOffline, + Context context) { + return beginOfflineRegionAsync(resourceGroupName, accountName, regionParameterForOffline, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Offline the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param regionParameterForOffline Cosmos DB region to offline for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void offlineRegion( + String resourceGroupName, String accountName, RegionForOnlineOffline regionParameterForOffline) { + offlineRegionAsync(resourceGroupName, accountName, regionParameterForOffline).block(); + } + + /** + * Offline the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param regionParameterForOffline Cosmos DB region to offline for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void offlineRegion( + String resourceGroupName, + String accountName, + RegionForOnlineOffline regionParameterForOffline, + Context context) { + offlineRegionAsync(resourceGroupName, accountName, regionParameterForOffline, context).block(); + } + + /** + * Online the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param regionParameterForOnline Cosmos DB region to online for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> onlineRegionWithResponseAsync( + String resourceGroupName, String accountName, RegionForOnlineOffline regionParameterForOnline) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (regionParameterForOnline == null) { + return Mono + .error( + new IllegalArgumentException("Parameter regionParameterForOnline is required and cannot be null.")); + } else { + regionParameterForOnline.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .onlineRegion( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + regionParameterForOnline, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Online the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param regionParameterForOnline Cosmos DB region to online for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> onlineRegionWithResponseAsync( + String resourceGroupName, + String accountName, + RegionForOnlineOffline regionParameterForOnline, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (regionParameterForOnline == null) { + return Mono + .error( + new IllegalArgumentException("Parameter regionParameterForOnline is required and cannot be null.")); + } else { + regionParameterForOnline.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .onlineRegion( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + regionParameterForOnline, + accept, + context); + } + + /** + * Online the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param regionParameterForOnline Cosmos DB region to online for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginOnlineRegionAsync( + String resourceGroupName, String accountName, RegionForOnlineOffline regionParameterForOnline) { + Mono>> mono = + onlineRegionWithResponseAsync(resourceGroupName, accountName, regionParameterForOnline); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Online the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param regionParameterForOnline Cosmos DB region to online for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginOnlineRegionAsync( + String resourceGroupName, + String accountName, + RegionForOnlineOffline regionParameterForOnline, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + onlineRegionWithResponseAsync(resourceGroupName, accountName, regionParameterForOnline, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Online the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param regionParameterForOnline Cosmos DB region to online for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginOnlineRegion( + String resourceGroupName, String accountName, RegionForOnlineOffline regionParameterForOnline) { + return beginOnlineRegionAsync(resourceGroupName, accountName, regionParameterForOnline).getSyncPoller(); + } + + /** + * Online the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param regionParameterForOnline Cosmos DB region to online for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginOnlineRegion( + String resourceGroupName, + String accountName, + RegionForOnlineOffline regionParameterForOnline, + Context context) { + return beginOnlineRegionAsync(resourceGroupName, accountName, regionParameterForOnline, context) + .getSyncPoller(); + } + + /** + * Online the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param regionParameterForOnline Cosmos DB region to online for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono onlineRegionAsync( + String resourceGroupName, String accountName, RegionForOnlineOffline regionParameterForOnline) { + return beginOnlineRegionAsync(resourceGroupName, accountName, regionParameterForOnline) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Online the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param regionParameterForOnline Cosmos DB region to online for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono onlineRegionAsync( + String resourceGroupName, + String accountName, + RegionForOnlineOffline regionParameterForOnline, + Context context) { + return beginOnlineRegionAsync(resourceGroupName, accountName, regionParameterForOnline, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Online the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param regionParameterForOnline Cosmos DB region to online for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void onlineRegion( + String resourceGroupName, String accountName, RegionForOnlineOffline regionParameterForOnline) { + onlineRegionAsync(resourceGroupName, accountName, regionParameterForOnline).block(); + } + + /** + * Online the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param regionParameterForOnline Cosmos DB region to online for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void onlineRegion( + String resourceGroupName, + String accountName, + RegionForOnlineOffline regionParameterForOnline, + Context context) { + onlineRegionAsync(resourceGroupName, accountName, regionParameterForOnline, context).block(); + } + + /** + * Lists the read-only access keys for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the read-only access keys for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getReadOnlyKeysWithResponseAsync( + String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getReadOnlyKeys( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the read-only access keys for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the read-only access keys for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getReadOnlyKeysWithResponseAsync( + String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getReadOnlyKeys( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Lists the read-only access keys for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the read-only access keys for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getReadOnlyKeysAsync( + String resourceGroupName, String accountName) { + return getReadOnlyKeysWithResponseAsync(resourceGroupName, accountName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Lists the read-only access keys for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the read-only access keys for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseAccountListReadOnlyKeysResultInner getReadOnlyKeys(String resourceGroupName, String accountName) { + return getReadOnlyKeysAsync(resourceGroupName, accountName).block(); + } + + /** + * Lists the read-only access keys for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the read-only access keys for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getReadOnlyKeysWithResponse( + String resourceGroupName, String accountName, Context context) { + return getReadOnlyKeysWithResponseAsync(resourceGroupName, accountName, context).block(); + } + + /** + * Lists the read-only access keys for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the read-only access keys for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listReadOnlyKeysWithResponseAsync( + String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listReadOnlyKeys( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the read-only access keys for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the read-only access keys for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listReadOnlyKeysWithResponseAsync( + String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listReadOnlyKeys( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Lists the read-only access keys for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the read-only access keys for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listReadOnlyKeysAsync( + String resourceGroupName, String accountName) { + return listReadOnlyKeysWithResponseAsync(resourceGroupName, accountName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Lists the read-only access keys for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the read-only access keys for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseAccountListReadOnlyKeysResultInner listReadOnlyKeys(String resourceGroupName, String accountName) { + return listReadOnlyKeysAsync(resourceGroupName, accountName).block(); + } + + /** + * Lists the read-only access keys for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the read-only access keys for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listReadOnlyKeysWithResponse( + String resourceGroupName, String accountName, Context context) { + return listReadOnlyKeysWithResponseAsync(resourceGroupName, accountName, context).block(); + } + + /** + * Regenerates an access key for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyToRegenerate The name of the key to regenerate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> regenerateKeyWithResponseAsync( + String resourceGroupName, String accountName, DatabaseAccountRegenerateKeyParameters keyToRegenerate) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyToRegenerate == null) { + return Mono + .error(new IllegalArgumentException("Parameter keyToRegenerate is required and cannot be null.")); + } else { + keyToRegenerate.validate(); + } + return FluxUtil + .withContext( + context -> + service + .regenerateKey( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + keyToRegenerate, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Regenerates an access key for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyToRegenerate The name of the key to regenerate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> regenerateKeyWithResponseAsync( + String resourceGroupName, + String accountName, + DatabaseAccountRegenerateKeyParameters keyToRegenerate, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyToRegenerate == null) { + return Mono + .error(new IllegalArgumentException("Parameter keyToRegenerate is required and cannot be null.")); + } else { + keyToRegenerate.validate(); + } + context = this.client.mergeContext(context); + return service + .regenerateKey( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + keyToRegenerate, + context); + } + + /** + * Regenerates an access key for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyToRegenerate The name of the key to regenerate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginRegenerateKeyAsync( + String resourceGroupName, String accountName, DatabaseAccountRegenerateKeyParameters keyToRegenerate) { + Mono>> mono = + regenerateKeyWithResponseAsync(resourceGroupName, accountName, keyToRegenerate); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Regenerates an access key for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyToRegenerate The name of the key to regenerate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginRegenerateKeyAsync( + String resourceGroupName, + String accountName, + DatabaseAccountRegenerateKeyParameters keyToRegenerate, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + regenerateKeyWithResponseAsync(resourceGroupName, accountName, keyToRegenerate, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Regenerates an access key for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyToRegenerate The name of the key to regenerate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginRegenerateKey( + String resourceGroupName, String accountName, DatabaseAccountRegenerateKeyParameters keyToRegenerate) { + return beginRegenerateKeyAsync(resourceGroupName, accountName, keyToRegenerate).getSyncPoller(); + } + + /** + * Regenerates an access key for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyToRegenerate The name of the key to regenerate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginRegenerateKey( + String resourceGroupName, + String accountName, + DatabaseAccountRegenerateKeyParameters keyToRegenerate, + Context context) { + return beginRegenerateKeyAsync(resourceGroupName, accountName, keyToRegenerate, context).getSyncPoller(); + } + + /** + * Regenerates an access key for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyToRegenerate The name of the key to regenerate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono regenerateKeyAsync( + String resourceGroupName, String accountName, DatabaseAccountRegenerateKeyParameters keyToRegenerate) { + return beginRegenerateKeyAsync(resourceGroupName, accountName, keyToRegenerate) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Regenerates an access key for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyToRegenerate The name of the key to regenerate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono regenerateKeyAsync( + String resourceGroupName, + String accountName, + DatabaseAccountRegenerateKeyParameters keyToRegenerate, + Context context) { + return beginRegenerateKeyAsync(resourceGroupName, accountName, keyToRegenerate, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Regenerates an access key for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyToRegenerate The name of the key to regenerate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void regenerateKey( + String resourceGroupName, String accountName, DatabaseAccountRegenerateKeyParameters keyToRegenerate) { + regenerateKeyAsync(resourceGroupName, accountName, keyToRegenerate).block(); + } + + /** + * Regenerates an access key for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyToRegenerate The name of the key to regenerate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void regenerateKey( + String resourceGroupName, + String accountName, + DatabaseAccountRegenerateKeyParameters keyToRegenerate, + Context context) { + regenerateKeyAsync(resourceGroupName, accountName, keyToRegenerate, context).block(); + } + + /** + * Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase + * letters, numbers, and the '-' character, and must be between 3 and 50 characters. + * + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whether resource exists. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkNameExistsWithResponseAsync(String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .checkNameExists(this.client.getEndpoint(), accountName, this.client.getApiVersion(), context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase + * letters, numbers, and the '-' character, and must be between 3 and 50 characters. + * + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whether resource exists. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkNameExistsWithResponseAsync(String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + context = this.client.mergeContext(context); + return service.checkNameExists(this.client.getEndpoint(), accountName, this.client.getApiVersion(), context); + } + + /** + * Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase + * letters, numbers, and the '-' character, and must be between 3 and 50 characters. + * + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whether resource exists. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkNameExistsAsync(String accountName) { + return checkNameExistsWithResponseAsync(accountName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase + * letters, numbers, and the '-' character, and must be between 3 and 50 characters. + * + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whether resource exists. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public boolean checkNameExists(String accountName) { + Boolean value = checkNameExistsAsync(accountName).block(); + if (value != null) { + return value; + } else { + throw logger.logExceptionAsError(new NullPointerException()); + } + } + + /** + * Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase + * letters, numbers, and the '-' character, and must be between 3 and 50 characters. + * + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkNameExistsWithResponse(String accountName, Context context) { + return checkNameExistsWithResponseAsync(accountName, context).block(); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, String accountName, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, String accountName, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync(String resourceGroupName, String accountName, String filter) { + return new PagedFlux<>(() -> listMetricsSinglePageAsync(resourceGroupName, accountName, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, String accountName, String filter, Context context) { + return new PagedFlux<>(() -> listMetricsSinglePageAsync(resourceGroupName, accountName, filter, context)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics(String resourceGroupName, String accountName, String filter) { + return new PagedIterable<>(listMetricsAsync(resourceGroupName, accountName, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String filter, Context context) { + return new PagedIterable<>(listMetricsAsync(resourceGroupName, accountName, filter, context)); + } + + /** + * Retrieves the usages (most recent data) for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listUsagesSinglePageAsync( + String resourceGroupName, String accountName, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listUsages( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the usages (most recent data) for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listUsagesSinglePageAsync( + String resourceGroupName, String accountName, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listUsages( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieves the usages (most recent data) for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listUsagesAsync(String resourceGroupName, String accountName, String filter) { + return new PagedFlux<>(() -> listUsagesSinglePageAsync(resourceGroupName, accountName, filter)); + } + + /** + * Retrieves the usages (most recent data) for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listUsagesAsync(String resourceGroupName, String accountName) { + final String filter = null; + return new PagedFlux<>(() -> listUsagesSinglePageAsync(resourceGroupName, accountName, filter)); + } + + /** + * Retrieves the usages (most recent data) for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listUsagesAsync( + String resourceGroupName, String accountName, String filter, Context context) { + return new PagedFlux<>(() -> listUsagesSinglePageAsync(resourceGroupName, accountName, filter, context)); + } + + /** + * Retrieves the usages (most recent data) for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listUsages(String resourceGroupName, String accountName) { + final String filter = null; + return new PagedIterable<>(listUsagesAsync(resourceGroupName, accountName, filter)); + } + + /** + * Retrieves the usages (most recent data) for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listUsages( + String resourceGroupName, String accountName, String filter, Context context) { + return new PagedIterable<>(listUsagesAsync(resourceGroupName, accountName, filter, context)); + } + + /** + * Retrieves metric definitions for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricDefinitionsSinglePageAsync( + String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetricDefinitions( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves metric definitions for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricDefinitionsSinglePageAsync( + String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetricDefinitions( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieves metric definitions for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricDefinitionsAsync(String resourceGroupName, String accountName) { + return new PagedFlux<>(() -> listMetricDefinitionsSinglePageAsync(resourceGroupName, accountName)); + } + + /** + * Retrieves metric definitions for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricDefinitionsAsync( + String resourceGroupName, String accountName, Context context) { + return new PagedFlux<>(() -> listMetricDefinitionsSinglePageAsync(resourceGroupName, accountName, context)); + } + + /** + * Retrieves metric definitions for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetricDefinitions(String resourceGroupName, String accountName) { + return new PagedIterable<>(listMetricDefinitionsAsync(resourceGroupName, accountName)); + } + + /** + * Retrieves metric definitions for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, Context context) { + return new PagedIterable<>(listMetricDefinitionsAsync(resourceGroupName, accountName, context)); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountsImpl.java new file mode 100644 index 0000000000000..fbedf19d986a6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountsImpl.java @@ -0,0 +1,389 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.DatabaseAccountsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountListConnectionStringsResultInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountListKeysResultInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountListReadOnlyKeysResultInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricDefinitionInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.UsageInner; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountGetResults; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountListConnectionStringsResult; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountListKeysResult; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountListReadOnlyKeysResult; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountRegenerateKeyParameters; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccounts; +import com.azure.resourcemanager.cosmos.generated.models.FailoverPolicies; +import com.azure.resourcemanager.cosmos.generated.models.Metric; +import com.azure.resourcemanager.cosmos.generated.models.MetricDefinition; +import com.azure.resourcemanager.cosmos.generated.models.RegionForOnlineOffline; +import com.azure.resourcemanager.cosmos.generated.models.Usage; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class DatabaseAccountsImpl implements DatabaseAccounts { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseAccountsImpl.class); + + private final DatabaseAccountsClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public DatabaseAccountsImpl( + DatabaseAccountsClient innerClient, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public DatabaseAccountGetResults getByResourceGroup(String resourceGroupName, String accountName) { + DatabaseAccountGetResultsInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, accountName); + if (inner != null) { + return new DatabaseAccountGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String accountName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, accountName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseAccountGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String accountName) { + this.serviceClient().delete(resourceGroupName, accountName); + } + + public void delete(String resourceGroupName, String accountName, Context context) { + this.serviceClient().delete(resourceGroupName, accountName, context); + } + + public void failoverPriorityChange( + String resourceGroupName, String accountName, FailoverPolicies failoverParameters) { + this.serviceClient().failoverPriorityChange(resourceGroupName, accountName, failoverParameters); + } + + public void failoverPriorityChange( + String resourceGroupName, String accountName, FailoverPolicies failoverParameters, Context context) { + this.serviceClient().failoverPriorityChange(resourceGroupName, accountName, failoverParameters, context); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new DatabaseAccountGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new DatabaseAccountGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new DatabaseAccountGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new DatabaseAccountGetResultsImpl(inner1, this.manager())); + } + + public DatabaseAccountListKeysResult listKeys(String resourceGroupName, String accountName) { + DatabaseAccountListKeysResultInner inner = this.serviceClient().listKeys(resourceGroupName, accountName); + if (inner != null) { + return new DatabaseAccountListKeysResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listKeysWithResponse( + String resourceGroupName, String accountName, Context context) { + Response inner = + this.serviceClient().listKeysWithResponse(resourceGroupName, accountName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseAccountListKeysResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DatabaseAccountListConnectionStringsResult listConnectionStrings( + String resourceGroupName, String accountName) { + DatabaseAccountListConnectionStringsResultInner inner = + this.serviceClient().listConnectionStrings(resourceGroupName, accountName); + if (inner != null) { + return new DatabaseAccountListConnectionStringsResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listConnectionStringsWithResponse( + String resourceGroupName, String accountName, Context context) { + Response inner = + this.serviceClient().listConnectionStringsWithResponse(resourceGroupName, accountName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseAccountListConnectionStringsResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void offlineRegion( + String resourceGroupName, String accountName, RegionForOnlineOffline regionParameterForOffline) { + this.serviceClient().offlineRegion(resourceGroupName, accountName, regionParameterForOffline); + } + + public void offlineRegion( + String resourceGroupName, + String accountName, + RegionForOnlineOffline regionParameterForOffline, + Context context) { + this.serviceClient().offlineRegion(resourceGroupName, accountName, regionParameterForOffline, context); + } + + public void onlineRegion( + String resourceGroupName, String accountName, RegionForOnlineOffline regionParameterForOnline) { + this.serviceClient().onlineRegion(resourceGroupName, accountName, regionParameterForOnline); + } + + public void onlineRegion( + String resourceGroupName, + String accountName, + RegionForOnlineOffline regionParameterForOnline, + Context context) { + this.serviceClient().onlineRegion(resourceGroupName, accountName, regionParameterForOnline, context); + } + + public DatabaseAccountListReadOnlyKeysResult getReadOnlyKeys(String resourceGroupName, String accountName) { + DatabaseAccountListReadOnlyKeysResultInner inner = + this.serviceClient().getReadOnlyKeys(resourceGroupName, accountName); + if (inner != null) { + return new DatabaseAccountListReadOnlyKeysResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getReadOnlyKeysWithResponse( + String resourceGroupName, String accountName, Context context) { + Response inner = + this.serviceClient().getReadOnlyKeysWithResponse(resourceGroupName, accountName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseAccountListReadOnlyKeysResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DatabaseAccountListReadOnlyKeysResult listReadOnlyKeys(String resourceGroupName, String accountName) { + DatabaseAccountListReadOnlyKeysResultInner inner = + this.serviceClient().listReadOnlyKeys(resourceGroupName, accountName); + if (inner != null) { + return new DatabaseAccountListReadOnlyKeysResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listReadOnlyKeysWithResponse( + String resourceGroupName, String accountName, Context context) { + Response inner = + this.serviceClient().listReadOnlyKeysWithResponse(resourceGroupName, accountName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseAccountListReadOnlyKeysResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void regenerateKey( + String resourceGroupName, String accountName, DatabaseAccountRegenerateKeyParameters keyToRegenerate) { + this.serviceClient().regenerateKey(resourceGroupName, accountName, keyToRegenerate); + } + + public void regenerateKey( + String resourceGroupName, + String accountName, + DatabaseAccountRegenerateKeyParameters keyToRegenerate, + Context context) { + this.serviceClient().regenerateKey(resourceGroupName, accountName, keyToRegenerate, context); + } + + public boolean checkNameExists(String accountName) { + return this.serviceClient().checkNameExists(accountName); + } + + public Response checkNameExistsWithResponse(String accountName, Context context) { + return this.serviceClient().checkNameExistsWithResponse(accountName, context); + } + + public PagedIterable listMetrics(String resourceGroupName, String accountName, String filter) { + PagedIterable inner = this.serviceClient().listMetrics(resourceGroupName, accountName, filter); + return Utils.mapPage(inner, inner1 -> new MetricImpl(inner1, this.manager())); + } + + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listMetrics(resourceGroupName, accountName, filter, context); + return Utils.mapPage(inner, inner1 -> new MetricImpl(inner1, this.manager())); + } + + public PagedIterable listUsages(String resourceGroupName, String accountName) { + PagedIterable inner = this.serviceClient().listUsages(resourceGroupName, accountName); + return Utils.mapPage(inner, inner1 -> new UsageImpl(inner1, this.manager())); + } + + public PagedIterable listUsages( + String resourceGroupName, String accountName, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listUsages(resourceGroupName, accountName, filter, context); + return Utils.mapPage(inner, inner1 -> new UsageImpl(inner1, this.manager())); + } + + public PagedIterable listMetricDefinitions(String resourceGroupName, String accountName) { + PagedIterable inner = + this.serviceClient().listMetricDefinitions(resourceGroupName, accountName); + return Utils.mapPage(inner, inner1 -> new MetricDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, Context context) { + PagedIterable inner = + this.serviceClient().listMetricDefinitions(resourceGroupName, accountName, context); + return Utils.mapPage(inner, inner1 -> new MetricDefinitionImpl(inner1, this.manager())); + } + + public DatabaseAccountGetResults getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, accountName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, accountName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + this.delete(resourceGroupName, accountName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + this.delete(resourceGroupName, accountName, context); + } + + private DatabaseAccountsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + public DatabaseAccountGetResultsImpl define(String name) { + return new DatabaseAccountGetResultsImpl(name, this.manager()); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseRestoreResourceImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseRestoreResourceImpl.java new file mode 100644 index 0000000000000..7814f48bb38dc --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseRestoreResourceImpl.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseRestoreResourceInner; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseRestoreResource; +import java.util.Collections; +import java.util.List; + +public final class DatabaseRestoreResourceImpl implements DatabaseRestoreResource { + private DatabaseRestoreResourceInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + DatabaseRestoreResourceImpl( + DatabaseRestoreResourceInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String databaseName() { + return this.innerModel().databaseName(); + } + + public List collectionNames() { + List inner = this.innerModel().collectionNames(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public DatabaseRestoreResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabasesClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabasesClientImpl.java new file mode 100644 index 0000000000000..d79fa1930b9f1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabasesClientImpl.java @@ -0,0 +1,720 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.DatabasesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricDefinitionInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.UsageInner; +import com.azure.resourcemanager.cosmos.generated.models.MetricDefinitionsListResult; +import com.azure.resourcemanager.cosmos.generated.models.MetricListResult; +import com.azure.resourcemanager.cosmos.generated.models.UsagesResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DatabasesClient. */ +public final class DatabasesClientImpl implements DatabasesClient { + private final ClientLogger logger = new ClientLogger(DatabasesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final DatabasesService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of DatabasesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatabasesClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy.create(DatabasesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientDatabases to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface DatabasesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/databases/{databaseRid}/metrics") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMetrics( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseRid") String databaseRid, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/databases/{databaseRid}/usages") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listUsages( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseRid") String databaseRid, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/databases/{databaseRid}/metricDefinitions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMetricDefinitions( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseRid") String databaseRid, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, String accountName, String databaseRid, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + this.client.getApiVersion(), + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, String accountName, String databaseRid, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + this.client.getApiVersion(), + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, String accountName, String databaseRid, String filter) { + return new PagedFlux<>(() -> listMetricsSinglePageAsync(resourceGroupName, accountName, databaseRid, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, String accountName, String databaseRid, String filter, Context context) { + return new PagedFlux<>( + () -> listMetricsSinglePageAsync(resourceGroupName, accountName, databaseRid, filter, context)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String databaseRid, String filter) { + return new PagedIterable<>(listMetricsAsync(resourceGroupName, accountName, databaseRid, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String databaseRid, String filter, Context context) { + return new PagedIterable<>(listMetricsAsync(resourceGroupName, accountName, databaseRid, filter, context)); + } + + /** + * Retrieves the usages (most recent data) for the given database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listUsagesSinglePageAsync( + String resourceGroupName, String accountName, String databaseRid, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listUsages( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + this.client.getApiVersion(), + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the usages (most recent data) for the given database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listUsagesSinglePageAsync( + String resourceGroupName, String accountName, String databaseRid, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listUsages( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + this.client.getApiVersion(), + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieves the usages (most recent data) for the given database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listUsagesAsync( + String resourceGroupName, String accountName, String databaseRid, String filter) { + return new PagedFlux<>(() -> listUsagesSinglePageAsync(resourceGroupName, accountName, databaseRid, filter)); + } + + /** + * Retrieves the usages (most recent data) for the given database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listUsagesAsync(String resourceGroupName, String accountName, String databaseRid) { + final String filter = null; + return new PagedFlux<>(() -> listUsagesSinglePageAsync(resourceGroupName, accountName, databaseRid, filter)); + } + + /** + * Retrieves the usages (most recent data) for the given database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listUsagesAsync( + String resourceGroupName, String accountName, String databaseRid, String filter, Context context) { + return new PagedFlux<>( + () -> listUsagesSinglePageAsync(resourceGroupName, accountName, databaseRid, filter, context)); + } + + /** + * Retrieves the usages (most recent data) for the given database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listUsages(String resourceGroupName, String accountName, String databaseRid) { + final String filter = null; + return new PagedIterable<>(listUsagesAsync(resourceGroupName, accountName, databaseRid, filter)); + } + + /** + * Retrieves the usages (most recent data) for the given database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listUsages( + String resourceGroupName, String accountName, String databaseRid, String filter, Context context) { + return new PagedIterable<>(listUsagesAsync(resourceGroupName, accountName, databaseRid, filter, context)); + } + + /** + * Retrieves metric definitions for the given database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricDefinitionsSinglePageAsync( + String resourceGroupName, String accountName, String databaseRid) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetricDefinitions( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves metric definitions for the given database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricDefinitionsSinglePageAsync( + String resourceGroupName, String accountName, String databaseRid, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetricDefinitions( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieves metric definitions for the given database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricDefinitionsAsync( + String resourceGroupName, String accountName, String databaseRid) { + return new PagedFlux<>(() -> listMetricDefinitionsSinglePageAsync(resourceGroupName, accountName, databaseRid)); + } + + /** + * Retrieves metric definitions for the given database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricDefinitionsAsync( + String resourceGroupName, String accountName, String databaseRid, Context context) { + return new PagedFlux<>( + () -> listMetricDefinitionsSinglePageAsync(resourceGroupName, accountName, databaseRid, context)); + } + + /** + * Retrieves metric definitions for the given database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, String databaseRid) { + return new PagedIterable<>(listMetricDefinitionsAsync(resourceGroupName, accountName, databaseRid)); + } + + /** + * Retrieves metric definitions for the given database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, String databaseRid, Context context) { + return new PagedIterable<>(listMetricDefinitionsAsync(resourceGroupName, accountName, databaseRid, context)); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabasesImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabasesImpl.java new file mode 100644 index 0000000000000..b8dbad9c42b86 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabasesImpl.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.DatabasesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricDefinitionInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.UsageInner; +import com.azure.resourcemanager.cosmos.generated.models.Databases; +import com.azure.resourcemanager.cosmos.generated.models.Metric; +import com.azure.resourcemanager.cosmos.generated.models.MetricDefinition; +import com.azure.resourcemanager.cosmos.generated.models.Usage; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class DatabasesImpl implements Databases { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabasesImpl.class); + + private final DatabasesClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public DatabasesImpl( + DatabasesClient innerClient, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String databaseRid, String filter) { + PagedIterable inner = + this.serviceClient().listMetrics(resourceGroupName, accountName, databaseRid, filter); + return Utils.mapPage(inner, inner1 -> new MetricImpl(inner1, this.manager())); + } + + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String databaseRid, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listMetrics(resourceGroupName, accountName, databaseRid, filter, context); + return Utils.mapPage(inner, inner1 -> new MetricImpl(inner1, this.manager())); + } + + public PagedIterable listUsages(String resourceGroupName, String accountName, String databaseRid) { + PagedIterable inner = this.serviceClient().listUsages(resourceGroupName, accountName, databaseRid); + return Utils.mapPage(inner, inner1 -> new UsageImpl(inner1, this.manager())); + } + + public PagedIterable listUsages( + String resourceGroupName, String accountName, String databaseRid, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listUsages(resourceGroupName, accountName, databaseRid, filter, context); + return Utils.mapPage(inner, inner1 -> new UsageImpl(inner1, this.manager())); + } + + public PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, String databaseRid) { + PagedIterable inner = + this.serviceClient().listMetricDefinitions(resourceGroupName, accountName, databaseRid); + return Utils.mapPage(inner, inner1 -> new MetricDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, String databaseRid, Context context) { + PagedIterable inner = + this.serviceClient().listMetricDefinitions(resourceGroupName, accountName, databaseRid, context); + return Utils.mapPage(inner, inner1 -> new MetricDefinitionImpl(inner1, this.manager())); + } + + private DatabasesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/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..f88d59926cb7d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/GremlinDatabaseGetResultsImpl.java @@ -0,0 +1,224 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.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 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..a759c2e9d8b85 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/GremlinGraphGetResultsImpl.java @@ -0,0 +1,240 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.GremlinGraphGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.GremlinGraphCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.GremlinGraphGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.GremlinGraphGetPropertiesResource; +import com.azure.resourcemanager.cosmos.generated.models.GremlinGraphGetResults; +import com.azure.resourcemanager.cosmos.generated.models.GremlinGraphResource; +import 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 GremlinGraphGetResultsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String accountName; + + private String databaseName; + + private String graphName; + + private GremlinGraphCreateUpdateParameters createCreateUpdateGremlinGraphParameters; + + private GremlinGraphCreateUpdateParameters updateCreateUpdateGremlinGraphParameters; + + public GremlinGraphGetResultsImpl withExistingGremlinDatabase( + String resourceGroupName, String accountName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + this.databaseName = databaseName; + return this; + } + + public GremlinGraphGetResults create() { + this.innerObject = + serviceManager + .serviceClient() + .getGremlinResources() + .createUpdateGremlinGraph( + resourceGroupName, + accountName, + databaseName, + graphName, + createCreateUpdateGremlinGraphParameters, + Context.NONE); + return this; + } + + public GremlinGraphGetResults create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getGremlinResources() + .createUpdateGremlinGraph( + resourceGroupName, + accountName, + databaseName, + graphName, + createCreateUpdateGremlinGraphParameters, + context); + return this; + } + + GremlinGraphGetResultsImpl(String name, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = new GremlinGraphGetResultsInner(); + this.serviceManager = serviceManager; + this.graphName = name; + this.createCreateUpdateGremlinGraphParameters = new GremlinGraphCreateUpdateParameters(); + } + + public GremlinGraphGetResultsImpl update() { + this.updateCreateUpdateGremlinGraphParameters = new GremlinGraphCreateUpdateParameters(); + return this; + } + + public GremlinGraphGetResults apply() { + this.innerObject = + serviceManager + .serviceClient() + .getGremlinResources() + .createUpdateGremlinGraph( + resourceGroupName, + accountName, + databaseName, + graphName, + updateCreateUpdateGremlinGraphParameters, + Context.NONE); + return this; + } + + public GremlinGraphGetResults apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getGremlinResources() + .createUpdateGremlinGraph( + resourceGroupName, + accountName, + databaseName, + graphName, + updateCreateUpdateGremlinGraphParameters, + context); + return this; + } + + GremlinGraphGetResultsImpl( + GremlinGraphGetResultsInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "gremlinDatabases"); + this.graphName = Utils.getValueFromIdByName(innerObject.id(), "graphs"); + } + + public GremlinGraphGetResults refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getGremlinResources() + .getGremlinGraphWithResponse(resourceGroupName, accountName, databaseName, graphName, Context.NONE) + .getValue(); + return this; + } + + public GremlinGraphGetResults refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getGremlinResources() + .getGremlinGraphWithResponse(resourceGroupName, accountName, databaseName, graphName, context) + .getValue(); + return this; + } + + public GremlinGraphGetResultsImpl withRegion(Region location) { + this.createCreateUpdateGremlinGraphParameters.withLocation(location.toString()); + return this; + } + + public GremlinGraphGetResultsImpl withRegion(String location) { + this.createCreateUpdateGremlinGraphParameters.withLocation(location); + return this; + } + + public GremlinGraphGetResultsImpl withResource(GremlinGraphResource resource) { + if (isInCreateMode()) { + this.createCreateUpdateGremlinGraphParameters.withResource(resource); + return this; + } else { + this.updateCreateUpdateGremlinGraphParameters.withResource(resource); + return this; + } + } + + public GremlinGraphGetResultsImpl withTags(Map tags) { + if (isInCreateMode()) { + this.createCreateUpdateGremlinGraphParameters.withTags(tags); + return this; + } else { + this.updateCreateUpdateGremlinGraphParameters.withTags(tags); + return this; + } + } + + public GremlinGraphGetResultsImpl 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..10546efd202db --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/GremlinResourcesClientImpl.java @@ -0,0 +1,4502 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.cosmos.generated.fluent.GremlinResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.GremlinDatabaseGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.GremlinGraphGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ThroughputSettingsGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.GremlinDatabaseCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.GremlinDatabaseListResult; +import com.azure.resourcemanager.cosmos.generated.models.GremlinGraphCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.GremlinGraphListResult; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in GremlinResourcesClient. */ +public final class GremlinResourcesClientImpl implements GremlinResourcesClient { + private final ClientLogger logger = new ClientLogger(GremlinResourcesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final GremlinResourcesService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of GremlinResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + GremlinResourcesClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy.create(GremlinResourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientGremlinResources to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface GremlinResourcesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/gremlinDatabases") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listGremlinDatabases( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getGremlinDatabase( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createUpdateGremlinDatabase( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") GremlinDatabaseCreateUpdateParameters createUpdateGremlinDatabaseParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> deleteGremlinDatabase( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getGremlinDatabaseThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> updateGremlinDatabaseThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ThroughputSettingsUpdateParameters updateThroughputParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default" + + "/migrateToAutoscale") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> migrateGremlinDatabaseToAutoscale( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default" + + "/migrateToManualThroughput") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> migrateGremlinDatabaseToManualThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listGremlinGraphs( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getGremlinGraph( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("graphName") String graphName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createUpdateGremlinGraph( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("graphName") String graphName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> deleteGremlinGraph( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("graphName") String graphName, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}" + + "/throughputSettings/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getGremlinGraphThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("graphName") String graphName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}" + + "/throughputSettings/default") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> updateGremlinGraphThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("graphName") String graphName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ThroughputSettingsUpdateParameters updateThroughputParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}" + + "/throughputSettings/default/migrateToAutoscale") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> migrateGremlinGraphToAutoscale( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("graphName") String graphName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}" + + "/throughputSettings/default/migrateToManualThroughput") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> migrateGremlinGraphToManualThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("graphName") String graphName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the Gremlin databases under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the Gremlin databases and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listGremlinDatabasesSinglePageAsync( + String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listGremlinDatabases( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the Gremlin databases under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the Gremlin databases and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listGremlinDatabasesSinglePageAsync( + String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listGremlinDatabases( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Lists the Gremlin databases under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the Gremlin databases and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listGremlinDatabasesAsync( + String resourceGroupName, String accountName) { + return new PagedFlux<>(() -> listGremlinDatabasesSinglePageAsync(resourceGroupName, accountName)); + } + + /** + * Lists the Gremlin databases under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the Gremlin databases and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listGremlinDatabasesAsync( + String resourceGroupName, String accountName, Context context) { + return new PagedFlux<>(() -> listGremlinDatabasesSinglePageAsync(resourceGroupName, accountName, context)); + } + + /** + * Lists the Gremlin databases under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the Gremlin databases and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listGremlinDatabases( + String resourceGroupName, String accountName) { + return new PagedIterable<>(listGremlinDatabasesAsync(resourceGroupName, accountName)); + } + + /** + * Lists the Gremlin databases under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the Gremlin databases and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listGremlinDatabases( + String resourceGroupName, String accountName, Context context) { + return new PagedIterable<>(listGremlinDatabasesAsync(resourceGroupName, accountName, context)); + } + + /** + * Gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getGremlinDatabaseWithResponseAsync( + String resourceGroupName, String accountName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getGremlinDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getGremlinDatabaseWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getGremlinDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getGremlinDatabaseAsync( + String resourceGroupName, String accountName, String databaseName) { + return getGremlinDatabaseWithResponseAsync(resourceGroupName, accountName, databaseName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GremlinDatabaseGetResultsInner getGremlinDatabase( + String resourceGroupName, String accountName, String databaseName) { + return getGremlinDatabaseAsync(resourceGroupName, accountName, databaseName).block(); + } + + /** + * Gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getGremlinDatabaseWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context) { + return getGremlinDatabaseWithResponseAsync(resourceGroupName, accountName, databaseName, context).block(); + } + + /** + * Create or update an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateGremlinDatabaseParameters The parameters to provide for the current Gremlin database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateGremlinDatabaseWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + GremlinDatabaseCreateUpdateParameters createUpdateGremlinDatabaseParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (createUpdateGremlinDatabaseParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateGremlinDatabaseParameters is required and cannot be null.")); + } else { + createUpdateGremlinDatabaseParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createUpdateGremlinDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + createUpdateGremlinDatabaseParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateGremlinDatabaseParameters The parameters to provide for the current Gremlin database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateGremlinDatabaseWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + GremlinDatabaseCreateUpdateParameters createUpdateGremlinDatabaseParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (createUpdateGremlinDatabaseParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateGremlinDatabaseParameters is required and cannot be null.")); + } else { + createUpdateGremlinDatabaseParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createUpdateGremlinDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + createUpdateGremlinDatabaseParameters, + accept, + context); + } + + /** + * Create or update an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateGremlinDatabaseParameters The parameters to provide for the current Gremlin database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, GremlinDatabaseGetResultsInner> + beginCreateUpdateGremlinDatabaseAsync( + String resourceGroupName, + String accountName, + String databaseName, + GremlinDatabaseCreateUpdateParameters createUpdateGremlinDatabaseParameters) { + Mono>> mono = + createUpdateGremlinDatabaseWithResponseAsync( + resourceGroupName, accountName, databaseName, createUpdateGremlinDatabaseParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + GremlinDatabaseGetResultsInner.class, + GremlinDatabaseGetResultsInner.class, + Context.NONE); + } + + /** + * Create or update an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateGremlinDatabaseParameters The parameters to provide for the current Gremlin database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, GremlinDatabaseGetResultsInner> + beginCreateUpdateGremlinDatabaseAsync( + String resourceGroupName, + String accountName, + String databaseName, + GremlinDatabaseCreateUpdateParameters createUpdateGremlinDatabaseParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createUpdateGremlinDatabaseWithResponseAsync( + resourceGroupName, accountName, databaseName, createUpdateGremlinDatabaseParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + GremlinDatabaseGetResultsInner.class, + GremlinDatabaseGetResultsInner.class, + context); + } + + /** + * Create or update an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateGremlinDatabaseParameters The parameters to provide for the current Gremlin database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, GremlinDatabaseGetResultsInner> + beginCreateUpdateGremlinDatabase( + String resourceGroupName, + String accountName, + String databaseName, + GremlinDatabaseCreateUpdateParameters createUpdateGremlinDatabaseParameters) { + return beginCreateUpdateGremlinDatabaseAsync( + resourceGroupName, accountName, databaseName, createUpdateGremlinDatabaseParameters) + .getSyncPoller(); + } + + /** + * Create or update an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateGremlinDatabaseParameters The parameters to provide for the current Gremlin database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, GremlinDatabaseGetResultsInner> + beginCreateUpdateGremlinDatabase( + String resourceGroupName, + String accountName, + String databaseName, + GremlinDatabaseCreateUpdateParameters createUpdateGremlinDatabaseParameters, + Context context) { + return beginCreateUpdateGremlinDatabaseAsync( + resourceGroupName, accountName, databaseName, createUpdateGremlinDatabaseParameters, context) + .getSyncPoller(); + } + + /** + * Create or update an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateGremlinDatabaseParameters The parameters to provide for the current Gremlin database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateGremlinDatabaseAsync( + String resourceGroupName, + String accountName, + String databaseName, + GremlinDatabaseCreateUpdateParameters createUpdateGremlinDatabaseParameters) { + return beginCreateUpdateGremlinDatabaseAsync( + resourceGroupName, accountName, databaseName, createUpdateGremlinDatabaseParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateGremlinDatabaseParameters The parameters to provide for the current Gremlin database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateGremlinDatabaseAsync( + String resourceGroupName, + String accountName, + String databaseName, + GremlinDatabaseCreateUpdateParameters createUpdateGremlinDatabaseParameters, + Context context) { + return beginCreateUpdateGremlinDatabaseAsync( + resourceGroupName, accountName, databaseName, createUpdateGremlinDatabaseParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateGremlinDatabaseParameters The parameters to provide for the current Gremlin database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GremlinDatabaseGetResultsInner createUpdateGremlinDatabase( + String resourceGroupName, + String accountName, + String databaseName, + GremlinDatabaseCreateUpdateParameters createUpdateGremlinDatabaseParameters) { + return createUpdateGremlinDatabaseAsync( + resourceGroupName, accountName, databaseName, createUpdateGremlinDatabaseParameters) + .block(); + } + + /** + * Create or update an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateGremlinDatabaseParameters The parameters to provide for the current Gremlin database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GremlinDatabaseGetResultsInner createUpdateGremlinDatabase( + String resourceGroupName, + String accountName, + String databaseName, + GremlinDatabaseCreateUpdateParameters createUpdateGremlinDatabaseParameters, + Context context) { + return createUpdateGremlinDatabaseAsync( + resourceGroupName, accountName, databaseName, createUpdateGremlinDatabaseParameters, context) + .block(); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteGremlinDatabaseWithResponseAsync( + String resourceGroupName, String accountName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .deleteGremlinDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteGremlinDatabaseWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + context = this.client.mergeContext(context); + return service + .deleteGremlinDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + context); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteGremlinDatabaseAsync( + String resourceGroupName, String accountName, String databaseName) { + Mono>> mono = + deleteGremlinDatabaseWithResponseAsync(resourceGroupName, accountName, databaseName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteGremlinDatabaseAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteGremlinDatabaseWithResponseAsync(resourceGroupName, accountName, databaseName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDeleteGremlinDatabase( + String resourceGroupName, String accountName, String databaseName) { + return beginDeleteGremlinDatabaseAsync(resourceGroupName, accountName, databaseName).getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDeleteGremlinDatabase( + String resourceGroupName, String accountName, String databaseName, Context context) { + return beginDeleteGremlinDatabaseAsync(resourceGroupName, accountName, databaseName, context).getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteGremlinDatabaseAsync(String resourceGroupName, String accountName, String databaseName) { + return beginDeleteGremlinDatabaseAsync(resourceGroupName, accountName, databaseName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteGremlinDatabaseAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + return beginDeleteGremlinDatabaseAsync(resourceGroupName, accountName, databaseName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteGremlinDatabase(String resourceGroupName, String accountName, String databaseName) { + deleteGremlinDatabaseAsync(resourceGroupName, accountName, databaseName).block(); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteGremlinDatabase( + String resourceGroupName, String accountName, String databaseName, Context context) { + deleteGremlinDatabaseAsync(resourceGroupName, accountName, databaseName, context).block(); + } + + /** + * Gets the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account with the + * provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getGremlinDatabaseThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getGremlinDatabaseThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account with the + * provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getGremlinDatabaseThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getGremlinDatabaseThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account with the + * provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getGremlinDatabaseThroughputAsync( + String resourceGroupName, String accountName, String databaseName) { + return getGremlinDatabaseThroughputWithResponseAsync(resourceGroupName, accountName, databaseName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account with the + * provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner getGremlinDatabaseThroughput( + String resourceGroupName, String accountName, String databaseName) { + return getGremlinDatabaseThroughputAsync(resourceGroupName, accountName, databaseName).block(); + } + + /** + * Gets the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account with the + * provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getGremlinDatabaseThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context) { + return getGremlinDatabaseThroughputWithResponseAsync(resourceGroupName, accountName, databaseName, context) + .block(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin + * database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateGremlinDatabaseThroughputWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (updateThroughputParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter updateThroughputParameters is required and cannot be null.")); + } else { + updateThroughputParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateGremlinDatabaseThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + updateThroughputParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin + * database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateGremlinDatabaseThroughputWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (updateThroughputParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter updateThroughputParameters is required and cannot be null.")); + } else { + updateThroughputParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateGremlinDatabaseThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + updateThroughputParameters, + accept, + context); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin + * database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginUpdateGremlinDatabaseThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + Mono>> mono = + updateGremlinDatabaseThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin + * database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginUpdateGremlinDatabaseThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateGremlinDatabaseThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin + * database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateGremlinDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateGremlinDatabaseThroughputAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters) + .getSyncPoller(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin + * database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateGremlinDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return beginUpdateGremlinDatabaseThroughputAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters, context) + .getSyncPoller(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin + * database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateGremlinDatabaseThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateGremlinDatabaseThroughputAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin + * database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateGremlinDatabaseThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return beginUpdateGremlinDatabaseThroughputAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin + * database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner updateGremlinDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return updateGremlinDatabaseThroughputAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters) + .block(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin + * database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner updateGremlinDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return updateGremlinDatabaseThroughputAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters, context) + .block(); + } + + /** + * Migrate an Azure Cosmos DB Gremlin database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateGremlinDatabaseToAutoscaleWithResponseAsync( + String resourceGroupName, String accountName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateGremlinDatabaseToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Migrate an Azure Cosmos DB Gremlin database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateGremlinDatabaseToAutoscaleWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateGremlinDatabaseToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Migrate an Azure Cosmos DB Gremlin database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateGremlinDatabaseToAutoscaleAsync(String resourceGroupName, String accountName, String databaseName) { + Mono>> mono = + migrateGremlinDatabaseToAutoscaleWithResponseAsync(resourceGroupName, accountName, databaseName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * Migrate an Azure Cosmos DB Gremlin database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateGremlinDatabaseToAutoscaleAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + migrateGremlinDatabaseToAutoscaleWithResponseAsync(resourceGroupName, accountName, databaseName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * Migrate an Azure Cosmos DB Gremlin database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateGremlinDatabaseToAutoscale(String resourceGroupName, String accountName, String databaseName) { + return beginMigrateGremlinDatabaseToAutoscaleAsync(resourceGroupName, accountName, databaseName) + .getSyncPoller(); + } + + /** + * Migrate an Azure Cosmos DB Gremlin database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateGremlinDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName, Context context) { + return beginMigrateGremlinDatabaseToAutoscaleAsync(resourceGroupName, accountName, databaseName, context) + .getSyncPoller(); + } + + /** + * Migrate an Azure Cosmos DB Gremlin database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateGremlinDatabaseToAutoscaleAsync( + String resourceGroupName, String accountName, String databaseName) { + return beginMigrateGremlinDatabaseToAutoscaleAsync(resourceGroupName, accountName, databaseName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Migrate an Azure Cosmos DB Gremlin database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateGremlinDatabaseToAutoscaleAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + return beginMigrateGremlinDatabaseToAutoscaleAsync(resourceGroupName, accountName, databaseName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Migrate an Azure Cosmos DB Gremlin database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateGremlinDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName) { + return migrateGremlinDatabaseToAutoscaleAsync(resourceGroupName, accountName, databaseName).block(); + } + + /** + * Migrate an Azure Cosmos DB Gremlin database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateGremlinDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName, Context context) { + return migrateGremlinDatabaseToAutoscaleAsync(resourceGroupName, accountName, databaseName, context).block(); + } + + /** + * Migrate an Azure Cosmos DB Gremlin database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateGremlinDatabaseToManualThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateGremlinDatabaseToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Migrate an Azure Cosmos DB Gremlin database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateGremlinDatabaseToManualThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateGremlinDatabaseToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Migrate an Azure Cosmos DB Gremlin database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateGremlinDatabaseToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName) { + Mono>> mono = + migrateGremlinDatabaseToManualThroughputWithResponseAsync(resourceGroupName, accountName, databaseName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * Migrate an Azure Cosmos DB Gremlin database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateGremlinDatabaseToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + migrateGremlinDatabaseToManualThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * Migrate an Azure Cosmos DB Gremlin database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateGremlinDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName) { + return beginMigrateGremlinDatabaseToManualThroughputAsync(resourceGroupName, accountName, databaseName) + .getSyncPoller(); + } + + /** + * Migrate an Azure Cosmos DB Gremlin database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateGremlinDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName, Context context) { + return beginMigrateGremlinDatabaseToManualThroughputAsync(resourceGroupName, accountName, databaseName, context) + .getSyncPoller(); + } + + /** + * Migrate an Azure Cosmos DB Gremlin database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateGremlinDatabaseToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName) { + return beginMigrateGremlinDatabaseToManualThroughputAsync(resourceGroupName, accountName, databaseName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Migrate an Azure Cosmos DB Gremlin database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateGremlinDatabaseToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + return beginMigrateGremlinDatabaseToManualThroughputAsync(resourceGroupName, accountName, databaseName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Migrate an Azure Cosmos DB Gremlin database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateGremlinDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName) { + return migrateGremlinDatabaseToManualThroughputAsync(resourceGroupName, accountName, databaseName).block(); + } + + /** + * Migrate an Azure Cosmos DB Gremlin database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateGremlinDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName, Context context) { + return migrateGremlinDatabaseToManualThroughputAsync(resourceGroupName, accountName, databaseName, context) + .block(); + } + + /** + * Lists the Gremlin graph under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the graphs and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listGremlinGraphsSinglePageAsync( + String resourceGroupName, String accountName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listGremlinGraphs( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the Gremlin graph under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the graphs and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listGremlinGraphsSinglePageAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listGremlinGraphs( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Lists the Gremlin graph under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the graphs and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listGremlinGraphsAsync( + String resourceGroupName, String accountName, String databaseName) { + return new PagedFlux<>(() -> listGremlinGraphsSinglePageAsync(resourceGroupName, accountName, databaseName)); + } + + /** + * Lists the Gremlin graph under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the graphs and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listGremlinGraphsAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listGremlinGraphsSinglePageAsync(resourceGroupName, accountName, databaseName, context)); + } + + /** + * Lists the Gremlin graph under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the graphs and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listGremlinGraphs( + String resourceGroupName, String accountName, String databaseName) { + return new PagedIterable<>(listGremlinGraphsAsync(resourceGroupName, accountName, databaseName)); + } + + /** + * Lists the Gremlin graph under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the graphs and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listGremlinGraphs( + String resourceGroupName, String accountName, String databaseName, Context context) { + return new PagedIterable<>(listGremlinGraphsAsync(resourceGroupName, accountName, databaseName, context)); + } + + /** + * Gets the Gremlin graph under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin graph under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getGremlinGraphWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String graphName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (graphName == null) { + return Mono.error(new IllegalArgumentException("Parameter graphName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getGremlinGraph( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + graphName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the Gremlin graph under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin graph under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getGremlinGraphWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (graphName == null) { + return Mono.error(new IllegalArgumentException("Parameter graphName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getGremlinGraph( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + graphName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the Gremlin graph under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin graph under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getGremlinGraphAsync( + String resourceGroupName, String accountName, String databaseName, String graphName) { + return getGremlinGraphWithResponseAsync(resourceGroupName, accountName, databaseName, graphName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the Gremlin graph under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin graph under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GremlinGraphGetResultsInner getGremlinGraph( + String resourceGroupName, String accountName, String databaseName, String graphName) { + return getGremlinGraphAsync(resourceGroupName, accountName, databaseName, graphName).block(); + } + + /** + * Gets the Gremlin graph under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin graph under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getGremlinGraphWithResponse( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + return getGremlinGraphWithResponseAsync(resourceGroupName, accountName, databaseName, graphName, context) + .block(); + } + + /** + * Create or update an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param createUpdateGremlinGraphParameters The parameters to provide for the current Gremlin graph. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin graph. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateGremlinGraphWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (graphName == null) { + return Mono.error(new IllegalArgumentException("Parameter graphName is required and cannot be null.")); + } + if (createUpdateGremlinGraphParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateGremlinGraphParameters is required and cannot be null.")); + } else { + createUpdateGremlinGraphParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createUpdateGremlinGraph( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + graphName, + this.client.getApiVersion(), + createUpdateGremlinGraphParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param createUpdateGremlinGraphParameters The parameters to provide for the current Gremlin graph. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin graph. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateGremlinGraphWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (graphName == null) { + return Mono.error(new IllegalArgumentException("Parameter graphName is required and cannot be null.")); + } + if (createUpdateGremlinGraphParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateGremlinGraphParameters is required and cannot be null.")); + } else { + createUpdateGremlinGraphParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createUpdateGremlinGraph( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + graphName, + this.client.getApiVersion(), + createUpdateGremlinGraphParameters, + accept, + context); + } + + /** + * Create or update an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param createUpdateGremlinGraphParameters The parameters to provide for the current Gremlin graph. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin graph. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, GremlinGraphGetResultsInner> + beginCreateUpdateGremlinGraphAsync( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters) { + Mono>> mono = + createUpdateGremlinGraphWithResponseAsync( + resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + GremlinGraphGetResultsInner.class, + GremlinGraphGetResultsInner.class, + Context.NONE); + } + + /** + * Create or update an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param createUpdateGremlinGraphParameters The parameters to provide for the current Gremlin graph. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin graph. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, GremlinGraphGetResultsInner> + beginCreateUpdateGremlinGraphAsync( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createUpdateGremlinGraphWithResponseAsync( + resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + GremlinGraphGetResultsInner.class, + GremlinGraphGetResultsInner.class, + context); + } + + /** + * Create or update an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param createUpdateGremlinGraphParameters The parameters to provide for the current Gremlin graph. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin graph. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, GremlinGraphGetResultsInner> + beginCreateUpdateGremlinGraph( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters) { + return beginCreateUpdateGremlinGraphAsync( + resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters) + .getSyncPoller(); + } + + /** + * Create or update an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param createUpdateGremlinGraphParameters The parameters to provide for the current Gremlin graph. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin graph. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, GremlinGraphGetResultsInner> + beginCreateUpdateGremlinGraph( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters, + Context context) { + return beginCreateUpdateGremlinGraphAsync( + resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters, context) + .getSyncPoller(); + } + + /** + * Create or update an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param createUpdateGremlinGraphParameters The parameters to provide for the current Gremlin graph. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin graph. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateGremlinGraphAsync( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters) { + return beginCreateUpdateGremlinGraphAsync( + resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param createUpdateGremlinGraphParameters The parameters to provide for the current Gremlin graph. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin graph. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateGremlinGraphAsync( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters, + Context context) { + return beginCreateUpdateGremlinGraphAsync( + resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param createUpdateGremlinGraphParameters The parameters to provide for the current Gremlin graph. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin graph. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GremlinGraphGetResultsInner createUpdateGremlinGraph( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters) { + return createUpdateGremlinGraphAsync( + resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters) + .block(); + } + + /** + * Create or update an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param createUpdateGremlinGraphParameters The parameters to provide for the current Gremlin graph. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin graph. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GremlinGraphGetResultsInner createUpdateGremlinGraph( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters, + Context context) { + return createUpdateGremlinGraphAsync( + resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters, context) + .block(); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteGremlinGraphWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String graphName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (graphName == null) { + return Mono.error(new IllegalArgumentException("Parameter graphName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .deleteGremlinGraph( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + graphName, + this.client.getApiVersion(), + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteGremlinGraphWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (graphName == null) { + return Mono.error(new IllegalArgumentException("Parameter graphName is required and cannot be null.")); + } + context = this.client.mergeContext(context); + return service + .deleteGremlinGraph( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + graphName, + this.client.getApiVersion(), + context); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteGremlinGraphAsync( + String resourceGroupName, String accountName, String databaseName, String graphName) { + Mono>> mono = + deleteGremlinGraphWithResponseAsync(resourceGroupName, accountName, databaseName, graphName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteGremlinGraphAsync( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteGremlinGraphWithResponseAsync(resourceGroupName, accountName, databaseName, graphName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDeleteGremlinGraph( + String resourceGroupName, String accountName, String databaseName, String graphName) { + return beginDeleteGremlinGraphAsync(resourceGroupName, accountName, databaseName, graphName).getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDeleteGremlinGraph( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + return beginDeleteGremlinGraphAsync(resourceGroupName, accountName, databaseName, graphName, context) + .getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteGremlinGraphAsync( + String resourceGroupName, String accountName, String databaseName, String graphName) { + return beginDeleteGremlinGraphAsync(resourceGroupName, accountName, databaseName, graphName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteGremlinGraphAsync( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + return beginDeleteGremlinGraphAsync(resourceGroupName, accountName, databaseName, graphName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteGremlinGraph( + String resourceGroupName, String accountName, String databaseName, String graphName) { + deleteGremlinGraphAsync(resourceGroupName, accountName, databaseName, graphName).block(); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteGremlinGraph( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + deleteGremlinGraphAsync(resourceGroupName, accountName, databaseName, graphName, context).block(); + } + + /** + * Gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getGremlinGraphThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String graphName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (graphName == null) { + return Mono.error(new IllegalArgumentException("Parameter graphName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getGremlinGraphThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + graphName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getGremlinGraphThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (graphName == null) { + return Mono.error(new IllegalArgumentException("Parameter graphName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getGremlinGraphThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + graphName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getGremlinGraphThroughputAsync( + String resourceGroupName, String accountName, String databaseName, String graphName) { + return getGremlinGraphThroughputWithResponseAsync(resourceGroupName, accountName, databaseName, graphName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner getGremlinGraphThroughput( + String resourceGroupName, String accountName, String databaseName, String graphName) { + return getGremlinGraphThroughputAsync(resourceGroupName, accountName, databaseName, graphName).block(); + } + + /** + * Gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getGremlinGraphThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + return getGremlinGraphThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, graphName, context) + .block(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin graph. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateGremlinGraphThroughputWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (graphName == null) { + return Mono.error(new IllegalArgumentException("Parameter graphName is required and cannot be null.")); + } + if (updateThroughputParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter updateThroughputParameters is required and cannot be null.")); + } else { + updateThroughputParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateGremlinGraphThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + graphName, + this.client.getApiVersion(), + updateThroughputParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin graph. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateGremlinGraphThroughputWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (graphName == null) { + return Mono.error(new IllegalArgumentException("Parameter graphName is required and cannot be null.")); + } + if (updateThroughputParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter updateThroughputParameters is required and cannot be null.")); + } else { + updateThroughputParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateGremlinGraphThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + graphName, + this.client.getApiVersion(), + updateThroughputParameters, + accept, + context); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin graph. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginUpdateGremlinGraphThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + Mono>> mono = + updateGremlinGraphThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin graph. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginUpdateGremlinGraphThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateGremlinGraphThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin graph. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateGremlinGraphThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateGremlinGraphThroughputAsync( + resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters) + .getSyncPoller(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin graph. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateGremlinGraphThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return beginUpdateGremlinGraphThroughputAsync( + resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters, context) + .getSyncPoller(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin graph. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateGremlinGraphThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateGremlinGraphThroughputAsync( + resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin graph. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateGremlinGraphThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return beginUpdateGremlinGraphThroughputAsync( + resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin graph. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner updateGremlinGraphThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return updateGremlinGraphThroughputAsync( + resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters) + .block(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin graph. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner updateGremlinGraphThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return updateGremlinGraphThroughputAsync( + resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters, context) + .block(); + } + + /** + * Migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateGremlinGraphToAutoscaleWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String graphName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (graphName == null) { + return Mono.error(new IllegalArgumentException("Parameter graphName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateGremlinGraphToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + graphName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateGremlinGraphToAutoscaleWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (graphName == null) { + return Mono.error(new IllegalArgumentException("Parameter graphName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateGremlinGraphToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + graphName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateGremlinGraphToAutoscaleAsync( + String resourceGroupName, String accountName, String databaseName, String graphName) { + Mono>> mono = + migrateGremlinGraphToAutoscaleWithResponseAsync(resourceGroupName, accountName, databaseName, graphName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * Migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateGremlinGraphToAutoscaleAsync( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + migrateGremlinGraphToAutoscaleWithResponseAsync( + resourceGroupName, accountName, databaseName, graphName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * Migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateGremlinGraphToAutoscale( + String resourceGroupName, String accountName, String databaseName, String graphName) { + return beginMigrateGremlinGraphToAutoscaleAsync(resourceGroupName, accountName, databaseName, graphName) + .getSyncPoller(); + } + + /** + * Migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateGremlinGraphToAutoscale( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + return beginMigrateGremlinGraphToAutoscaleAsync( + resourceGroupName, accountName, databaseName, graphName, context) + .getSyncPoller(); + } + + /** + * Migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateGremlinGraphToAutoscaleAsync( + String resourceGroupName, String accountName, String databaseName, String graphName) { + return beginMigrateGremlinGraphToAutoscaleAsync(resourceGroupName, accountName, databaseName, graphName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateGremlinGraphToAutoscaleAsync( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + return beginMigrateGremlinGraphToAutoscaleAsync( + resourceGroupName, accountName, databaseName, graphName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateGremlinGraphToAutoscale( + String resourceGroupName, String accountName, String databaseName, String graphName) { + return migrateGremlinGraphToAutoscaleAsync(resourceGroupName, accountName, databaseName, graphName).block(); + } + + /** + * Migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateGremlinGraphToAutoscale( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + return migrateGremlinGraphToAutoscaleAsync(resourceGroupName, accountName, databaseName, graphName, context) + .block(); + } + + /** + * Migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateGremlinGraphToManualThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String graphName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (graphName == null) { + return Mono.error(new IllegalArgumentException("Parameter graphName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateGremlinGraphToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + graphName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateGremlinGraphToManualThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (graphName == null) { + return Mono.error(new IllegalArgumentException("Parameter graphName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateGremlinGraphToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + graphName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateGremlinGraphToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName, String graphName) { + Mono>> mono = + migrateGremlinGraphToManualThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, graphName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * Migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateGremlinGraphToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + migrateGremlinGraphToManualThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, graphName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * Migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateGremlinGraphToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String graphName) { + return beginMigrateGremlinGraphToManualThroughputAsync(resourceGroupName, accountName, databaseName, graphName) + .getSyncPoller(); + } + + /** + * Migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateGremlinGraphToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + return beginMigrateGremlinGraphToManualThroughputAsync( + resourceGroupName, accountName, databaseName, graphName, context) + .getSyncPoller(); + } + + /** + * Migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateGremlinGraphToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName, String graphName) { + return beginMigrateGremlinGraphToManualThroughputAsync(resourceGroupName, accountName, databaseName, graphName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateGremlinGraphToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + return beginMigrateGremlinGraphToManualThroughputAsync( + resourceGroupName, accountName, databaseName, graphName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateGremlinGraphToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String graphName) { + return migrateGremlinGraphToManualThroughputAsync(resourceGroupName, accountName, databaseName, graphName) + .block(); + } + + /** + * Migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateGremlinGraphToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + return migrateGremlinGraphToManualThroughputAsync( + resourceGroupName, accountName, databaseName, graphName, context) + .block(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/GremlinResourcesImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/GremlinResourcesImpl.java new file mode 100644 index 0000000000000..cf1ac30d1f523 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/GremlinResourcesImpl.java @@ -0,0 +1,653 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.GremlinResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.GremlinDatabaseGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.GremlinGraphGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ThroughputSettingsGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.GremlinDatabaseGetResults; +import com.azure.resourcemanager.cosmos.generated.models.GremlinGraphGetResults; +import com.azure.resourcemanager.cosmos.generated.models.GremlinResources; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsGetResults; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class GremlinResourcesImpl implements GremlinResources { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GremlinResourcesImpl.class); + + private final GremlinResourcesClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public GremlinResourcesImpl( + GremlinResourcesClient innerClient, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listGremlinDatabases(String resourceGroupName, String accountName) { + PagedIterable inner = + this.serviceClient().listGremlinDatabases(resourceGroupName, accountName); + return Utils.mapPage(inner, inner1 -> new GremlinDatabaseGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listGremlinDatabases( + String resourceGroupName, String accountName, Context context) { + PagedIterable inner = + this.serviceClient().listGremlinDatabases(resourceGroupName, accountName, context); + return Utils.mapPage(inner, inner1 -> new GremlinDatabaseGetResultsImpl(inner1, this.manager())); + } + + public GremlinDatabaseGetResults getGremlinDatabase( + String resourceGroupName, String accountName, String databaseName) { + GremlinDatabaseGetResultsInner inner = + this.serviceClient().getGremlinDatabase(resourceGroupName, accountName, databaseName); + if (inner != null) { + return new GremlinDatabaseGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getGremlinDatabaseWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context) { + Response inner = + this.serviceClient().getGremlinDatabaseWithResponse(resourceGroupName, accountName, databaseName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new GremlinDatabaseGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteGremlinDatabase(String resourceGroupName, String accountName, String databaseName) { + this.serviceClient().deleteGremlinDatabase(resourceGroupName, accountName, databaseName); + } + + public void deleteGremlinDatabase( + String resourceGroupName, String accountName, String databaseName, Context context) { + this.serviceClient().deleteGremlinDatabase(resourceGroupName, accountName, databaseName, context); + } + + public ThroughputSettingsGetResults getGremlinDatabaseThroughput( + String resourceGroupName, String accountName, String databaseName) { + ThroughputSettingsGetResultsInner inner = + this.serviceClient().getGremlinDatabaseThroughput(resourceGroupName, accountName, databaseName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getGremlinDatabaseThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context) { + Response inner = + this + .serviceClient() + .getGremlinDatabaseThroughputWithResponse(resourceGroupName, accountName, databaseName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ThroughputSettingsGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ThroughputSettingsGetResults updateGremlinDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .updateGremlinDatabaseThroughput( + resourceGroupName, accountName, databaseName, updateThroughputParameters); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults updateGremlinDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .updateGremlinDatabaseThroughput( + resourceGroupName, accountName, databaseName, updateThroughputParameters, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateGremlinDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName) { + ThroughputSettingsGetResultsInner inner = + this.serviceClient().migrateGremlinDatabaseToAutoscale(resourceGroupName, accountName, databaseName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateGremlinDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName, Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateGremlinDatabaseToAutoscale(resourceGroupName, accountName, databaseName, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateGremlinDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName) { + ThroughputSettingsGetResultsInner inner = + this.serviceClient().migrateGremlinDatabaseToManualThroughput(resourceGroupName, accountName, databaseName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateGremlinDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName, Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateGremlinDatabaseToManualThroughput(resourceGroupName, accountName, databaseName, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listGremlinGraphs( + String resourceGroupName, String accountName, String databaseName) { + PagedIterable inner = + this.serviceClient().listGremlinGraphs(resourceGroupName, accountName, databaseName); + return Utils.mapPage(inner, inner1 -> new GremlinGraphGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listGremlinGraphs( + String resourceGroupName, String accountName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listGremlinGraphs(resourceGroupName, accountName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new GremlinGraphGetResultsImpl(inner1, this.manager())); + } + + public GremlinGraphGetResults getGremlinGraph( + String resourceGroupName, String accountName, String databaseName, String graphName) { + GremlinGraphGetResultsInner inner = + this.serviceClient().getGremlinGraph(resourceGroupName, accountName, databaseName, graphName); + if (inner != null) { + return new GremlinGraphGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getGremlinGraphWithResponse( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + Response inner = + this + .serviceClient() + .getGremlinGraphWithResponse(resourceGroupName, accountName, databaseName, graphName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new GremlinGraphGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteGremlinGraph( + String resourceGroupName, String accountName, String databaseName, String graphName) { + this.serviceClient().deleteGremlinGraph(resourceGroupName, accountName, databaseName, graphName); + } + + public void deleteGremlinGraph( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + this.serviceClient().deleteGremlinGraph(resourceGroupName, accountName, databaseName, graphName, context); + } + + public ThroughputSettingsGetResults getGremlinGraphThroughput( + String resourceGroupName, String accountName, String databaseName, String graphName) { + ThroughputSettingsGetResultsInner inner = + this.serviceClient().getGremlinGraphThroughput(resourceGroupName, accountName, databaseName, graphName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getGremlinGraphThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + Response inner = + this + .serviceClient() + .getGremlinGraphThroughputWithResponse( + resourceGroupName, accountName, databaseName, graphName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ThroughputSettingsGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ThroughputSettingsGetResults updateGremlinGraphThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .updateGremlinGraphThroughput( + resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults updateGremlinGraphThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .updateGremlinGraphThroughput( + resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateGremlinGraphToAutoscale( + String resourceGroupName, String accountName, String databaseName, String graphName) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateGremlinGraphToAutoscale(resourceGroupName, accountName, databaseName, graphName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateGremlinGraphToAutoscale( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateGremlinGraphToAutoscale(resourceGroupName, accountName, databaseName, graphName, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateGremlinGraphToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String graphName) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateGremlinGraphToManualThroughput(resourceGroupName, accountName, databaseName, graphName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateGremlinGraphToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateGremlinGraphToManualThroughput( + resourceGroupName, accountName, databaseName, graphName, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public GremlinDatabaseGetResults getGremlinDatabaseById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "gremlinDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'gremlinDatabases'.", id))); + } + return this + .getGremlinDatabaseWithResponse(resourceGroupName, accountName, databaseName, Context.NONE) + .getValue(); + } + + public Response getGremlinDatabaseByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "gremlinDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'gremlinDatabases'.", id))); + } + return this.getGremlinDatabaseWithResponse(resourceGroupName, accountName, databaseName, context); + } + + public GremlinGraphGetResults getGremlinGraphById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "gremlinDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'gremlinDatabases'.", id))); + } + String graphName = Utils.getValueFromIdByName(id, "graphs"); + if (graphName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'graphs'.", id))); + } + return this + .getGremlinGraphWithResponse(resourceGroupName, accountName, databaseName, graphName, Context.NONE) + .getValue(); + } + + public Response getGremlinGraphByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "gremlinDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'gremlinDatabases'.", id))); + } + String graphName = Utils.getValueFromIdByName(id, "graphs"); + if (graphName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'graphs'.", id))); + } + return this.getGremlinGraphWithResponse(resourceGroupName, accountName, databaseName, graphName, context); + } + + public void deleteGremlinDatabaseById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "gremlinDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'gremlinDatabases'.", id))); + } + this.deleteGremlinDatabase(resourceGroupName, accountName, databaseName, Context.NONE); + } + + public void deleteGremlinDatabaseByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "gremlinDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'gremlinDatabases'.", id))); + } + this.deleteGremlinDatabase(resourceGroupName, accountName, databaseName, context); + } + + public void deleteGremlinGraphById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "gremlinDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'gremlinDatabases'.", id))); + } + String graphName = Utils.getValueFromIdByName(id, "graphs"); + if (graphName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'graphs'.", id))); + } + this.deleteGremlinGraph(resourceGroupName, accountName, databaseName, graphName, Context.NONE); + } + + public void deleteGremlinGraphByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "gremlinDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'gremlinDatabases'.", id))); + } + String graphName = Utils.getValueFromIdByName(id, "graphs"); + if (graphName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'graphs'.", id))); + } + this.deleteGremlinGraph(resourceGroupName, accountName, databaseName, graphName, context); + } + + private GremlinResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + public GremlinDatabaseGetResultsImpl defineUpdateGremlinDatabase(String name) { + return new GremlinDatabaseGetResultsImpl(name, this.manager()); + } + + public GremlinGraphGetResultsImpl defineUpdateGremlinGraph(String name) { + return new GremlinGraphGetResultsImpl(name, this.manager()); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/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..922955a48900d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MongoDBCollectionGetResultsImpl.java @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MongoDBCollectionGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.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 MongoDBCollectionGetResultsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String accountName; + + private String databaseName; + + private String collectionName; + + private MongoDBCollectionCreateUpdateParameters createCreateUpdateMongoDBCollectionParameters; + + private MongoDBCollectionCreateUpdateParameters updateCreateUpdateMongoDBCollectionParameters; + + public MongoDBCollectionGetResultsImpl withExistingMongodbDatabase( + String resourceGroupName, String accountName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + this.databaseName = databaseName; + return this; + } + + public MongoDBCollectionGetResults create() { + this.innerObject = + serviceManager + .serviceClient() + .getMongoDBResources() + .createUpdateMongoDBCollection( + resourceGroupName, + accountName, + databaseName, + collectionName, + createCreateUpdateMongoDBCollectionParameters, + Context.NONE); + return this; + } + + public MongoDBCollectionGetResults create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getMongoDBResources() + .createUpdateMongoDBCollection( + resourceGroupName, + accountName, + databaseName, + collectionName, + createCreateUpdateMongoDBCollectionParameters, + context); + return this; + } + + MongoDBCollectionGetResultsImpl( + String name, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = new MongoDBCollectionGetResultsInner(); + this.serviceManager = serviceManager; + this.collectionName = name; + this.createCreateUpdateMongoDBCollectionParameters = new MongoDBCollectionCreateUpdateParameters(); + } + + public MongoDBCollectionGetResultsImpl update() { + this.updateCreateUpdateMongoDBCollectionParameters = new MongoDBCollectionCreateUpdateParameters(); + return this; + } + + public MongoDBCollectionGetResults apply() { + this.innerObject = + serviceManager + .serviceClient() + .getMongoDBResources() + .createUpdateMongoDBCollection( + resourceGroupName, + accountName, + databaseName, + collectionName, + updateCreateUpdateMongoDBCollectionParameters, + Context.NONE); + return this; + } + + public MongoDBCollectionGetResults apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getMongoDBResources() + .createUpdateMongoDBCollection( + resourceGroupName, + accountName, + databaseName, + collectionName, + updateCreateUpdateMongoDBCollectionParameters, + context); + return this; + } + + MongoDBCollectionGetResultsImpl( + MongoDBCollectionGetResultsInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "mongodbDatabases"); + this.collectionName = Utils.getValueFromIdByName(innerObject.id(), "collections"); + } + + public MongoDBCollectionGetResults refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getMongoDBResources() + .getMongoDBCollectionWithResponse( + resourceGroupName, accountName, databaseName, collectionName, Context.NONE) + .getValue(); + return this; + } + + public MongoDBCollectionGetResults refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getMongoDBResources() + .getMongoDBCollectionWithResponse(resourceGroupName, accountName, databaseName, collectionName, context) + .getValue(); + return this; + } + + public MongoDBCollectionGetResultsImpl withRegion(Region location) { + this.createCreateUpdateMongoDBCollectionParameters.withLocation(location.toString()); + return this; + } + + public MongoDBCollectionGetResultsImpl withRegion(String location) { + this.createCreateUpdateMongoDBCollectionParameters.withLocation(location); + return this; + } + + public MongoDBCollectionGetResultsImpl withResource(MongoDBCollectionResource resource) { + if (isInCreateMode()) { + this.createCreateUpdateMongoDBCollectionParameters.withResource(resource); + return this; + } else { + this.updateCreateUpdateMongoDBCollectionParameters.withResource(resource); + return this; + } + } + + public MongoDBCollectionGetResultsImpl withTags(Map tags) { + if (isInCreateMode()) { + this.createCreateUpdateMongoDBCollectionParameters.withTags(tags); + return this; + } else { + this.updateCreateUpdateMongoDBCollectionParameters.withTags(tags); + return this; + } + } + + public MongoDBCollectionGetResultsImpl 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..19e4145daeeb1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MongoDBDatabaseGetResultsImpl.java @@ -0,0 +1,224 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.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 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..aafac33e76ca7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MongoDBResourcesClientImpl.java @@ -0,0 +1,4557 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.cosmos.generated.fluent.MongoDBResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MongoDBCollectionGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MongoDBDatabaseGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ThroughputSettingsGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBCollectionCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBCollectionListResult; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBDatabaseCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBDatabaseListResult; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in MongoDBResourcesClient. */ +public final class MongoDBResourcesClientImpl implements MongoDBResourcesClient { + private final ClientLogger logger = new ClientLogger(MongoDBResourcesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final MongoDBResourcesService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of MongoDBResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MongoDBResourcesClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy.create(MongoDBResourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientMongoDBResources to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface MongoDBResourcesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/mongodbDatabases") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMongoDBDatabases( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getMongoDBDatabase( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createUpdateMongoDBDatabase( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") MongoDBDatabaseCreateUpdateParameters createUpdateMongoDBDatabaseParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> deleteMongoDBDatabase( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getMongoDBDatabaseThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> updateMongoDBDatabaseThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ThroughputSettingsUpdateParameters updateThroughputParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default" + + "/migrateToAutoscale") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> migrateMongoDBDatabaseToAutoscale( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default" + + "/migrateToManualThroughput") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> migrateMongoDBDatabaseToManualThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMongoDBCollections( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getMongoDBCollection( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("collectionName") String collectionName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createUpdateMongoDBCollection( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("collectionName") String collectionName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") + MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> deleteMongoDBCollection( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("collectionName") String collectionName, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}" + + "/throughputSettings/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getMongoDBCollectionThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("collectionName") String collectionName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}" + + "/throughputSettings/default") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> updateMongoDBCollectionThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("collectionName") String collectionName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ThroughputSettingsUpdateParameters updateThroughputParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}" + + "/throughputSettings/default/migrateToAutoscale") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> migrateMongoDBCollectionToAutoscale( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("collectionName") String collectionName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}" + + "/throughputSettings/default/migrateToManualThroughput") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> migrateMongoDBCollectionToManualThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("collectionName") String collectionName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the MongoDB databases under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the MongoDB databases and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMongoDBDatabasesSinglePageAsync( + String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMongoDBDatabases( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the MongoDB databases under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the MongoDB databases and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMongoDBDatabasesSinglePageAsync( + String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMongoDBDatabases( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Lists the MongoDB databases under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the MongoDB databases and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMongoDBDatabasesAsync( + String resourceGroupName, String accountName) { + return new PagedFlux<>(() -> listMongoDBDatabasesSinglePageAsync(resourceGroupName, accountName)); + } + + /** + * Lists the MongoDB databases under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the MongoDB databases and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMongoDBDatabasesAsync( + String resourceGroupName, String accountName, Context context) { + return new PagedFlux<>(() -> listMongoDBDatabasesSinglePageAsync(resourceGroupName, accountName, context)); + } + + /** + * Lists the MongoDB databases under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the MongoDB databases and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMongoDBDatabases( + String resourceGroupName, String accountName) { + return new PagedIterable<>(listMongoDBDatabasesAsync(resourceGroupName, accountName)); + } + + /** + * Lists the MongoDB databases under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the MongoDB databases and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMongoDBDatabases( + String resourceGroupName, String accountName, Context context) { + return new PagedIterable<>(listMongoDBDatabasesAsync(resourceGroupName, accountName, context)); + } + + /** + * Gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getMongoDBDatabaseWithResponseAsync( + String resourceGroupName, String accountName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getMongoDBDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getMongoDBDatabaseWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getMongoDBDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getMongoDBDatabaseAsync( + String resourceGroupName, String accountName, String databaseName) { + return getMongoDBDatabaseWithResponseAsync(resourceGroupName, accountName, databaseName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MongoDBDatabaseGetResultsInner getMongoDBDatabase( + String resourceGroupName, String accountName, String databaseName) { + return getMongoDBDatabaseAsync(resourceGroupName, accountName, databaseName).block(); + } + + /** + * Gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getMongoDBDatabaseWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context) { + return getMongoDBDatabaseWithResponseAsync(resourceGroupName, accountName, databaseName, context).block(); + } + + /** + * Create or updates Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateMongoDBDatabaseParameters The parameters to provide for the current MongoDB database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateMongoDBDatabaseWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + MongoDBDatabaseCreateUpdateParameters createUpdateMongoDBDatabaseParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (createUpdateMongoDBDatabaseParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateMongoDBDatabaseParameters is required and cannot be null.")); + } else { + createUpdateMongoDBDatabaseParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createUpdateMongoDBDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + createUpdateMongoDBDatabaseParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or updates Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateMongoDBDatabaseParameters The parameters to provide for the current MongoDB database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateMongoDBDatabaseWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + MongoDBDatabaseCreateUpdateParameters createUpdateMongoDBDatabaseParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (createUpdateMongoDBDatabaseParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateMongoDBDatabaseParameters is required and cannot be null.")); + } else { + createUpdateMongoDBDatabaseParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createUpdateMongoDBDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + createUpdateMongoDBDatabaseParameters, + accept, + context); + } + + /** + * Create or updates Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateMongoDBDatabaseParameters The parameters to provide for the current MongoDB database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, MongoDBDatabaseGetResultsInner> + beginCreateUpdateMongoDBDatabaseAsync( + String resourceGroupName, + String accountName, + String databaseName, + MongoDBDatabaseCreateUpdateParameters createUpdateMongoDBDatabaseParameters) { + Mono>> mono = + createUpdateMongoDBDatabaseWithResponseAsync( + resourceGroupName, accountName, databaseName, createUpdateMongoDBDatabaseParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + MongoDBDatabaseGetResultsInner.class, + MongoDBDatabaseGetResultsInner.class, + Context.NONE); + } + + /** + * Create or updates Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateMongoDBDatabaseParameters The parameters to provide for the current MongoDB database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, MongoDBDatabaseGetResultsInner> + beginCreateUpdateMongoDBDatabaseAsync( + String resourceGroupName, + String accountName, + String databaseName, + MongoDBDatabaseCreateUpdateParameters createUpdateMongoDBDatabaseParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createUpdateMongoDBDatabaseWithResponseAsync( + resourceGroupName, accountName, databaseName, createUpdateMongoDBDatabaseParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + MongoDBDatabaseGetResultsInner.class, + MongoDBDatabaseGetResultsInner.class, + context); + } + + /** + * Create or updates Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateMongoDBDatabaseParameters The parameters to provide for the current MongoDB database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, MongoDBDatabaseGetResultsInner> + beginCreateUpdateMongoDBDatabase( + String resourceGroupName, + String accountName, + String databaseName, + MongoDBDatabaseCreateUpdateParameters createUpdateMongoDBDatabaseParameters) { + return beginCreateUpdateMongoDBDatabaseAsync( + resourceGroupName, accountName, databaseName, createUpdateMongoDBDatabaseParameters) + .getSyncPoller(); + } + + /** + * Create or updates Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateMongoDBDatabaseParameters The parameters to provide for the current MongoDB database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, MongoDBDatabaseGetResultsInner> + beginCreateUpdateMongoDBDatabase( + String resourceGroupName, + String accountName, + String databaseName, + MongoDBDatabaseCreateUpdateParameters createUpdateMongoDBDatabaseParameters, + Context context) { + return beginCreateUpdateMongoDBDatabaseAsync( + resourceGroupName, accountName, databaseName, createUpdateMongoDBDatabaseParameters, context) + .getSyncPoller(); + } + + /** + * Create or updates Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateMongoDBDatabaseParameters The parameters to provide for the current MongoDB database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateMongoDBDatabaseAsync( + String resourceGroupName, + String accountName, + String databaseName, + MongoDBDatabaseCreateUpdateParameters createUpdateMongoDBDatabaseParameters) { + return beginCreateUpdateMongoDBDatabaseAsync( + resourceGroupName, accountName, databaseName, createUpdateMongoDBDatabaseParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or updates Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateMongoDBDatabaseParameters The parameters to provide for the current MongoDB database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateMongoDBDatabaseAsync( + String resourceGroupName, + String accountName, + String databaseName, + MongoDBDatabaseCreateUpdateParameters createUpdateMongoDBDatabaseParameters, + Context context) { + return beginCreateUpdateMongoDBDatabaseAsync( + resourceGroupName, accountName, databaseName, createUpdateMongoDBDatabaseParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or updates Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateMongoDBDatabaseParameters The parameters to provide for the current MongoDB database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MongoDBDatabaseGetResultsInner createUpdateMongoDBDatabase( + String resourceGroupName, + String accountName, + String databaseName, + MongoDBDatabaseCreateUpdateParameters createUpdateMongoDBDatabaseParameters) { + return createUpdateMongoDBDatabaseAsync( + resourceGroupName, accountName, databaseName, createUpdateMongoDBDatabaseParameters) + .block(); + } + + /** + * Create or updates Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateMongoDBDatabaseParameters The parameters to provide for the current MongoDB database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MongoDBDatabaseGetResultsInner createUpdateMongoDBDatabase( + String resourceGroupName, + String accountName, + String databaseName, + MongoDBDatabaseCreateUpdateParameters createUpdateMongoDBDatabaseParameters, + Context context) { + return createUpdateMongoDBDatabaseAsync( + resourceGroupName, accountName, databaseName, createUpdateMongoDBDatabaseParameters, context) + .block(); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteMongoDBDatabaseWithResponseAsync( + String resourceGroupName, String accountName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .deleteMongoDBDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteMongoDBDatabaseWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + context = this.client.mergeContext(context); + return service + .deleteMongoDBDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + context); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteMongoDBDatabaseAsync( + String resourceGroupName, String accountName, String databaseName) { + Mono>> mono = + deleteMongoDBDatabaseWithResponseAsync(resourceGroupName, accountName, databaseName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteMongoDBDatabaseAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteMongoDBDatabaseWithResponseAsync(resourceGroupName, accountName, databaseName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDeleteMongoDBDatabase( + String resourceGroupName, String accountName, String databaseName) { + return beginDeleteMongoDBDatabaseAsync(resourceGroupName, accountName, databaseName).getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDeleteMongoDBDatabase( + String resourceGroupName, String accountName, String databaseName, Context context) { + return beginDeleteMongoDBDatabaseAsync(resourceGroupName, accountName, databaseName, context).getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteMongoDBDatabaseAsync(String resourceGroupName, String accountName, String databaseName) { + return beginDeleteMongoDBDatabaseAsync(resourceGroupName, accountName, databaseName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteMongoDBDatabaseAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + return beginDeleteMongoDBDatabaseAsync(resourceGroupName, accountName, databaseName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteMongoDBDatabase(String resourceGroupName, String accountName, String databaseName) { + deleteMongoDBDatabaseAsync(resourceGroupName, accountName, databaseName).block(); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteMongoDBDatabase( + String resourceGroupName, String accountName, String databaseName, Context context) { + deleteMongoDBDatabaseAsync(resourceGroupName, accountName, databaseName, context).block(); + } + + /** + * Gets the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account with the + * provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getMongoDBDatabaseThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getMongoDBDatabaseThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account with the + * provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getMongoDBDatabaseThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getMongoDBDatabaseThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account with the + * provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getMongoDBDatabaseThroughputAsync( + String resourceGroupName, String accountName, String databaseName) { + return getMongoDBDatabaseThroughputWithResponseAsync(resourceGroupName, accountName, databaseName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account with the + * provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner getMongoDBDatabaseThroughput( + String resourceGroupName, String accountName, String databaseName) { + return getMongoDBDatabaseThroughputAsync(resourceGroupName, accountName, databaseName).block(); + } + + /** + * Gets the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account with the + * provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getMongoDBDatabaseThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context) { + return getMongoDBDatabaseThroughputWithResponseAsync(resourceGroupName, accountName, databaseName, context) + .block(); + } + + /** + * Update RUs per second of the an Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateMongoDBDatabaseThroughputWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (updateThroughputParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter updateThroughputParameters is required and cannot be null.")); + } else { + updateThroughputParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateMongoDBDatabaseThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + updateThroughputParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update RUs per second of the an Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateMongoDBDatabaseThroughputWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (updateThroughputParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter updateThroughputParameters is required and cannot be null.")); + } else { + updateThroughputParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateMongoDBDatabaseThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + updateThroughputParameters, + accept, + context); + } + + /** + * Update RUs per second of the an Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginUpdateMongoDBDatabaseThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + Mono>> mono = + updateMongoDBDatabaseThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * Update RUs per second of the an Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginUpdateMongoDBDatabaseThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateMongoDBDatabaseThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * Update RUs per second of the an Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateMongoDBDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateMongoDBDatabaseThroughputAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters) + .getSyncPoller(); + } + + /** + * Update RUs per second of the an Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateMongoDBDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return beginUpdateMongoDBDatabaseThroughputAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters, context) + .getSyncPoller(); + } + + /** + * Update RUs per second of the an Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateMongoDBDatabaseThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateMongoDBDatabaseThroughputAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update RUs per second of the an Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateMongoDBDatabaseThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return beginUpdateMongoDBDatabaseThroughputAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update RUs per second of the an Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner updateMongoDBDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return updateMongoDBDatabaseThroughputAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters) + .block(); + } + + /** + * Update RUs per second of the an Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner updateMongoDBDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return updateMongoDBDatabaseThroughputAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters, context) + .block(); + } + + /** + * Migrate an Azure Cosmos DB MongoDB database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateMongoDBDatabaseToAutoscaleWithResponseAsync( + String resourceGroupName, String accountName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateMongoDBDatabaseToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Migrate an Azure Cosmos DB MongoDB database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateMongoDBDatabaseToAutoscaleWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateMongoDBDatabaseToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Migrate an Azure Cosmos DB MongoDB database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBDatabaseToAutoscaleAsync(String resourceGroupName, String accountName, String databaseName) { + Mono>> mono = + migrateMongoDBDatabaseToAutoscaleWithResponseAsync(resourceGroupName, accountName, databaseName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * Migrate an Azure Cosmos DB MongoDB database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBDatabaseToAutoscaleAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + migrateMongoDBDatabaseToAutoscaleWithResponseAsync(resourceGroupName, accountName, databaseName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * Migrate an Azure Cosmos DB MongoDB database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBDatabaseToAutoscale(String resourceGroupName, String accountName, String databaseName) { + return beginMigrateMongoDBDatabaseToAutoscaleAsync(resourceGroupName, accountName, databaseName) + .getSyncPoller(); + } + + /** + * Migrate an Azure Cosmos DB MongoDB database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName, Context context) { + return beginMigrateMongoDBDatabaseToAutoscaleAsync(resourceGroupName, accountName, databaseName, context) + .getSyncPoller(); + } + + /** + * Migrate an Azure Cosmos DB MongoDB database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateMongoDBDatabaseToAutoscaleAsync( + String resourceGroupName, String accountName, String databaseName) { + return beginMigrateMongoDBDatabaseToAutoscaleAsync(resourceGroupName, accountName, databaseName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Migrate an Azure Cosmos DB MongoDB database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateMongoDBDatabaseToAutoscaleAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + return beginMigrateMongoDBDatabaseToAutoscaleAsync(resourceGroupName, accountName, databaseName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Migrate an Azure Cosmos DB MongoDB database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateMongoDBDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName) { + return migrateMongoDBDatabaseToAutoscaleAsync(resourceGroupName, accountName, databaseName).block(); + } + + /** + * Migrate an Azure Cosmos DB MongoDB database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateMongoDBDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName, Context context) { + return migrateMongoDBDatabaseToAutoscaleAsync(resourceGroupName, accountName, databaseName, context).block(); + } + + /** + * Migrate an Azure Cosmos DB MongoDB database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateMongoDBDatabaseToManualThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateMongoDBDatabaseToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Migrate an Azure Cosmos DB MongoDB database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateMongoDBDatabaseToManualThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateMongoDBDatabaseToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Migrate an Azure Cosmos DB MongoDB database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBDatabaseToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName) { + Mono>> mono = + migrateMongoDBDatabaseToManualThroughputWithResponseAsync(resourceGroupName, accountName, databaseName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * Migrate an Azure Cosmos DB MongoDB database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBDatabaseToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + migrateMongoDBDatabaseToManualThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * Migrate an Azure Cosmos DB MongoDB database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName) { + return beginMigrateMongoDBDatabaseToManualThroughputAsync(resourceGroupName, accountName, databaseName) + .getSyncPoller(); + } + + /** + * Migrate an Azure Cosmos DB MongoDB database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName, Context context) { + return beginMigrateMongoDBDatabaseToManualThroughputAsync(resourceGroupName, accountName, databaseName, context) + .getSyncPoller(); + } + + /** + * Migrate an Azure Cosmos DB MongoDB database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateMongoDBDatabaseToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName) { + return beginMigrateMongoDBDatabaseToManualThroughputAsync(resourceGroupName, accountName, databaseName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Migrate an Azure Cosmos DB MongoDB database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateMongoDBDatabaseToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + return beginMigrateMongoDBDatabaseToManualThroughputAsync(resourceGroupName, accountName, databaseName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Migrate an Azure Cosmos DB MongoDB database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateMongoDBDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName) { + return migrateMongoDBDatabaseToManualThroughputAsync(resourceGroupName, accountName, databaseName).block(); + } + + /** + * Migrate an Azure Cosmos DB MongoDB database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateMongoDBDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName, Context context) { + return migrateMongoDBDatabaseToManualThroughputAsync(resourceGroupName, accountName, databaseName, context) + .block(); + } + + /** + * Lists the MongoDB collection under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the MongoDB collections and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMongoDBCollectionsSinglePageAsync( + String resourceGroupName, String accountName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMongoDBCollections( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the MongoDB collection under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the MongoDB collections and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMongoDBCollectionsSinglePageAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMongoDBCollections( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Lists the MongoDB collection under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the MongoDB collections and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMongoDBCollectionsAsync( + String resourceGroupName, String accountName, String databaseName) { + return new PagedFlux<>( + () -> listMongoDBCollectionsSinglePageAsync(resourceGroupName, accountName, databaseName)); + } + + /** + * Lists the MongoDB collection under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the MongoDB collections and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMongoDBCollectionsAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listMongoDBCollectionsSinglePageAsync(resourceGroupName, accountName, databaseName, context)); + } + + /** + * Lists the MongoDB collection under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the MongoDB collections and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMongoDBCollections( + String resourceGroupName, String accountName, String databaseName) { + return new PagedIterable<>(listMongoDBCollectionsAsync(resourceGroupName, accountName, databaseName)); + } + + /** + * Lists the MongoDB collection under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the MongoDB collections and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMongoDBCollections( + String resourceGroupName, String accountName, String databaseName, Context context) { + return new PagedIterable<>(listMongoDBCollectionsAsync(resourceGroupName, accountName, databaseName, context)); + } + + /** + * Gets the MongoDB collection under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the MongoDB collection under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getMongoDBCollectionWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (collectionName == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getMongoDBCollection( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + collectionName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the MongoDB collection under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the MongoDB collection under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getMongoDBCollectionWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (collectionName == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getMongoDBCollection( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + collectionName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the MongoDB collection under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the MongoDB collection under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getMongoDBCollectionAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + return getMongoDBCollectionWithResponseAsync(resourceGroupName, accountName, databaseName, collectionName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the MongoDB collection under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the MongoDB collection under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MongoDBCollectionGetResultsInner getMongoDBCollection( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + return getMongoDBCollectionAsync(resourceGroupName, accountName, databaseName, collectionName).block(); + } + + /** + * Gets the MongoDB collection under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the MongoDB collection under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getMongoDBCollectionWithResponse( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + return getMongoDBCollectionWithResponseAsync( + resourceGroupName, accountName, databaseName, collectionName, context) + .block(); + } + + /** + * Create or update an Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param createUpdateMongoDBCollectionParameters The parameters to provide for the current MongoDB Collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB collection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateMongoDBCollectionWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (collectionName == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionName is required and cannot be null.")); + } + if (createUpdateMongoDBCollectionParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateMongoDBCollectionParameters is required and cannot be null.")); + } else { + createUpdateMongoDBCollectionParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createUpdateMongoDBCollection( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + collectionName, + this.client.getApiVersion(), + createUpdateMongoDBCollectionParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update an Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param createUpdateMongoDBCollectionParameters The parameters to provide for the current MongoDB Collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB collection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateMongoDBCollectionWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (collectionName == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionName is required and cannot be null.")); + } + if (createUpdateMongoDBCollectionParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateMongoDBCollectionParameters is required and cannot be null.")); + } else { + createUpdateMongoDBCollectionParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createUpdateMongoDBCollection( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + collectionName, + this.client.getApiVersion(), + createUpdateMongoDBCollectionParameters, + accept, + context); + } + + /** + * Create or update an Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param createUpdateMongoDBCollectionParameters The parameters to provide for the current MongoDB Collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB collection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, MongoDBCollectionGetResultsInner> + beginCreateUpdateMongoDBCollectionAsync( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters) { + Mono>> mono = + createUpdateMongoDBCollectionWithResponseAsync( + resourceGroupName, accountName, databaseName, collectionName, createUpdateMongoDBCollectionParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + MongoDBCollectionGetResultsInner.class, + MongoDBCollectionGetResultsInner.class, + Context.NONE); + } + + /** + * Create or update an Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param createUpdateMongoDBCollectionParameters The parameters to provide for the current MongoDB Collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB collection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, MongoDBCollectionGetResultsInner> + beginCreateUpdateMongoDBCollectionAsync( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createUpdateMongoDBCollectionWithResponseAsync( + resourceGroupName, + accountName, + databaseName, + collectionName, + createUpdateMongoDBCollectionParameters, + context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + MongoDBCollectionGetResultsInner.class, + MongoDBCollectionGetResultsInner.class, + context); + } + + /** + * Create or update an Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param createUpdateMongoDBCollectionParameters The parameters to provide for the current MongoDB Collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB collection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, MongoDBCollectionGetResultsInner> + beginCreateUpdateMongoDBCollection( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters) { + return beginCreateUpdateMongoDBCollectionAsync( + resourceGroupName, accountName, databaseName, collectionName, createUpdateMongoDBCollectionParameters) + .getSyncPoller(); + } + + /** + * Create or update an Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param createUpdateMongoDBCollectionParameters The parameters to provide for the current MongoDB Collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB collection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, MongoDBCollectionGetResultsInner> + beginCreateUpdateMongoDBCollection( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters, + Context context) { + return beginCreateUpdateMongoDBCollectionAsync( + resourceGroupName, + accountName, + databaseName, + collectionName, + createUpdateMongoDBCollectionParameters, + context) + .getSyncPoller(); + } + + /** + * Create or update an Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param createUpdateMongoDBCollectionParameters The parameters to provide for the current MongoDB Collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB collection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateMongoDBCollectionAsync( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters) { + return beginCreateUpdateMongoDBCollectionAsync( + resourceGroupName, accountName, databaseName, collectionName, createUpdateMongoDBCollectionParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update an Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param createUpdateMongoDBCollectionParameters The parameters to provide for the current MongoDB Collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB collection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateMongoDBCollectionAsync( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters, + Context context) { + return beginCreateUpdateMongoDBCollectionAsync( + resourceGroupName, + accountName, + databaseName, + collectionName, + createUpdateMongoDBCollectionParameters, + context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update an Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param createUpdateMongoDBCollectionParameters The parameters to provide for the current MongoDB Collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB collection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MongoDBCollectionGetResultsInner createUpdateMongoDBCollection( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters) { + return createUpdateMongoDBCollectionAsync( + resourceGroupName, accountName, databaseName, collectionName, createUpdateMongoDBCollectionParameters) + .block(); + } + + /** + * Create or update an Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param createUpdateMongoDBCollectionParameters The parameters to provide for the current MongoDB Collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB collection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MongoDBCollectionGetResultsInner createUpdateMongoDBCollection( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters, + Context context) { + return createUpdateMongoDBCollectionAsync( + resourceGroupName, + accountName, + databaseName, + collectionName, + createUpdateMongoDBCollectionParameters, + context) + .block(); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteMongoDBCollectionWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (collectionName == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .deleteMongoDBCollection( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + collectionName, + this.client.getApiVersion(), + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteMongoDBCollectionWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (collectionName == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionName is required and cannot be null.")); + } + context = this.client.mergeContext(context); + return service + .deleteMongoDBCollection( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + collectionName, + this.client.getApiVersion(), + context); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteMongoDBCollectionAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + Mono>> mono = + deleteMongoDBCollectionWithResponseAsync(resourceGroupName, accountName, databaseName, collectionName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteMongoDBCollectionAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteMongoDBCollectionWithResponseAsync( + resourceGroupName, accountName, databaseName, collectionName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDeleteMongoDBCollection( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + return beginDeleteMongoDBCollectionAsync(resourceGroupName, accountName, databaseName, collectionName) + .getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDeleteMongoDBCollection( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + return beginDeleteMongoDBCollectionAsync(resourceGroupName, accountName, databaseName, collectionName, context) + .getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteMongoDBCollectionAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + return beginDeleteMongoDBCollectionAsync(resourceGroupName, accountName, databaseName, collectionName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteMongoDBCollectionAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + return beginDeleteMongoDBCollectionAsync(resourceGroupName, accountName, databaseName, collectionName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteMongoDBCollection( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + deleteMongoDBCollectionAsync(resourceGroupName, accountName, databaseName, collectionName).block(); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteMongoDBCollection( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + deleteMongoDBCollectionAsync(resourceGroupName, accountName, databaseName, collectionName, context).block(); + } + + /** + * Gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the + * provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getMongoDBCollectionThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (collectionName == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getMongoDBCollectionThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + collectionName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the + * provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getMongoDBCollectionThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (collectionName == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getMongoDBCollectionThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + collectionName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the + * provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getMongoDBCollectionThroughputAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + return getMongoDBCollectionThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, collectionName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the + * provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner getMongoDBCollectionThroughput( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + return getMongoDBCollectionThroughputAsync(resourceGroupName, accountName, databaseName, collectionName) + .block(); + } + + /** + * Gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the + * provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getMongoDBCollectionThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + return getMongoDBCollectionThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, collectionName, context) + .block(); + } + + /** + * Update the RUs per second of an Azure Cosmos DB MongoDB collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateMongoDBCollectionThroughputWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (collectionName == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionName is required and cannot be null.")); + } + if (updateThroughputParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter updateThroughputParameters is required and cannot be null.")); + } else { + updateThroughputParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateMongoDBCollectionThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + collectionName, + this.client.getApiVersion(), + updateThroughputParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update the RUs per second of an Azure Cosmos DB MongoDB collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateMongoDBCollectionThroughputWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (collectionName == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionName is required and cannot be null.")); + } + if (updateThroughputParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter updateThroughputParameters is required and cannot be null.")); + } else { + updateThroughputParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateMongoDBCollectionThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + collectionName, + this.client.getApiVersion(), + updateThroughputParameters, + accept, + context); + } + + /** + * Update the RUs per second of an Azure Cosmos DB MongoDB collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginUpdateMongoDBCollectionThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + Mono>> mono = + updateMongoDBCollectionThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * Update the RUs per second of an Azure Cosmos DB MongoDB collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginUpdateMongoDBCollectionThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateMongoDBCollectionThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * Update the RUs per second of an Azure Cosmos DB MongoDB collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateMongoDBCollectionThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateMongoDBCollectionThroughputAsync( + resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters) + .getSyncPoller(); + } + + /** + * Update the RUs per second of an Azure Cosmos DB MongoDB collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateMongoDBCollectionThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return beginUpdateMongoDBCollectionThroughputAsync( + resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters, context) + .getSyncPoller(); + } + + /** + * Update the RUs per second of an Azure Cosmos DB MongoDB collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateMongoDBCollectionThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateMongoDBCollectionThroughputAsync( + resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update the RUs per second of an Azure Cosmos DB MongoDB collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateMongoDBCollectionThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return beginUpdateMongoDBCollectionThroughputAsync( + resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update the RUs per second of an Azure Cosmos DB MongoDB collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner updateMongoDBCollectionThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return updateMongoDBCollectionThroughputAsync( + resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters) + .block(); + } + + /** + * Update the RUs per second of an Azure Cosmos DB MongoDB collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner updateMongoDBCollectionThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return updateMongoDBCollectionThroughputAsync( + resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters, context) + .block(); + } + + /** + * Migrate an Azure Cosmos DB MongoDB collection from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateMongoDBCollectionToAutoscaleWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (collectionName == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateMongoDBCollectionToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + collectionName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Migrate an Azure Cosmos DB MongoDB collection from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateMongoDBCollectionToAutoscaleWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (collectionName == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateMongoDBCollectionToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + collectionName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Migrate an Azure Cosmos DB MongoDB collection from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBCollectionToAutoscaleAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + Mono>> mono = + migrateMongoDBCollectionToAutoscaleWithResponseAsync( + resourceGroupName, accountName, databaseName, collectionName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * Migrate an Azure Cosmos DB MongoDB collection from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBCollectionToAutoscaleAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + migrateMongoDBCollectionToAutoscaleWithResponseAsync( + resourceGroupName, accountName, databaseName, collectionName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * Migrate an Azure Cosmos DB MongoDB collection from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBCollectionToAutoscale( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + return beginMigrateMongoDBCollectionToAutoscaleAsync( + resourceGroupName, accountName, databaseName, collectionName) + .getSyncPoller(); + } + + /** + * Migrate an Azure Cosmos DB MongoDB collection from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBCollectionToAutoscale( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + return beginMigrateMongoDBCollectionToAutoscaleAsync( + resourceGroupName, accountName, databaseName, collectionName, context) + .getSyncPoller(); + } + + /** + * Migrate an Azure Cosmos DB MongoDB collection from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateMongoDBCollectionToAutoscaleAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + return beginMigrateMongoDBCollectionToAutoscaleAsync( + resourceGroupName, accountName, databaseName, collectionName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Migrate an Azure Cosmos DB MongoDB collection from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateMongoDBCollectionToAutoscaleAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + return beginMigrateMongoDBCollectionToAutoscaleAsync( + resourceGroupName, accountName, databaseName, collectionName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Migrate an Azure Cosmos DB MongoDB collection from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateMongoDBCollectionToAutoscale( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + return migrateMongoDBCollectionToAutoscaleAsync(resourceGroupName, accountName, databaseName, collectionName) + .block(); + } + + /** + * Migrate an Azure Cosmos DB MongoDB collection from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateMongoDBCollectionToAutoscale( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + return migrateMongoDBCollectionToAutoscaleAsync( + resourceGroupName, accountName, databaseName, collectionName, context) + .block(); + } + + /** + * Migrate an Azure Cosmos DB MongoDB collection from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateMongoDBCollectionToManualThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (collectionName == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateMongoDBCollectionToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + collectionName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Migrate an Azure Cosmos DB MongoDB collection from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateMongoDBCollectionToManualThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (collectionName == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateMongoDBCollectionToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + collectionName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Migrate an Azure Cosmos DB MongoDB collection from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBCollectionToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + Mono>> mono = + migrateMongoDBCollectionToManualThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, collectionName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * Migrate an Azure Cosmos DB MongoDB collection from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBCollectionToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + migrateMongoDBCollectionToManualThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, collectionName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * Migrate an Azure Cosmos DB MongoDB collection from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBCollectionToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + return beginMigrateMongoDBCollectionToManualThroughputAsync( + resourceGroupName, accountName, databaseName, collectionName) + .getSyncPoller(); + } + + /** + * Migrate an Azure Cosmos DB MongoDB collection from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBCollectionToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + return beginMigrateMongoDBCollectionToManualThroughputAsync( + resourceGroupName, accountName, databaseName, collectionName, context) + .getSyncPoller(); + } + + /** + * Migrate an Azure Cosmos DB MongoDB collection from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateMongoDBCollectionToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + return beginMigrateMongoDBCollectionToManualThroughputAsync( + resourceGroupName, accountName, databaseName, collectionName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Migrate an Azure Cosmos DB MongoDB collection from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateMongoDBCollectionToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + return beginMigrateMongoDBCollectionToManualThroughputAsync( + resourceGroupName, accountName, databaseName, collectionName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Migrate an Azure Cosmos DB MongoDB collection from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateMongoDBCollectionToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + return migrateMongoDBCollectionToManualThroughputAsync( + resourceGroupName, accountName, databaseName, collectionName) + .block(); + } + + /** + * Migrate an Azure Cosmos DB MongoDB collection from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateMongoDBCollectionToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + return migrateMongoDBCollectionToManualThroughputAsync( + resourceGroupName, accountName, databaseName, collectionName, context) + .block(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MongoDBResourcesImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MongoDBResourcesImpl.java new file mode 100644 index 0000000000000..fb7895af72ef7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MongoDBResourcesImpl.java @@ -0,0 +1,662 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.MongoDBResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MongoDBCollectionGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MongoDBDatabaseGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ThroughputSettingsGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBCollectionGetResults; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBDatabaseGetResults; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBResources; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsGetResults; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class MongoDBResourcesImpl implements MongoDBResources { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MongoDBResourcesImpl.class); + + private final MongoDBResourcesClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public MongoDBResourcesImpl( + MongoDBResourcesClient innerClient, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listMongoDBDatabases(String resourceGroupName, String accountName) { + PagedIterable inner = + this.serviceClient().listMongoDBDatabases(resourceGroupName, accountName); + return Utils.mapPage(inner, inner1 -> new MongoDBDatabaseGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listMongoDBDatabases( + String resourceGroupName, String accountName, Context context) { + PagedIterable inner = + this.serviceClient().listMongoDBDatabases(resourceGroupName, accountName, context); + return Utils.mapPage(inner, inner1 -> new MongoDBDatabaseGetResultsImpl(inner1, this.manager())); + } + + public MongoDBDatabaseGetResults getMongoDBDatabase( + String resourceGroupName, String accountName, String databaseName) { + MongoDBDatabaseGetResultsInner inner = + this.serviceClient().getMongoDBDatabase(resourceGroupName, accountName, databaseName); + if (inner != null) { + return new MongoDBDatabaseGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getMongoDBDatabaseWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context) { + Response inner = + this.serviceClient().getMongoDBDatabaseWithResponse(resourceGroupName, accountName, databaseName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new MongoDBDatabaseGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteMongoDBDatabase(String resourceGroupName, String accountName, String databaseName) { + this.serviceClient().deleteMongoDBDatabase(resourceGroupName, accountName, databaseName); + } + + public void deleteMongoDBDatabase( + String resourceGroupName, String accountName, String databaseName, Context context) { + this.serviceClient().deleteMongoDBDatabase(resourceGroupName, accountName, databaseName, context); + } + + public ThroughputSettingsGetResults getMongoDBDatabaseThroughput( + String resourceGroupName, String accountName, String databaseName) { + ThroughputSettingsGetResultsInner inner = + this.serviceClient().getMongoDBDatabaseThroughput(resourceGroupName, accountName, databaseName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getMongoDBDatabaseThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context) { + Response inner = + this + .serviceClient() + .getMongoDBDatabaseThroughputWithResponse(resourceGroupName, accountName, databaseName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ThroughputSettingsGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ThroughputSettingsGetResults updateMongoDBDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .updateMongoDBDatabaseThroughput( + resourceGroupName, accountName, databaseName, updateThroughputParameters); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults updateMongoDBDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .updateMongoDBDatabaseThroughput( + resourceGroupName, accountName, databaseName, updateThroughputParameters, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateMongoDBDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName) { + ThroughputSettingsGetResultsInner inner = + this.serviceClient().migrateMongoDBDatabaseToAutoscale(resourceGroupName, accountName, databaseName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateMongoDBDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName, Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateMongoDBDatabaseToAutoscale(resourceGroupName, accountName, databaseName, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateMongoDBDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName) { + ThroughputSettingsGetResultsInner inner = + this.serviceClient().migrateMongoDBDatabaseToManualThroughput(resourceGroupName, accountName, databaseName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateMongoDBDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName, Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateMongoDBDatabaseToManualThroughput(resourceGroupName, accountName, databaseName, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listMongoDBCollections( + String resourceGroupName, String accountName, String databaseName) { + PagedIterable inner = + this.serviceClient().listMongoDBCollections(resourceGroupName, accountName, databaseName); + return Utils.mapPage(inner, inner1 -> new MongoDBCollectionGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listMongoDBCollections( + String resourceGroupName, String accountName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listMongoDBCollections(resourceGroupName, accountName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new MongoDBCollectionGetResultsImpl(inner1, this.manager())); + } + + public MongoDBCollectionGetResults getMongoDBCollection( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + MongoDBCollectionGetResultsInner inner = + this.serviceClient().getMongoDBCollection(resourceGroupName, accountName, databaseName, collectionName); + if (inner != null) { + return new MongoDBCollectionGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getMongoDBCollectionWithResponse( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + Response inner = + this + .serviceClient() + .getMongoDBCollectionWithResponse( + resourceGroupName, accountName, databaseName, collectionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new MongoDBCollectionGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteMongoDBCollection( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + this.serviceClient().deleteMongoDBCollection(resourceGroupName, accountName, databaseName, collectionName); + } + + public void deleteMongoDBCollection( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + this + .serviceClient() + .deleteMongoDBCollection(resourceGroupName, accountName, databaseName, collectionName, context); + } + + public ThroughputSettingsGetResults getMongoDBCollectionThroughput( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .getMongoDBCollectionThroughput(resourceGroupName, accountName, databaseName, collectionName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getMongoDBCollectionThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + Response inner = + this + .serviceClient() + .getMongoDBCollectionThroughputWithResponse( + resourceGroupName, accountName, databaseName, collectionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ThroughputSettingsGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ThroughputSettingsGetResults updateMongoDBCollectionThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .updateMongoDBCollectionThroughput( + resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults updateMongoDBCollectionThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .updateMongoDBCollectionThroughput( + resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateMongoDBCollectionToAutoscale( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateMongoDBCollectionToAutoscale(resourceGroupName, accountName, databaseName, collectionName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateMongoDBCollectionToAutoscale( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateMongoDBCollectionToAutoscale( + resourceGroupName, accountName, databaseName, collectionName, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateMongoDBCollectionToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateMongoDBCollectionToManualThroughput( + resourceGroupName, accountName, databaseName, collectionName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateMongoDBCollectionToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateMongoDBCollectionToManualThroughput( + resourceGroupName, accountName, databaseName, collectionName, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public MongoDBDatabaseGetResults getMongoDBDatabaseById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "mongodbDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'mongodbDatabases'.", id))); + } + return this + .getMongoDBDatabaseWithResponse(resourceGroupName, accountName, databaseName, Context.NONE) + .getValue(); + } + + public Response getMongoDBDatabaseByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "mongodbDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'mongodbDatabases'.", id))); + } + return this.getMongoDBDatabaseWithResponse(resourceGroupName, accountName, databaseName, context); + } + + public MongoDBCollectionGetResults getMongoDBCollectionById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "mongodbDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'mongodbDatabases'.", id))); + } + String collectionName = Utils.getValueFromIdByName(id, "collections"); + if (collectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'collections'.", id))); + } + return this + .getMongoDBCollectionWithResponse( + resourceGroupName, accountName, databaseName, collectionName, Context.NONE) + .getValue(); + } + + public Response getMongoDBCollectionByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "mongodbDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'mongodbDatabases'.", id))); + } + String collectionName = Utils.getValueFromIdByName(id, "collections"); + if (collectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'collections'.", id))); + } + return this + .getMongoDBCollectionWithResponse(resourceGroupName, accountName, databaseName, collectionName, context); + } + + public void deleteMongoDBDatabaseById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "mongodbDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'mongodbDatabases'.", id))); + } + this.deleteMongoDBDatabase(resourceGroupName, accountName, databaseName, Context.NONE); + } + + public void deleteMongoDBDatabaseByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "mongodbDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'mongodbDatabases'.", id))); + } + this.deleteMongoDBDatabase(resourceGroupName, accountName, databaseName, context); + } + + public void deleteMongoDBCollectionById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "mongodbDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'mongodbDatabases'.", id))); + } + String collectionName = Utils.getValueFromIdByName(id, "collections"); + if (collectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'collections'.", id))); + } + this.deleteMongoDBCollection(resourceGroupName, accountName, databaseName, collectionName, Context.NONE); + } + + public void deleteMongoDBCollectionByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "mongodbDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'mongodbDatabases'.", id))); + } + String collectionName = Utils.getValueFromIdByName(id, "collections"); + if (collectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'collections'.", id))); + } + this.deleteMongoDBCollection(resourceGroupName, accountName, databaseName, collectionName, context); + } + + private MongoDBResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + public MongoDBDatabaseGetResultsImpl defineUpdateMongoDBDatabase(String name) { + return new MongoDBDatabaseGetResultsImpl(name, this.manager()); + } + + public MongoDBCollectionGetResultsImpl defineUpdateMongoDBCollection(String name) { + return new MongoDBCollectionGetResultsImpl(name, this.manager()); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/NotebookWorkspaceConnectionInfoResultImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/NotebookWorkspaceConnectionInfoResultImpl.java new file mode 100644 index 0000000000000..db8258369c3fb --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/NotebookWorkspaceConnectionInfoResultImpl.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.NotebookWorkspaceConnectionInfoResultInner; +import com.azure.resourcemanager.cosmos.generated.models.NotebookWorkspaceConnectionInfoResult; + +public final class NotebookWorkspaceConnectionInfoResultImpl implements NotebookWorkspaceConnectionInfoResult { + private NotebookWorkspaceConnectionInfoResultInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + NotebookWorkspaceConnectionInfoResultImpl( + NotebookWorkspaceConnectionInfoResultInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String authToken() { + return this.innerModel().authToken(); + } + + public String notebookServerEndpoint() { + return this.innerModel().notebookServerEndpoint(); + } + + public NotebookWorkspaceConnectionInfoResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/NotebookWorkspaceImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/NotebookWorkspaceImpl.java new file mode 100644 index 0000000000000..b2c866c9ebefc --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/NotebookWorkspaceImpl.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.NotebookWorkspaceInner; +import com.azure.resourcemanager.cosmos.generated.models.NotebookWorkspace; +import com.azure.resourcemanager.cosmos.generated.models.NotebookWorkspaceConnectionInfoResult; +import com.azure.resourcemanager.cosmos.generated.models.NotebookWorkspaceCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.NotebookWorkspaceName; + +public final class NotebookWorkspaceImpl + implements NotebookWorkspace, NotebookWorkspace.Definition, NotebookWorkspace.Update { + private NotebookWorkspaceInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String notebookServerEndpoint() { + return this.innerModel().notebookServerEndpoint(); + } + + public String status() { + return this.innerModel().status(); + } + + public NotebookWorkspaceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String accountName; + + private NotebookWorkspaceName notebookWorkspaceName; + + private NotebookWorkspaceCreateUpdateParameters createNotebookCreateUpdateParameters; + + private NotebookWorkspaceCreateUpdateParameters updateNotebookCreateUpdateParameters; + + public NotebookWorkspaceImpl withExistingDatabaseAccount(String resourceGroupName, String accountName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + return this; + } + + public NotebookWorkspace create() { + this.innerObject = + serviceManager + .serviceClient() + .getNotebookWorkspaces() + .createOrUpdate( + resourceGroupName, + accountName, + notebookWorkspaceName, + createNotebookCreateUpdateParameters, + Context.NONE); + return this; + } + + public NotebookWorkspace create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getNotebookWorkspaces() + .createOrUpdate( + resourceGroupName, + accountName, + notebookWorkspaceName, + createNotebookCreateUpdateParameters, + context); + return this; + } + + NotebookWorkspaceImpl( + NotebookWorkspaceName name, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = new NotebookWorkspaceInner(); + this.serviceManager = serviceManager; + this.notebookWorkspaceName = name; + this.createNotebookCreateUpdateParameters = new NotebookWorkspaceCreateUpdateParameters(); + } + + public NotebookWorkspaceImpl update() { + this.updateNotebookCreateUpdateParameters = new NotebookWorkspaceCreateUpdateParameters(); + return this; + } + + public NotebookWorkspace apply() { + this.innerObject = + serviceManager + .serviceClient() + .getNotebookWorkspaces() + .createOrUpdate( + resourceGroupName, + accountName, + notebookWorkspaceName, + updateNotebookCreateUpdateParameters, + Context.NONE); + return this; + } + + public NotebookWorkspace apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getNotebookWorkspaces() + .createOrUpdate( + resourceGroupName, + accountName, + notebookWorkspaceName, + updateNotebookCreateUpdateParameters, + context); + return this; + } + + NotebookWorkspaceImpl( + NotebookWorkspaceInner innerObject, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.notebookWorkspaceName = + NotebookWorkspaceName.fromString(Utils.getValueFromIdByName(innerObject.id(), "notebookWorkspaces")); + } + + public NotebookWorkspace refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getNotebookWorkspaces() + .getWithResponse(resourceGroupName, accountName, notebookWorkspaceName, Context.NONE) + .getValue(); + return this; + } + + public NotebookWorkspace refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getNotebookWorkspaces() + .getWithResponse(resourceGroupName, accountName, notebookWorkspaceName, context) + .getValue(); + return this; + } + + public NotebookWorkspaceConnectionInfoResult listConnectionInfo() { + return serviceManager + .notebookWorkspaces() + .listConnectionInfo(resourceGroupName, accountName, notebookWorkspaceName); + } + + public Response listConnectionInfoWithResponse(Context context) { + return serviceManager + .notebookWorkspaces() + .listConnectionInfoWithResponse(resourceGroupName, accountName, notebookWorkspaceName, context); + } + + public void regenerateAuthToken() { + serviceManager.notebookWorkspaces().regenerateAuthToken(resourceGroupName, accountName, notebookWorkspaceName); + } + + public void regenerateAuthToken(Context context) { + serviceManager + .notebookWorkspaces() + .regenerateAuthToken(resourceGroupName, accountName, notebookWorkspaceName, context); + } + + public void start() { + serviceManager.notebookWorkspaces().start(resourceGroupName, accountName, notebookWorkspaceName); + } + + public void start(Context context) { + serviceManager.notebookWorkspaces().start(resourceGroupName, accountName, notebookWorkspaceName, context); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/NotebookWorkspacesClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/NotebookWorkspacesClientImpl.java new file mode 100644 index 0000000000000..2ac98e822bc02 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/NotebookWorkspacesClientImpl.java @@ -0,0 +1,1799 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.cosmos.generated.fluent.NotebookWorkspacesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.NotebookWorkspaceConnectionInfoResultInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.NotebookWorkspaceInner; +import com.azure.resourcemanager.cosmos.generated.models.NotebookWorkspaceCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.NotebookWorkspaceListResult; +import com.azure.resourcemanager.cosmos.generated.models.NotebookWorkspaceName; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in NotebookWorkspacesClient. */ +public final class NotebookWorkspacesClientImpl implements NotebookWorkspacesClient { + private final ClientLogger logger = new ClientLogger(NotebookWorkspacesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final NotebookWorkspacesService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of NotebookWorkspacesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + NotebookWorkspacesClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy.create(NotebookWorkspacesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientNotebookWorkspaces to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface NotebookWorkspacesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/notebookWorkspaces") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabaseAccount( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("accountName") String accountName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("accountName") String accountName, + @PathParam("notebookWorkspaceName") NotebookWorkspaceName notebookWorkspaceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("accountName") String accountName, + @PathParam("notebookWorkspaceName") NotebookWorkspaceName notebookWorkspaceName, + @BodyParam("application/json") NotebookWorkspaceCreateUpdateParameters notebookCreateUpdateParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("accountName") String accountName, + @PathParam("notebookWorkspaceName") NotebookWorkspaceName notebookWorkspaceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/listConnectionInfo") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listConnectionInfo( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("accountName") String accountName, + @PathParam("notebookWorkspaceName") NotebookWorkspaceName notebookWorkspaceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/regenerateAuthToken") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> regenerateAuthToken( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("accountName") String accountName, + @PathParam("notebookWorkspaceName") NotebookWorkspaceName notebookWorkspaceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/start") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> start( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("accountName") String accountName, + @PathParam("notebookWorkspaceName") NotebookWorkspaceName notebookWorkspaceName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the notebook workspace resources of an existing Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notebook workspace resources of an existing Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseAccountSinglePageAsync( + String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabaseAccount( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the notebook workspace resources of an existing Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notebook workspace resources of an existing Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseAccountSinglePageAsync( + String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabaseAccount( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Gets the notebook workspace resources of an existing Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notebook workspace resources of an existing Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAccountAsync(String resourceGroupName, String accountName) { + return new PagedFlux<>(() -> listByDatabaseAccountSinglePageAsync(resourceGroupName, accountName)); + } + + /** + * Gets the notebook workspace resources of an existing Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notebook workspace resources of an existing Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAccountAsync( + String resourceGroupName, String accountName, Context context) { + return new PagedFlux<>(() -> listByDatabaseAccountSinglePageAsync(resourceGroupName, accountName, context)); + } + + /** + * Gets the notebook workspace resources of an existing Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notebook workspace resources of an existing Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabaseAccount(String resourceGroupName, String accountName) { + return new PagedIterable<>(listByDatabaseAccountAsync(resourceGroupName, accountName)); + } + + /** + * Gets the notebook workspace resources of an existing Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notebook workspace resources of an existing Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabaseAccount( + String resourceGroupName, String accountName, Context context) { + return new PagedIterable<>(listByDatabaseAccountAsync(resourceGroupName, accountName, context)); + } + + /** + * Gets the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notebook workspace for a Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (notebookWorkspaceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter notebookWorkspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + notebookWorkspaceName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notebook workspace for a Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (notebookWorkspaceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter notebookWorkspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + notebookWorkspaceName, + accept, + context); + } + + /** + * Gets the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notebook workspace for a Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + return getWithResponseAsync(resourceGroupName, accountName, notebookWorkspaceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notebook workspace for a Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NotebookWorkspaceInner get( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + return getAsync(resourceGroupName, accountName, notebookWorkspaceName).block(); + } + + /** + * Gets the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notebook workspace for a Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + return getWithResponseAsync(resourceGroupName, accountName, notebookWorkspaceName, context).block(); + } + + /** + * Creates the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param notebookCreateUpdateParameters The notebook workspace to create for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a notebook workspace resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String accountName, + NotebookWorkspaceName notebookWorkspaceName, + NotebookWorkspaceCreateUpdateParameters notebookCreateUpdateParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (notebookWorkspaceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter notebookWorkspaceName is required and cannot be null.")); + } + if (notebookCreateUpdateParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter notebookCreateUpdateParameters is required and cannot be null.")); + } else { + notebookCreateUpdateParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + notebookWorkspaceName, + notebookCreateUpdateParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param notebookCreateUpdateParameters The notebook workspace to create for the current database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a notebook workspace resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String accountName, + NotebookWorkspaceName notebookWorkspaceName, + NotebookWorkspaceCreateUpdateParameters notebookCreateUpdateParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (notebookWorkspaceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter notebookWorkspaceName is required and cannot be null.")); + } + if (notebookCreateUpdateParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter notebookCreateUpdateParameters is required and cannot be null.")); + } else { + notebookCreateUpdateParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + notebookWorkspaceName, + notebookCreateUpdateParameters, + accept, + context); + } + + /** + * Creates the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param notebookCreateUpdateParameters The notebook workspace to create for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a notebook workspace resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, NotebookWorkspaceInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String accountName, + NotebookWorkspaceName notebookWorkspaceName, + NotebookWorkspaceCreateUpdateParameters notebookCreateUpdateParameters) { + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, accountName, notebookWorkspaceName, notebookCreateUpdateParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + NotebookWorkspaceInner.class, + NotebookWorkspaceInner.class, + Context.NONE); + } + + /** + * Creates the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param notebookCreateUpdateParameters The notebook workspace to create for the current database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a notebook workspace resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, NotebookWorkspaceInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String accountName, + NotebookWorkspaceName notebookWorkspaceName, + NotebookWorkspaceCreateUpdateParameters notebookCreateUpdateParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, accountName, notebookWorkspaceName, notebookCreateUpdateParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + NotebookWorkspaceInner.class, + NotebookWorkspaceInner.class, + context); + } + + /** + * Creates the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param notebookCreateUpdateParameters The notebook workspace to create for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a notebook workspace resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, NotebookWorkspaceInner> beginCreateOrUpdate( + String resourceGroupName, + String accountName, + NotebookWorkspaceName notebookWorkspaceName, + NotebookWorkspaceCreateUpdateParameters notebookCreateUpdateParameters) { + return beginCreateOrUpdateAsync( + resourceGroupName, accountName, notebookWorkspaceName, notebookCreateUpdateParameters) + .getSyncPoller(); + } + + /** + * Creates the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param notebookCreateUpdateParameters The notebook workspace to create for the current database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a notebook workspace resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, NotebookWorkspaceInner> beginCreateOrUpdate( + String resourceGroupName, + String accountName, + NotebookWorkspaceName notebookWorkspaceName, + NotebookWorkspaceCreateUpdateParameters notebookCreateUpdateParameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, accountName, notebookWorkspaceName, notebookCreateUpdateParameters, context) + .getSyncPoller(); + } + + /** + * Creates the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param notebookCreateUpdateParameters The notebook workspace to create for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a notebook workspace resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String accountName, + NotebookWorkspaceName notebookWorkspaceName, + NotebookWorkspaceCreateUpdateParameters notebookCreateUpdateParameters) { + return beginCreateOrUpdateAsync( + resourceGroupName, accountName, notebookWorkspaceName, notebookCreateUpdateParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param notebookCreateUpdateParameters The notebook workspace to create for the current database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a notebook workspace resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String accountName, + NotebookWorkspaceName notebookWorkspaceName, + NotebookWorkspaceCreateUpdateParameters notebookCreateUpdateParameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, accountName, notebookWorkspaceName, notebookCreateUpdateParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param notebookCreateUpdateParameters The notebook workspace to create for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a notebook workspace resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NotebookWorkspaceInner createOrUpdate( + String resourceGroupName, + String accountName, + NotebookWorkspaceName notebookWorkspaceName, + NotebookWorkspaceCreateUpdateParameters notebookCreateUpdateParameters) { + return createOrUpdateAsync( + resourceGroupName, accountName, notebookWorkspaceName, notebookCreateUpdateParameters) + .block(); + } + + /** + * Creates the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param notebookCreateUpdateParameters The notebook workspace to create for the current database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a notebook workspace resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NotebookWorkspaceInner createOrUpdate( + String resourceGroupName, + String accountName, + NotebookWorkspaceName notebookWorkspaceName, + NotebookWorkspaceCreateUpdateParameters notebookCreateUpdateParameters, + Context context) { + return createOrUpdateAsync( + resourceGroupName, accountName, notebookWorkspaceName, notebookCreateUpdateParameters, context) + .block(); + } + + /** + * Deletes the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (notebookWorkspaceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter notebookWorkspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + notebookWorkspaceName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (notebookWorkspaceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter notebookWorkspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + notebookWorkspaceName, + accept, + context); + } + + /** + * Deletes the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, accountName, notebookWorkspaceName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, accountName, notebookWorkspaceName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + return beginDeleteAsync(resourceGroupName, accountName, notebookWorkspaceName).getSyncPoller(); + } + + /** + * Deletes the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + return beginDeleteAsync(resourceGroupName, accountName, notebookWorkspaceName, context).getSyncPoller(); + } + + /** + * Deletes the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + return beginDeleteAsync(resourceGroupName, accountName, notebookWorkspaceName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + return beginDeleteAsync(resourceGroupName, accountName, notebookWorkspaceName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + deleteAsync(resourceGroupName, accountName, notebookWorkspaceName).block(); + } + + /** + * Deletes the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + deleteAsync(resourceGroupName, accountName, notebookWorkspaceName, context).block(); + } + + /** + * Retrieves the connection info for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connection info for the given notebook workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listConnectionInfoWithResponseAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (notebookWorkspaceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter notebookWorkspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listConnectionInfo( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + notebookWorkspaceName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the connection info for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connection info for the given notebook workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listConnectionInfoWithResponseAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (notebookWorkspaceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter notebookWorkspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listConnectionInfo( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + notebookWorkspaceName, + accept, + context); + } + + /** + * Retrieves the connection info for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connection info for the given notebook workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listConnectionInfoAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + return listConnectionInfoWithResponseAsync(resourceGroupName, accountName, notebookWorkspaceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieves the connection info for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connection info for the given notebook workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NotebookWorkspaceConnectionInfoResultInner listConnectionInfo( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + return listConnectionInfoAsync(resourceGroupName, accountName, notebookWorkspaceName).block(); + } + + /** + * Retrieves the connection info for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connection info for the given notebook workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listConnectionInfoWithResponse( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + return listConnectionInfoWithResponseAsync(resourceGroupName, accountName, notebookWorkspaceName, context) + .block(); + } + + /** + * Regenerates the auth token for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> regenerateAuthTokenWithResponseAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (notebookWorkspaceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter notebookWorkspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .regenerateAuthToken( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + notebookWorkspaceName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Regenerates the auth token for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> regenerateAuthTokenWithResponseAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (notebookWorkspaceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter notebookWorkspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .regenerateAuthToken( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + notebookWorkspaceName, + accept, + context); + } + + /** + * Regenerates the auth token for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginRegenerateAuthTokenAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + Mono>> mono = + regenerateAuthTokenWithResponseAsync(resourceGroupName, accountName, notebookWorkspaceName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Regenerates the auth token for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginRegenerateAuthTokenAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + regenerateAuthTokenWithResponseAsync(resourceGroupName, accountName, notebookWorkspaceName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Regenerates the auth token for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginRegenerateAuthToken( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + return beginRegenerateAuthTokenAsync(resourceGroupName, accountName, notebookWorkspaceName).getSyncPoller(); + } + + /** + * Regenerates the auth token for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginRegenerateAuthToken( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + return beginRegenerateAuthTokenAsync(resourceGroupName, accountName, notebookWorkspaceName, context) + .getSyncPoller(); + } + + /** + * Regenerates the auth token for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono regenerateAuthTokenAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + return beginRegenerateAuthTokenAsync(resourceGroupName, accountName, notebookWorkspaceName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Regenerates the auth token for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono regenerateAuthTokenAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + return beginRegenerateAuthTokenAsync(resourceGroupName, accountName, notebookWorkspaceName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Regenerates the auth token for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void regenerateAuthToken( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + regenerateAuthTokenAsync(resourceGroupName, accountName, notebookWorkspaceName).block(); + } + + /** + * Regenerates the auth token for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void regenerateAuthToken( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + regenerateAuthTokenAsync(resourceGroupName, accountName, notebookWorkspaceName, context).block(); + } + + /** + * Starts the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> startWithResponseAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (notebookWorkspaceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter notebookWorkspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .start( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + notebookWorkspaceName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Starts the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> startWithResponseAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (notebookWorkspaceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter notebookWorkspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .start( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + notebookWorkspaceName, + accept, + context); + } + + /** + * Starts the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginStartAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + Mono>> mono = + startWithResponseAsync(resourceGroupName, accountName, notebookWorkspaceName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Starts the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginStartAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + startWithResponseAsync(resourceGroupName, accountName, notebookWorkspaceName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Starts the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginStart( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + return beginStartAsync(resourceGroupName, accountName, notebookWorkspaceName).getSyncPoller(); + } + + /** + * Starts the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginStart( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + return beginStartAsync(resourceGroupName, accountName, notebookWorkspaceName, context).getSyncPoller(); + } + + /** + * Starts the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono startAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + return beginStartAsync(resourceGroupName, accountName, notebookWorkspaceName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Starts the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono startAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + return beginStartAsync(resourceGroupName, accountName, notebookWorkspaceName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Starts the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void start(String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + startAsync(resourceGroupName, accountName, notebookWorkspaceName).block(); + } + + /** + * Starts the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void start( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + startAsync(resourceGroupName, accountName, notebookWorkspaceName, context).block(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/NotebookWorkspacesImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/NotebookWorkspacesImpl.java new file mode 100644 index 0000000000000..66d112fb151a6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/NotebookWorkspacesImpl.java @@ -0,0 +1,264 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.NotebookWorkspacesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.NotebookWorkspaceConnectionInfoResultInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.NotebookWorkspaceInner; +import com.azure.resourcemanager.cosmos.generated.models.NotebookWorkspace; +import com.azure.resourcemanager.cosmos.generated.models.NotebookWorkspaceConnectionInfoResult; +import com.azure.resourcemanager.cosmos.generated.models.NotebookWorkspaceName; +import com.azure.resourcemanager.cosmos.generated.models.NotebookWorkspaces; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class NotebookWorkspacesImpl implements NotebookWorkspaces { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NotebookWorkspacesImpl.class); + + private final NotebookWorkspacesClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public NotebookWorkspacesImpl( + NotebookWorkspacesClient innerClient, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByDatabaseAccount(String resourceGroupName, String accountName) { + PagedIterable inner = + this.serviceClient().listByDatabaseAccount(resourceGroupName, accountName); + return Utils.mapPage(inner, inner1 -> new NotebookWorkspaceImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabaseAccount( + String resourceGroupName, String accountName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabaseAccount(resourceGroupName, accountName, context); + return Utils.mapPage(inner, inner1 -> new NotebookWorkspaceImpl(inner1, this.manager())); + } + + public NotebookWorkspace get( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + NotebookWorkspaceInner inner = this.serviceClient().get(resourceGroupName, accountName, notebookWorkspaceName); + if (inner != null) { + return new NotebookWorkspaceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, accountName, notebookWorkspaceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new NotebookWorkspaceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + this.serviceClient().delete(resourceGroupName, accountName, notebookWorkspaceName); + } + + public void delete( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + this.serviceClient().delete(resourceGroupName, accountName, notebookWorkspaceName, context); + } + + public NotebookWorkspaceConnectionInfoResult listConnectionInfo( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + NotebookWorkspaceConnectionInfoResultInner inner = + this.serviceClient().listConnectionInfo(resourceGroupName, accountName, notebookWorkspaceName); + if (inner != null) { + return new NotebookWorkspaceConnectionInfoResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listConnectionInfoWithResponse( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + Response inner = + this + .serviceClient() + .listConnectionInfoWithResponse(resourceGroupName, accountName, notebookWorkspaceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new NotebookWorkspaceConnectionInfoResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void regenerateAuthToken( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + this.serviceClient().regenerateAuthToken(resourceGroupName, accountName, notebookWorkspaceName); + } + + public void regenerateAuthToken( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + this.serviceClient().regenerateAuthToken(resourceGroupName, accountName, notebookWorkspaceName, context); + } + + public void start(String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + this.serviceClient().start(resourceGroupName, accountName, notebookWorkspaceName); + } + + public void start( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + this.serviceClient().start(resourceGroupName, accountName, notebookWorkspaceName, context); + } + + public NotebookWorkspace getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + NotebookWorkspaceName notebookWorkspaceName = + NotebookWorkspaceName.fromString(Utils.getValueFromIdByName(id, "notebookWorkspaces")); + if (notebookWorkspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'notebookWorkspaces'.", id))); + } + return this.getWithResponse(resourceGroupName, accountName, notebookWorkspaceName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + NotebookWorkspaceName notebookWorkspaceName = + NotebookWorkspaceName.fromString(Utils.getValueFromIdByName(id, "notebookWorkspaces")); + if (notebookWorkspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'notebookWorkspaces'.", id))); + } + return this.getWithResponse(resourceGroupName, accountName, notebookWorkspaceName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + NotebookWorkspaceName notebookWorkspaceName = + NotebookWorkspaceName.fromString(Utils.getValueFromIdByName(id, "notebookWorkspaces")); + if (notebookWorkspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'notebookWorkspaces'.", id))); + } + this.delete(resourceGroupName, accountName, notebookWorkspaceName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + NotebookWorkspaceName notebookWorkspaceName = + NotebookWorkspaceName.fromString(Utils.getValueFromIdByName(id, "notebookWorkspaces")); + if (notebookWorkspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'notebookWorkspaces'.", id))); + } + this.delete(resourceGroupName, accountName, notebookWorkspaceName, context); + } + + private NotebookWorkspacesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + public NotebookWorkspaceImpl define(NotebookWorkspaceName name) { + return new NotebookWorkspaceImpl(name, this.manager()); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/OperationImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/OperationImpl.java new file mode 100644 index 0000000000000..202d50356b72d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/OperationImpl.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.OperationInner; +import com.azure.resourcemanager.cosmos.generated.models.Operation; +import com.azure.resourcemanager.cosmos.generated.models.OperationDisplay; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + OperationImpl( + OperationInner innerObject, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/OperationsClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..c39a07e58f6d5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/OperationsClientImpl.java @@ -0,0 +1,269 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.OperationsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.OperationInner; +import com.azure.resourcemanager.cosmos.generated.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public final class OperationsClientImpl implements OperationsClient { + private final ClientLogger logger = new ClientLogger(OperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.DocumentDB/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all of the available Cosmos DB Resource Provider operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Resource Provider operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all of the available Cosmos DB Resource Provider operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Resource Provider operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all of the available Cosmos DB Resource Provider operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Resource Provider operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the available Cosmos DB Resource Provider operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Resource Provider operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the available Cosmos DB Resource Provider operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Resource Provider operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all of the available Cosmos DB Resource Provider operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Resource Provider operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Resource Provider operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Resource Provider operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/OperationsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..5ccc664e91681 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/OperationsImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.OperationsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.OperationInner; +import com.azure.resourcemanager.cosmos.generated.models.Operation; +import com.azure.resourcemanager.cosmos.generated.models.Operations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class OperationsImpl implements Operations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public OperationsImpl( + OperationsClient innerClient, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionKeyRangeIdRegionsClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionKeyRangeIdRegionsClientImpl.java new file mode 100644 index 0000000000000..fdc860e02cae5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionKeyRangeIdRegionsClientImpl.java @@ -0,0 +1,400 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.PartitionKeyRangeIdRegionsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionMetricInner; +import com.azure.resourcemanager.cosmos.generated.models.PartitionMetricListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PartitionKeyRangeIdRegionsClient. */ +public final class PartitionKeyRangeIdRegionsClientImpl implements PartitionKeyRangeIdRegionsClient { + private final ClientLogger logger = new ClientLogger(PartitionKeyRangeIdRegionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PartitionKeyRangeIdRegionsService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of PartitionKeyRangeIdRegionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PartitionKeyRangeIdRegionsClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy + .create( + PartitionKeyRangeIdRegionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientPartitionKeyRangeIdRegions to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface PartitionKeyRangeIdRegionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}" + + "/partitionKeyRangeId/{partitionKeyRangeId}/metrics") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMetrics( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("region") String region, + @PathParam("databaseRid") String databaseRid, + @PathParam("collectionRid") String collectionRid, + @PathParam("partitionKeyRangeId") String partitionKeyRangeId, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (region == null) { + return Mono.error(new IllegalArgumentException("Parameter region is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + if (collectionRid == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionRid is required and cannot be null.")); + } + if (partitionKeyRangeId == null) { + return Mono + .error(new IllegalArgumentException("Parameter partitionKeyRangeId is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + region, + databaseRid, + collectionRid, + partitionKeyRangeId, + this.client.getApiVersion(), + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (region == null) { + return Mono.error(new IllegalArgumentException("Parameter region is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + if (collectionRid == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionRid is required and cannot be null.")); + } + if (partitionKeyRangeId == null) { + return Mono + .error(new IllegalArgumentException("Parameter partitionKeyRangeId is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + region, + databaseRid, + collectionRid, + partitionKeyRangeId, + this.client.getApiVersion(), + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter) { + return new PagedFlux<>( + () -> + listMetricsSinglePageAsync( + resourceGroupName, accountName, region, databaseRid, collectionRid, partitionKeyRangeId, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter, + Context context) { + return new PagedFlux<>( + () -> + listMetricsSinglePageAsync( + resourceGroupName, + accountName, + region, + databaseRid, + collectionRid, + partitionKeyRangeId, + filter, + context)); + } + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter) { + return new PagedIterable<>( + listMetricsAsync( + resourceGroupName, accountName, region, databaseRid, collectionRid, partitionKeyRangeId, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter, + Context context) { + return new PagedIterable<>( + listMetricsAsync( + resourceGroupName, + accountName, + region, + databaseRid, + collectionRid, + partitionKeyRangeId, + filter, + context)); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionKeyRangeIdRegionsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionKeyRangeIdRegionsImpl.java new file mode 100644 index 0000000000000..775cc2bfbe918 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionKeyRangeIdRegionsImpl.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.PartitionKeyRangeIdRegionsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionMetricInner; +import com.azure.resourcemanager.cosmos.generated.models.PartitionKeyRangeIdRegions; +import com.azure.resourcemanager.cosmos.generated.models.PartitionMetric; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PartitionKeyRangeIdRegionsImpl implements PartitionKeyRangeIdRegions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PartitionKeyRangeIdRegionsImpl.class); + + private final PartitionKeyRangeIdRegionsClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public PartitionKeyRangeIdRegionsImpl( + PartitionKeyRangeIdRegionsClient innerClient, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter) { + PagedIterable inner = + this + .serviceClient() + .listMetrics( + resourceGroupName, accountName, region, databaseRid, collectionRid, partitionKeyRangeId, filter); + return Utils.mapPage(inner, inner1 -> new PartitionMetricImpl(inner1, this.manager())); + } + + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listMetrics( + resourceGroupName, + accountName, + region, + databaseRid, + collectionRid, + partitionKeyRangeId, + filter, + context); + return Utils.mapPage(inner, inner1 -> new PartitionMetricImpl(inner1, this.manager())); + } + + private PartitionKeyRangeIdRegionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionKeyRangeIdsClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionKeyRangeIdsClientImpl.java new file mode 100644 index 0000000000000..b7aab467830f7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionKeyRangeIdsClientImpl.java @@ -0,0 +1,363 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.PartitionKeyRangeIdsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionMetricInner; +import com.azure.resourcemanager.cosmos.generated.models.PartitionMetricListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PartitionKeyRangeIdsClient. */ +public final class PartitionKeyRangeIdsClientImpl implements PartitionKeyRangeIdsClient { + private final ClientLogger logger = new ClientLogger(PartitionKeyRangeIdsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PartitionKeyRangeIdsService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of PartitionKeyRangeIdsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PartitionKeyRangeIdsClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy + .create(PartitionKeyRangeIdsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientPartitionKeyRangeIds to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface PartitionKeyRangeIdsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}" + + "/partitionKeyRangeId/{partitionKeyRangeId}/metrics") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMetrics( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseRid") String databaseRid, + @PathParam("collectionRid") String collectionRid, + @PathParam("partitionKeyRangeId") String partitionKeyRangeId, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + if (collectionRid == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionRid is required and cannot be null.")); + } + if (partitionKeyRangeId == null) { + return Mono + .error(new IllegalArgumentException("Parameter partitionKeyRangeId is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + collectionRid, + partitionKeyRangeId, + this.client.getApiVersion(), + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + if (collectionRid == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionRid is required and cannot be null.")); + } + if (partitionKeyRangeId == null) { + return Mono + .error(new IllegalArgumentException("Parameter partitionKeyRangeId is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + collectionRid, + partitionKeyRangeId, + this.client.getApiVersion(), + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter) { + return new PagedFlux<>( + () -> + listMetricsSinglePageAsync( + resourceGroupName, accountName, databaseRid, collectionRid, partitionKeyRangeId, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter, + Context context) { + return new PagedFlux<>( + () -> + listMetricsSinglePageAsync( + resourceGroupName, accountName, databaseRid, collectionRid, partitionKeyRangeId, filter, context)); + } + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter) { + return new PagedIterable<>( + listMetricsAsync(resourceGroupName, accountName, databaseRid, collectionRid, partitionKeyRangeId, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter, + Context context) { + return new PagedIterable<>( + listMetricsAsync( + resourceGroupName, accountName, databaseRid, collectionRid, partitionKeyRangeId, filter, context)); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionKeyRangeIdsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionKeyRangeIdsImpl.java new file mode 100644 index 0000000000000..bab7c05802ece --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionKeyRangeIdsImpl.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.PartitionKeyRangeIdsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionMetricInner; +import com.azure.resourcemanager.cosmos.generated.models.PartitionKeyRangeIds; +import com.azure.resourcemanager.cosmos.generated.models.PartitionMetric; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PartitionKeyRangeIdsImpl implements PartitionKeyRangeIds { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PartitionKeyRangeIdsImpl.class); + + private final PartitionKeyRangeIdsClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public PartitionKeyRangeIdsImpl( + PartitionKeyRangeIdsClient innerClient, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter) { + PagedIterable inner = + this + .serviceClient() + .listMetrics(resourceGroupName, accountName, databaseRid, collectionRid, partitionKeyRangeId, filter); + return Utils.mapPage(inner, inner1 -> new PartitionMetricImpl(inner1, this.manager())); + } + + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listMetrics( + resourceGroupName, accountName, databaseRid, collectionRid, partitionKeyRangeId, filter, context); + return Utils.mapPage(inner, inner1 -> new PartitionMetricImpl(inner1, this.manager())); + } + + private PartitionKeyRangeIdsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionMetricImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionMetricImpl.java new file mode 100644 index 0000000000000..a0be4eaaa7ca9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionMetricImpl.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionMetricInner; +import com.azure.resourcemanager.cosmos.generated.models.MetricName; +import com.azure.resourcemanager.cosmos.generated.models.MetricValue; +import com.azure.resourcemanager.cosmos.generated.models.PartitionMetric; +import com.azure.resourcemanager.cosmos.generated.models.UnitType; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class PartitionMetricImpl implements PartitionMetric { + private PartitionMetricInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + PartitionMetricImpl( + PartitionMetricInner innerObject, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public OffsetDateTime endTime() { + return this.innerModel().endTime(); + } + + public String timeGrain() { + return this.innerModel().timeGrain(); + } + + public UnitType unit() { + return this.innerModel().unit(); + } + + public MetricName name() { + return this.innerModel().name(); + } + + public List metricValues() { + List inner = this.innerModel().metricValues(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String partitionId() { + return this.innerModel().partitionId(); + } + + public String partitionKeyRangeId() { + return this.innerModel().partitionKeyRangeId(); + } + + public PartitionMetricInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionUsageImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionUsageImpl.java new file mode 100644 index 0000000000000..ab62b6e3e8ef6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionUsageImpl.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionUsageInner; +import com.azure.resourcemanager.cosmos.generated.models.MetricName; +import com.azure.resourcemanager.cosmos.generated.models.PartitionUsage; +import com.azure.resourcemanager.cosmos.generated.models.UnitType; + +public final class PartitionUsageImpl implements PartitionUsage { + private PartitionUsageInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + PartitionUsageImpl( + PartitionUsageInner innerObject, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public UnitType unit() { + return this.innerModel().unit(); + } + + public MetricName name() { + return this.innerModel().name(); + } + + public String quotaPeriod() { + return this.innerModel().quotaPeriod(); + } + + public Long limit() { + return this.innerModel().limit(); + } + + public Long currentValue() { + return this.innerModel().currentValue(); + } + + public String partitionId() { + return this.innerModel().partitionId(); + } + + public String partitionKeyRangeId() { + return this.innerModel().partitionKeyRangeId(); + } + + public PartitionUsageInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileMetricImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileMetricImpl.java new file mode 100644 index 0000000000000..78b8913125f00 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileMetricImpl.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.PercentileMetricInner; +import com.azure.resourcemanager.cosmos.generated.models.MetricName; +import com.azure.resourcemanager.cosmos.generated.models.PercentileMetric; +import com.azure.resourcemanager.cosmos.generated.models.PercentileMetricValue; +import com.azure.resourcemanager.cosmos.generated.models.UnitType; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class PercentileMetricImpl implements PercentileMetric { + private PercentileMetricInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + PercentileMetricImpl( + PercentileMetricInner innerObject, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public OffsetDateTime endTime() { + return this.innerModel().endTime(); + } + + public String timeGrain() { + return this.innerModel().timeGrain(); + } + + public UnitType unit() { + return this.innerModel().unit(); + } + + public MetricName name() { + return this.innerModel().name(); + } + + public List metricValues() { + List inner = this.innerModel().metricValues(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public PercentileMetricInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileSourceTargetsClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileSourceTargetsClientImpl.java new file mode 100644 index 0000000000000..eec28ac5cf7a6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileSourceTargetsClientImpl.java @@ -0,0 +1,343 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.PercentileSourceTargetsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PercentileMetricInner; +import com.azure.resourcemanager.cosmos.generated.models.PercentileMetricListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PercentileSourceTargetsClient. */ +public final class PercentileSourceTargetsClientImpl implements PercentileSourceTargetsClient { + private final ClientLogger logger = new ClientLogger(PercentileSourceTargetsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PercentileSourceTargetsService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of PercentileSourceTargetsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PercentileSourceTargetsClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy + .create(PercentileSourceTargetsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientPercentileSourceTargets to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface PercentileSourceTargetsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sourceRegion/{sourceRegion}/targetRegion/{targetRegion}/percentile" + + "/metrics") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMetrics( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("sourceRegion") String sourceRegion, + @PathParam("targetRegion") String targetRegion, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Retrieves the metrics determined by the given filter for the given account, source and target region. This url is + * only for PBS and Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param sourceRegion Source region from which data is written. Cosmos DB region, with spaces between words and + * each word capitalized. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each + * word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, String accountName, String sourceRegion, String targetRegion, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (sourceRegion == null) { + return Mono.error(new IllegalArgumentException("Parameter sourceRegion is required and cannot be null.")); + } + if (targetRegion == null) { + return Mono.error(new IllegalArgumentException("Parameter targetRegion is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + sourceRegion, + targetRegion, + this.client.getApiVersion(), + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the metrics determined by the given filter for the given account, source and target region. This url is + * only for PBS and Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param sourceRegion Source region from which data is written. Cosmos DB region, with spaces between words and + * each word capitalized. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each + * word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, + String accountName, + String sourceRegion, + String targetRegion, + String filter, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (sourceRegion == null) { + return Mono.error(new IllegalArgumentException("Parameter sourceRegion is required and cannot be null.")); + } + if (targetRegion == null) { + return Mono.error(new IllegalArgumentException("Parameter targetRegion is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + sourceRegion, + targetRegion, + this.client.getApiVersion(), + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieves the metrics determined by the given filter for the given account, source and target region. This url is + * only for PBS and Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param sourceRegion Source region from which data is written. Cosmos DB region, with spaces between words and + * each word capitalized. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each + * word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, String accountName, String sourceRegion, String targetRegion, String filter) { + return new PagedFlux<>( + () -> listMetricsSinglePageAsync(resourceGroupName, accountName, sourceRegion, targetRegion, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given account, source and target region. This url is + * only for PBS and Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param sourceRegion Source region from which data is written. Cosmos DB region, with spaces between words and + * each word capitalized. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each + * word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, + String accountName, + String sourceRegion, + String targetRegion, + String filter, + Context context) { + return new PagedFlux<>( + () -> + listMetricsSinglePageAsync( + resourceGroupName, accountName, sourceRegion, targetRegion, filter, context)); + } + + /** + * Retrieves the metrics determined by the given filter for the given account, source and target region. This url is + * only for PBS and Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param sourceRegion Source region from which data is written. Cosmos DB region, with spaces between words and + * each word capitalized. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each + * word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String sourceRegion, String targetRegion, String filter) { + return new PagedIterable<>( + listMetricsAsync(resourceGroupName, accountName, sourceRegion, targetRegion, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given account, source and target region. This url is + * only for PBS and Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param sourceRegion Source region from which data is written. Cosmos DB region, with spaces between words and + * each word capitalized. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each + * word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String sourceRegion, + String targetRegion, + String filter, + Context context) { + return new PagedIterable<>( + listMetricsAsync(resourceGroupName, accountName, sourceRegion, targetRegion, filter, context)); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileSourceTargetsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileSourceTargetsImpl.java new file mode 100644 index 0000000000000..9d35f729155c1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileSourceTargetsImpl.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.PercentileSourceTargetsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PercentileMetricInner; +import com.azure.resourcemanager.cosmos.generated.models.PercentileMetric; +import com.azure.resourcemanager.cosmos.generated.models.PercentileSourceTargets; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PercentileSourceTargetsImpl implements PercentileSourceTargets { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PercentileSourceTargetsImpl.class); + + private final PercentileSourceTargetsClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public PercentileSourceTargetsImpl( + PercentileSourceTargetsClient innerClient, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String sourceRegion, String targetRegion, String filter) { + PagedIterable inner = + this.serviceClient().listMetrics(resourceGroupName, accountName, sourceRegion, targetRegion, filter); + return Utils.mapPage(inner, inner1 -> new PercentileMetricImpl(inner1, this.manager())); + } + + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String sourceRegion, + String targetRegion, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listMetrics(resourceGroupName, accountName, sourceRegion, targetRegion, filter, context); + return Utils.mapPage(inner, inner1 -> new PercentileMetricImpl(inner1, this.manager())); + } + + private PercentileSourceTargetsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileTargetsClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileTargetsClientImpl.java new file mode 100644 index 0000000000000..f6236ec368d12 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileTargetsClientImpl.java @@ -0,0 +1,300 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.PercentileTargetsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PercentileMetricInner; +import com.azure.resourcemanager.cosmos.generated.models.PercentileMetricListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PercentileTargetsClient. */ +public final class PercentileTargetsClientImpl implements PercentileTargetsClient { + private final ClientLogger logger = new ClientLogger(PercentileTargetsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PercentileTargetsService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of PercentileTargetsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PercentileTargetsClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy.create(PercentileTargetsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientPercentileTargets to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface PercentileTargetsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/targetRegion/{targetRegion}/percentile/metrics") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMetrics( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("targetRegion") String targetRegion, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Retrieves the metrics determined by the given filter for the given account target region. This url is only for + * PBS and Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each + * word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, String accountName, String targetRegion, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (targetRegion == null) { + return Mono.error(new IllegalArgumentException("Parameter targetRegion is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + targetRegion, + this.client.getApiVersion(), + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the metrics determined by the given filter for the given account target region. This url is only for + * PBS and Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each + * word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, String accountName, String targetRegion, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (targetRegion == null) { + return Mono.error(new IllegalArgumentException("Parameter targetRegion is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + targetRegion, + this.client.getApiVersion(), + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieves the metrics determined by the given filter for the given account target region. This url is only for + * PBS and Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each + * word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, String accountName, String targetRegion, String filter) { + return new PagedFlux<>(() -> listMetricsSinglePageAsync(resourceGroupName, accountName, targetRegion, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given account target region. This url is only for + * PBS and Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each + * word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, String accountName, String targetRegion, String filter, Context context) { + return new PagedFlux<>( + () -> listMetricsSinglePageAsync(resourceGroupName, accountName, targetRegion, filter, context)); + } + + /** + * Retrieves the metrics determined by the given filter for the given account target region. This url is only for + * PBS and Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each + * word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String targetRegion, String filter) { + return new PagedIterable<>(listMetricsAsync(resourceGroupName, accountName, targetRegion, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given account target region. This url is only for + * PBS and Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each + * word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String targetRegion, String filter, Context context) { + return new PagedIterable<>(listMetricsAsync(resourceGroupName, accountName, targetRegion, filter, context)); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileTargetsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileTargetsImpl.java new file mode 100644 index 0000000000000..a386c4dd16c4a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileTargetsImpl.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.PercentileTargetsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PercentileMetricInner; +import com.azure.resourcemanager.cosmos.generated.models.PercentileMetric; +import com.azure.resourcemanager.cosmos.generated.models.PercentileTargets; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PercentileTargetsImpl implements PercentileTargets { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PercentileTargetsImpl.class); + + private final PercentileTargetsClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public PercentileTargetsImpl( + PercentileTargetsClient innerClient, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String targetRegion, String filter) { + PagedIterable inner = + this.serviceClient().listMetrics(resourceGroupName, accountName, targetRegion, filter); + return Utils.mapPage(inner, inner1 -> new PercentileMetricImpl(inner1, this.manager())); + } + + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String targetRegion, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listMetrics(resourceGroupName, accountName, targetRegion, filter, context); + return Utils.mapPage(inner, inner1 -> new PercentileMetricImpl(inner1, this.manager())); + } + + private PercentileTargetsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentilesClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentilesClientImpl.java new file mode 100644 index 0000000000000..fd062527a1404 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentilesClientImpl.java @@ -0,0 +1,278 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.PercentilesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PercentileMetricInner; +import com.azure.resourcemanager.cosmos.generated.models.PercentileMetricListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PercentilesClient. */ +public final class PercentilesClientImpl implements PercentilesClient { + private final ClientLogger logger = new ClientLogger(PercentilesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PercentilesService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of PercentilesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PercentilesClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy.create(PercentilesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientPercentiles to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface PercentilesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/percentile/metrics") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMetrics( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and + * Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, String accountName, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and + * Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, String accountName, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and + * Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, String accountName, String filter) { + return new PagedFlux<>(() -> listMetricsSinglePageAsync(resourceGroupName, accountName, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and + * Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, String accountName, String filter, Context context) { + return new PagedFlux<>(() -> listMetricsSinglePageAsync(resourceGroupName, accountName, filter, context)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and + * Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String filter) { + return new PagedIterable<>(listMetricsAsync(resourceGroupName, accountName, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and + * Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String filter, Context context) { + return new PagedIterable<>(listMetricsAsync(resourceGroupName, accountName, filter, context)); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentilesImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentilesImpl.java new file mode 100644 index 0000000000000..183af0a0c686a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentilesImpl.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.PercentilesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PercentileMetricInner; +import com.azure.resourcemanager.cosmos.generated.models.PercentileMetric; +import com.azure.resourcemanager.cosmos.generated.models.Percentiles; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PercentilesImpl implements Percentiles { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PercentilesImpl.class); + + private final PercentilesClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public PercentilesImpl( + PercentilesClient innerClient, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listMetrics(String resourceGroupName, String accountName, String filter) { + PagedIterable inner = + this.serviceClient().listMetrics(resourceGroupName, accountName, filter); + return Utils.mapPage(inner, inner1 -> new PercentileMetricImpl(inner1, this.manager())); + } + + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listMetrics(resourceGroupName, accountName, filter, context); + return Utils.mapPage(inner, inner1 -> new PercentileMetricImpl(inner1, this.manager())); + } + + private PercentilesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateEndpointConnectionImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateEndpointConnectionImpl.java new file mode 100644 index 0000000000000..62d182b90eda1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateEndpointConnectionImpl.java @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.cosmos.generated.models.PrivateEndpointConnection; +import com.azure.resourcemanager.cosmos.generated.models.PrivateEndpointProperty; +import com.azure.resourcemanager.cosmos.generated.models.PrivateLinkServiceConnectionStateProperty; + +public final class PrivateEndpointConnectionImpl + implements PrivateEndpointConnection, PrivateEndpointConnection.Definition, PrivateEndpointConnection.Update { + private PrivateEndpointConnectionInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public PrivateEndpointProperty privateEndpoint() { + return this.innerModel().privateEndpoint(); + } + + public PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState() { + return this.innerModel().privateLinkServiceConnectionState(); + } + + public String groupId() { + return this.innerModel().groupId(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public PrivateEndpointConnectionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String accountName; + + private String privateEndpointConnectionName; + + public PrivateEndpointConnectionImpl withExistingDatabaseAccount(String resourceGroupName, String accountName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + return this; + } + + public PrivateEndpointConnection create() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .createOrUpdate( + resourceGroupName, accountName, privateEndpointConnectionName, this.innerModel(), Context.NONE); + return this; + } + + public PrivateEndpointConnection create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .createOrUpdate( + resourceGroupName, accountName, privateEndpointConnectionName, this.innerModel(), context); + return this; + } + + PrivateEndpointConnectionImpl( + String name, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = new PrivateEndpointConnectionInner(); + this.serviceManager = serviceManager; + this.privateEndpointConnectionName = name; + } + + public PrivateEndpointConnectionImpl update() { + return this; + } + + public PrivateEndpointConnection apply() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .createOrUpdate( + resourceGroupName, accountName, privateEndpointConnectionName, this.innerModel(), Context.NONE); + return this; + } + + public PrivateEndpointConnection apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .createOrUpdate( + resourceGroupName, accountName, privateEndpointConnectionName, this.innerModel(), context); + return this; + } + + PrivateEndpointConnectionImpl( + PrivateEndpointConnectionInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.privateEndpointConnectionName = Utils.getValueFromIdByName(innerObject.id(), "privateEndpointConnections"); + } + + public PrivateEndpointConnection refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .getWithResponse(resourceGroupName, accountName, privateEndpointConnectionName, Context.NONE) + .getValue(); + return this; + } + + public PrivateEndpointConnection refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .getWithResponse(resourceGroupName, accountName, privateEndpointConnectionName, context) + .getValue(); + return this; + } + + public PrivateEndpointConnectionImpl withPrivateEndpoint(PrivateEndpointProperty privateEndpoint) { + this.innerModel().withPrivateEndpoint(privateEndpoint); + return this; + } + + public PrivateEndpointConnectionImpl withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState) { + this.innerModel().withPrivateLinkServiceConnectionState(privateLinkServiceConnectionState); + return this; + } + + public PrivateEndpointConnectionImpl withGroupId(String groupId) { + this.innerModel().withGroupId(groupId); + return this; + } + + public PrivateEndpointConnectionImpl withProvisioningState(String provisioningState) { + this.innerModel().withProvisioningState(provisioningState); + return this; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateEndpointConnectionsClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateEndpointConnectionsClientImpl.java new file mode 100644 index 0000000000000..e4fa3e50c6007 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateEndpointConnectionsClientImpl.java @@ -0,0 +1,1071 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.cosmos.generated.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.cosmos.generated.models.PrivateEndpointConnectionListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PrivateEndpointConnectionsClient. */ +public final class PrivateEndpointConnectionsClientImpl implements PrivateEndpointConnectionsClient { + private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PrivateEndpointConnectionsService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of PrivateEndpointConnectionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateEndpointConnectionsClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy + .create( + PrivateEndpointConnectionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientPrivateEndpointConnections to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface PrivateEndpointConnectionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/privateEndpointConnections") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabaseAccount( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("accountName") String accountName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("accountName") String accountName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("accountName") String accountName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @BodyParam("application/json") PrivateEndpointConnectionInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("accountName") String accountName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List all private endpoint connections on a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private endpoint connections. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseAccountSinglePageAsync( + String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabaseAccount( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List all private endpoint connections on a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private endpoint connections. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseAccountSinglePageAsync( + String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabaseAccount( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * List all private endpoint connections on a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private endpoint connections. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAccountAsync( + String resourceGroupName, String accountName) { + return new PagedFlux<>(() -> listByDatabaseAccountSinglePageAsync(resourceGroupName, accountName)); + } + + /** + * List all private endpoint connections on a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private endpoint connections. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAccountAsync( + String resourceGroupName, String accountName, Context context) { + return new PagedFlux<>(() -> listByDatabaseAccountSinglePageAsync(resourceGroupName, accountName, context)); + } + + /** + * List all private endpoint connections on a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private endpoint connections. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabaseAccount( + String resourceGroupName, String accountName) { + return new PagedIterable<>(listByDatabaseAccountAsync(resourceGroupName, accountName)); + } + + /** + * List all private endpoint connections on a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private endpoint connections. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabaseAccount( + String resourceGroupName, String accountName, Context context) { + return new PagedIterable<>(listByDatabaseAccountAsync(resourceGroupName, accountName, context)); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String accountName, String privateEndpointConnectionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + privateEndpointConnectionName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String accountName, String privateEndpointConnectionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + privateEndpointConnectionName, + accept, + context); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String accountName, String privateEndpointConnectionName) { + return getWithResponseAsync(resourceGroupName, accountName, privateEndpointConnectionName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner get( + String resourceGroupName, String accountName, String privateEndpointConnectionName) { + return getAsync(resourceGroupName, accountName, privateEndpointConnectionName).block(); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String accountName, String privateEndpointConnectionName, Context context) { + return getWithResponseAsync(resourceGroupName, accountName, privateEndpointConnectionName, context).block(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + privateEndpointConnectionName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters A private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + privateEndpointConnectionName, + parameters, + accept, + context); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, PrivateEndpointConnectionInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, accountName, privateEndpointConnectionName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + PrivateEndpointConnectionInner.class, + PrivateEndpointConnectionInner.class, + Context.NONE); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters A private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, PrivateEndpointConnectionInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, accountName, privateEndpointConnectionName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + PrivateEndpointConnectionInner.class, + PrivateEndpointConnectionInner.class, + context); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, accountName, privateEndpointConnectionName, parameters) + .getSyncPoller(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters A private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, accountName, privateEndpointConnectionName, parameters, context) + .getSyncPoller(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, accountName, privateEndpointConnectionName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters A private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, accountName, privateEndpointConnectionName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner createOrUpdate( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + return createOrUpdateAsync(resourceGroupName, accountName, privateEndpointConnectionName, parameters).block(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters A private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner createOrUpdate( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, accountName, privateEndpointConnectionName, parameters, context) + .block(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String accountName, String privateEndpointConnectionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + privateEndpointConnectionName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String accountName, String privateEndpointConnectionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + privateEndpointConnectionName, + accept, + context); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String accountName, String privateEndpointConnectionName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, accountName, privateEndpointConnectionName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String accountName, String privateEndpointConnectionName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, accountName, privateEndpointConnectionName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String accountName, String privateEndpointConnectionName) { + return beginDeleteAsync(resourceGroupName, accountName, privateEndpointConnectionName).getSyncPoller(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String accountName, String privateEndpointConnectionName, Context context) { + return beginDeleteAsync(resourceGroupName, accountName, privateEndpointConnectionName, context).getSyncPoller(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String accountName, String privateEndpointConnectionName) { + return beginDeleteAsync(resourceGroupName, accountName, privateEndpointConnectionName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String accountName, String privateEndpointConnectionName, Context context) { + return beginDeleteAsync(resourceGroupName, accountName, privateEndpointConnectionName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String accountName, String privateEndpointConnectionName) { + deleteAsync(resourceGroupName, accountName, privateEndpointConnectionName).block(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, String accountName, String privateEndpointConnectionName, Context context) { + deleteAsync(resourceGroupName, accountName, privateEndpointConnectionName, context).block(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateEndpointConnectionsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateEndpointConnectionsImpl.java new file mode 100644 index 0000000000000..1c8e7b8cd52a3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateEndpointConnectionsImpl.java @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.cosmos.generated.models.PrivateEndpointConnection; +import com.azure.resourcemanager.cosmos.generated.models.PrivateEndpointConnections; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PrivateEndpointConnectionsImpl implements PrivateEndpointConnections { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionsImpl.class); + + private final PrivateEndpointConnectionsClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public PrivateEndpointConnectionsImpl( + PrivateEndpointConnectionsClient innerClient, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByDatabaseAccount( + String resourceGroupName, String accountName) { + PagedIterable inner = + this.serviceClient().listByDatabaseAccount(resourceGroupName, accountName); + return Utils.mapPage(inner, inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabaseAccount( + String resourceGroupName, String accountName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabaseAccount(resourceGroupName, accountName, context); + return Utils.mapPage(inner, inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())); + } + + public PrivateEndpointConnection get( + String resourceGroupName, String accountName, String privateEndpointConnectionName) { + PrivateEndpointConnectionInner inner = + this.serviceClient().get(resourceGroupName, accountName, privateEndpointConnectionName); + if (inner != null) { + return new PrivateEndpointConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String accountName, String privateEndpointConnectionName, Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, accountName, privateEndpointConnectionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PrivateEndpointConnectionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String accountName, String privateEndpointConnectionName) { + this.serviceClient().delete(resourceGroupName, accountName, privateEndpointConnectionName); + } + + public void delete( + String resourceGroupName, String accountName, String privateEndpointConnectionName, Context context) { + this.serviceClient().delete(resourceGroupName, accountName, privateEndpointConnectionName, context); + } + + public PrivateEndpointConnection getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + return this + .getWithResponse(resourceGroupName, accountName, privateEndpointConnectionName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + return this.getWithResponse(resourceGroupName, accountName, privateEndpointConnectionName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + this.delete(resourceGroupName, accountName, privateEndpointConnectionName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + this.delete(resourceGroupName, accountName, privateEndpointConnectionName, context); + } + + private PrivateEndpointConnectionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + public PrivateEndpointConnectionImpl define(String name) { + return new PrivateEndpointConnectionImpl(name, this.manager()); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateLinkResourceImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateLinkResourceImpl.java new file mode 100644 index 0000000000000..7c35846d0da78 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateLinkResourceImpl.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.cosmos.generated.models.PrivateLinkResource; +import java.util.Collections; +import java.util.List; + +public final class PrivateLinkResourceImpl implements PrivateLinkResource { + private PrivateLinkResourceInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + PrivateLinkResourceImpl( + PrivateLinkResourceInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String groupId() { + return this.innerModel().groupId(); + } + + public List requiredMembers() { + List inner = this.innerModel().requiredMembers(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List requiredZoneNames() { + List inner = this.innerModel().requiredZoneNames(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public PrivateLinkResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateLinkResourcesClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateLinkResourcesClientImpl.java new file mode 100644 index 0000000000000..0bc87c39f2e2c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateLinkResourcesClientImpl.java @@ -0,0 +1,423 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.cosmos.generated.models.PrivateLinkResourceListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PrivateLinkResourcesClient. */ +public final class PrivateLinkResourcesClientImpl implements PrivateLinkResourcesClient { + private final ClientLogger logger = new ClientLogger(PrivateLinkResourcesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PrivateLinkResourcesService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of PrivateLinkResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateLinkResourcesClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy + .create(PrivateLinkResourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientPrivateLinkResources to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface PrivateLinkResourcesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/privateLinkResources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabaseAccount( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("accountName") String accountName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/privateLinkResources/{groupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("accountName") String accountName, + @PathParam("groupName") String groupName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the private link resources that need to be created for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseAccountSinglePageAsync( + String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabaseAccount( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the private link resources that need to be created for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseAccountSinglePageAsync( + String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabaseAccount( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Gets the private link resources that need to be created for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAccountAsync( + String resourceGroupName, String accountName) { + return new PagedFlux<>(() -> listByDatabaseAccountSinglePageAsync(resourceGroupName, accountName)); + } + + /** + * Gets the private link resources that need to be created for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAccountAsync( + String resourceGroupName, String accountName, Context context) { + return new PagedFlux<>(() -> listByDatabaseAccountSinglePageAsync(resourceGroupName, accountName, context)); + } + + /** + * Gets the private link resources that need to be created for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabaseAccount(String resourceGroupName, String accountName) { + return new PagedIterable<>(listByDatabaseAccountAsync(resourceGroupName, accountName)); + } + + /** + * Gets the private link resources that need to be created for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabaseAccount( + String resourceGroupName, String accountName, Context context) { + return new PagedIterable<>(listByDatabaseAccountAsync(resourceGroupName, accountName, context)); + } + + /** + * Gets the private link resources that need to be created for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param groupName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String accountName, String groupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (groupName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + groupName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the private link resources that need to be created for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param groupName The name of the private link resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String accountName, String groupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (groupName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + groupName, + accept, + context); + } + + /** + * Gets the private link resources that need to be created for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param groupName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String accountName, String groupName) { + return getWithResponseAsync(resourceGroupName, accountName, groupName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the private link resources that need to be created for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param groupName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateLinkResourceInner get(String resourceGroupName, String accountName, String groupName) { + return getAsync(resourceGroupName, accountName, groupName).block(); + } + + /** + * Gets the private link resources that need to be created for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param groupName The name of the private link resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String accountName, String groupName, Context context) { + return getWithResponseAsync(resourceGroupName, accountName, groupName, context).block(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateLinkResourcesImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateLinkResourcesImpl.java new file mode 100644 index 0000000000000..1959fc6f18e44 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateLinkResourcesImpl.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.cosmos.generated.models.PrivateLinkResource; +import com.azure.resourcemanager.cosmos.generated.models.PrivateLinkResources; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PrivateLinkResourcesImpl implements PrivateLinkResources { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkResourcesImpl.class); + + private final PrivateLinkResourcesClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public PrivateLinkResourcesImpl( + PrivateLinkResourcesClient innerClient, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByDatabaseAccount(String resourceGroupName, String accountName) { + PagedIterable inner = + this.serviceClient().listByDatabaseAccount(resourceGroupName, accountName); + return Utils.mapPage(inner, inner1 -> new PrivateLinkResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabaseAccount( + String resourceGroupName, String accountName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabaseAccount(resourceGroupName, accountName, context); + return Utils.mapPage(inner, inner1 -> new PrivateLinkResourceImpl(inner1, this.manager())); + } + + public PrivateLinkResource get(String resourceGroupName, String accountName, String groupName) { + PrivateLinkResourceInner inner = this.serviceClient().get(resourceGroupName, accountName, groupName); + if (inner != null) { + return new PrivateLinkResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String accountName, String groupName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, accountName, groupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PrivateLinkResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private PrivateLinkResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableDatabaseAccountGetResultImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableDatabaseAccountGetResultImpl.java new file mode 100644 index 0000000000000..5d201b80c7fb8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableDatabaseAccountGetResultImpl.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableDatabaseAccountGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.ApiType; +import com.azure.resourcemanager.cosmos.generated.models.RestorableDatabaseAccountGetResult; +import com.azure.resourcemanager.cosmos.generated.models.RestorableLocationResource; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class RestorableDatabaseAccountGetResultImpl implements RestorableDatabaseAccountGetResult { + private RestorableDatabaseAccountGetResultInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + RestorableDatabaseAccountGetResultImpl( + RestorableDatabaseAccountGetResultInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public String accountName() { + return this.innerModel().accountName(); + } + + public OffsetDateTime creationTime() { + return this.innerModel().creationTime(); + } + + public OffsetDateTime deletionTime() { + return this.innerModel().deletionTime(); + } + + public ApiType apiType() { + return this.innerModel().apiType(); + } + + public List restorableLocations() { + List inner = this.innerModel().restorableLocations(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public RestorableDatabaseAccountGetResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableDatabaseAccountsClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableDatabaseAccountsClientImpl.java new file mode 100644 index 0000000000000..1b59a6f4c803d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableDatabaseAccountsClientImpl.java @@ -0,0 +1,545 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.RestorableDatabaseAccountsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableDatabaseAccountGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableDatabaseAccountsListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RestorableDatabaseAccountsClient. */ +public final class RestorableDatabaseAccountsClientImpl implements RestorableDatabaseAccountsClient { + private final ClientLogger logger = new ClientLogger(RestorableDatabaseAccountsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final RestorableDatabaseAccountsService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of RestorableDatabaseAccountsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RestorableDatabaseAccountsClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy + .create( + RestorableDatabaseAccountsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientRestorableDatabaseAccounts to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface RestorableDatabaseAccountsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}" + + "/restorableDatabaseAccounts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByLocation( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/restorableDatabaseAccounts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}" + + "/restorableDatabaseAccounts/{instanceId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByLocation( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, + @PathParam("instanceId") String instanceId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all the restorable Azure Cosmos DB database accounts available under the subscription and in a region. This + * call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the restorable database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationSinglePageAsync( + String location) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByLocation( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all the restorable Azure Cosmos DB database accounts available under the subscription and in a region. This + * call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the restorable database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationSinglePageAsync( + String location, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByLocation( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Lists all the restorable Azure Cosmos DB database accounts available under the subscription and in a region. This + * call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the restorable database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByLocationAsync(String location) { + return new PagedFlux<>(() -> listByLocationSinglePageAsync(location)); + } + + /** + * Lists all the restorable Azure Cosmos DB database accounts available under the subscription and in a region. This + * call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the restorable database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByLocationAsync(String location, Context context) { + return new PagedFlux<>(() -> listByLocationSinglePageAsync(location, context)); + } + + /** + * Lists all the restorable Azure Cosmos DB database accounts available under the subscription and in a region. This + * call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the restorable database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByLocation(String location) { + return new PagedIterable<>(listByLocationAsync(location)); + } + + /** + * Lists all the restorable Azure Cosmos DB database accounts available under the subscription and in a region. This + * call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the restorable database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByLocation(String location, Context context) { + return new PagedIterable<>(listByLocationAsync(location, context)); + } + + /** + * Lists all the restorable Azure Cosmos DB database accounts available under the subscription. This call requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the restorable database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all the restorable Azure Cosmos DB database accounts available under the subscription. This call requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the restorable database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Lists all the restorable Azure Cosmos DB database accounts available under the subscription. This call requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the restorable database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync()); + } + + /** + * Lists all the restorable Azure Cosmos DB database accounts available under the subscription. This call requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the restorable database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context)); + } + + /** + * Lists all the restorable Azure Cosmos DB database accounts available under the subscription. This call requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the restorable database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all the restorable Azure Cosmos DB database accounts available under the subscription. This call requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the restorable database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB restorable database account. This call requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read/*' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Azure Cosmos DB restorable database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByLocationWithResponseAsync( + String location, String instanceId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByLocation( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + instanceId, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB restorable database account. This call requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read/*' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Azure Cosmos DB restorable database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByLocationWithResponseAsync( + String location, String instanceId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByLocation( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + instanceId, + accept, + context); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB restorable database account. This call requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read/*' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Azure Cosmos DB restorable database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByLocationAsync(String location, String instanceId) { + return getByLocationWithResponseAsync(location, instanceId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB restorable database account. This call requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read/*' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Azure Cosmos DB restorable database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RestorableDatabaseAccountGetResultInner getByLocation(String location, String instanceId) { + return getByLocationAsync(location, instanceId).block(); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB restorable database account. This call requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read/*' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Azure Cosmos DB restorable database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByLocationWithResponse( + String location, String instanceId, Context context) { + return getByLocationWithResponseAsync(location, instanceId, context).block(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableDatabaseAccountsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableDatabaseAccountsImpl.java new file mode 100644 index 0000000000000..ac76305206283 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableDatabaseAccountsImpl.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.RestorableDatabaseAccountsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableDatabaseAccountGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableDatabaseAccountGetResult; +import com.azure.resourcemanager.cosmos.generated.models.RestorableDatabaseAccounts; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class RestorableDatabaseAccountsImpl implements RestorableDatabaseAccounts { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableDatabaseAccountsImpl.class); + + private final RestorableDatabaseAccountsClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public RestorableDatabaseAccountsImpl( + RestorableDatabaseAccountsClient innerClient, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByLocation(String location) { + PagedIterable inner = this.serviceClient().listByLocation(location); + return Utils.mapPage(inner, inner1 -> new RestorableDatabaseAccountGetResultImpl(inner1, this.manager())); + } + + public PagedIterable listByLocation(String location, Context context) { + PagedIterable inner = + this.serviceClient().listByLocation(location, context); + return Utils.mapPage(inner, inner1 -> new RestorableDatabaseAccountGetResultImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new RestorableDatabaseAccountGetResultImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new RestorableDatabaseAccountGetResultImpl(inner1, this.manager())); + } + + public RestorableDatabaseAccountGetResult getByLocation(String location, String instanceId) { + RestorableDatabaseAccountGetResultInner inner = this.serviceClient().getByLocation(location, instanceId); + if (inner != null) { + return new RestorableDatabaseAccountGetResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByLocationWithResponse( + String location, String instanceId, Context context) { + Response inner = + this.serviceClient().getByLocationWithResponse(location, instanceId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RestorableDatabaseAccountGetResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private RestorableDatabaseAccountsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbCollectionGetResultImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbCollectionGetResultImpl.java new file mode 100644 index 0000000000000..9ce2a7c08c85c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbCollectionGetResultImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableMongodbCollectionGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbCollectionGetResult; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbCollectionPropertiesResource; + +public final class RestorableMongodbCollectionGetResultImpl implements RestorableMongodbCollectionGetResult { + private RestorableMongodbCollectionGetResultInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + RestorableMongodbCollectionGetResultImpl( + RestorableMongodbCollectionGetResultInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public RestorableMongodbCollectionPropertiesResource resource() { + return this.innerModel().resource(); + } + + public RestorableMongodbCollectionGetResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbCollectionsClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbCollectionsClientImpl.java new file mode 100644 index 0000000000000..a9c3c88b72834 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbCollectionsClientImpl.java @@ -0,0 +1,283 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.RestorableMongodbCollectionsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableMongodbCollectionGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbCollectionsListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RestorableMongodbCollectionsClient. */ +public final class RestorableMongodbCollectionsClientImpl implements RestorableMongodbCollectionsClient { + private final ClientLogger logger = new ClientLogger(RestorableMongodbCollectionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final RestorableMongodbCollectionsService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of RestorableMongodbCollectionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RestorableMongodbCollectionsClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy + .create( + RestorableMongodbCollectionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientRestorableMongodbCollections to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface RestorableMongodbCollectionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}" + + "/restorableDatabaseAccounts/{instanceId}/restorableMongodbCollections") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, + @PathParam("instanceId") String instanceId, + @QueryParam("restorableMongodbDatabaseRid") String restorableMongodbDatabaseRid, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB collections under a specific + * database. This helps in scenario where container was accidentally deleted. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restorableMongodbDatabaseRid The resource ID of the MongoDB database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the MongoDB collection events and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String location, String instanceId, String restorableMongodbDatabaseRid) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + instanceId, + restorableMongodbDatabaseRid, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB collections under a specific + * database. This helps in scenario where container was accidentally deleted. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restorableMongodbDatabaseRid The resource ID of the MongoDB database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the MongoDB collection events and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String location, String instanceId, String restorableMongodbDatabaseRid, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + instanceId, + restorableMongodbDatabaseRid, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB collections under a specific + * database. This helps in scenario where container was accidentally deleted. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restorableMongodbDatabaseRid The resource ID of the MongoDB database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the MongoDB collection events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String location, String instanceId, String restorableMongodbDatabaseRid) { + return new PagedFlux<>(() -> listSinglePageAsync(location, instanceId, restorableMongodbDatabaseRid)); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB collections under a specific + * database. This helps in scenario where container was accidentally deleted. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the MongoDB collection events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String location, String instanceId) { + final String restorableMongodbDatabaseRid = null; + return new PagedFlux<>(() -> listSinglePageAsync(location, instanceId, restorableMongodbDatabaseRid)); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB collections under a specific + * database. This helps in scenario where container was accidentally deleted. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restorableMongodbDatabaseRid The resource ID of the MongoDB database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the MongoDB collection events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String location, String instanceId, String restorableMongodbDatabaseRid, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(location, instanceId, restorableMongodbDatabaseRid, context)); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB collections under a specific + * database. This helps in scenario where container was accidentally deleted. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the MongoDB collection events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String location, String instanceId) { + final String restorableMongodbDatabaseRid = null; + return new PagedIterable<>(listAsync(location, instanceId, restorableMongodbDatabaseRid)); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB collections under a specific + * database. This helps in scenario where container was accidentally deleted. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restorableMongodbDatabaseRid The resource ID of the MongoDB database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the MongoDB collection events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String location, String instanceId, String restorableMongodbDatabaseRid, Context context) { + return new PagedIterable<>(listAsync(location, instanceId, restorableMongodbDatabaseRid, context)); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbCollectionsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbCollectionsImpl.java new file mode 100644 index 0000000000000..d5e43e72be814 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbCollectionsImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.RestorableMongodbCollectionsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableMongodbCollectionGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbCollectionGetResult; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbCollections; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class RestorableMongodbCollectionsImpl implements RestorableMongodbCollections { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableMongodbCollectionsImpl.class); + + private final RestorableMongodbCollectionsClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public RestorableMongodbCollectionsImpl( + RestorableMongodbCollectionsClient innerClient, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String location, String instanceId) { + PagedIterable inner = + this.serviceClient().list(location, instanceId); + return Utils.mapPage(inner, inner1 -> new RestorableMongodbCollectionGetResultImpl(inner1, this.manager())); + } + + public PagedIterable list( + String location, String instanceId, String restorableMongodbDatabaseRid, Context context) { + PagedIterable inner = + this.serviceClient().list(location, instanceId, restorableMongodbDatabaseRid, context); + return Utils.mapPage(inner, inner1 -> new RestorableMongodbCollectionGetResultImpl(inner1, this.manager())); + } + + private RestorableMongodbCollectionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbDatabaseGetResultImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbDatabaseGetResultImpl.java new file mode 100644 index 0000000000000..73b1aee282d2a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbDatabaseGetResultImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableMongodbDatabaseGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbDatabaseGetResult; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbDatabasePropertiesResource; + +public final class RestorableMongodbDatabaseGetResultImpl implements RestorableMongodbDatabaseGetResult { + private RestorableMongodbDatabaseGetResultInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + RestorableMongodbDatabaseGetResultImpl( + RestorableMongodbDatabaseGetResultInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public RestorableMongodbDatabasePropertiesResource resource() { + return this.innerModel().resource(); + } + + public RestorableMongodbDatabaseGetResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbDatabasesClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbDatabasesClientImpl.java new file mode 100644 index 0000000000000..4bc1cd9e57840 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbDatabasesClientImpl.java @@ -0,0 +1,255 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.RestorableMongodbDatabasesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableMongodbDatabaseGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbDatabasesListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RestorableMongodbDatabasesClient. */ +public final class RestorableMongodbDatabasesClientImpl implements RestorableMongodbDatabasesClient { + private final ClientLogger logger = new ClientLogger(RestorableMongodbDatabasesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final RestorableMongodbDatabasesService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of RestorableMongodbDatabasesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RestorableMongodbDatabasesClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy + .create( + RestorableMongodbDatabasesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientRestorableMongodbDatabases to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface RestorableMongodbDatabasesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}" + + "/restorableDatabaseAccounts/{instanceId}/restorableMongodbDatabases") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, + @PathParam("instanceId") String instanceId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB databases under the restorable + * account. This helps in scenario where database was accidentally deleted to get the deletion time. This API + * requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the MongoDB database events and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String location, String instanceId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + instanceId, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB databases under the restorable + * account. This helps in scenario where database was accidentally deleted to get the deletion time. This API + * requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the MongoDB database events and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String location, String instanceId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + instanceId, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB databases under the restorable + * account. This helps in scenario where database was accidentally deleted to get the deletion time. This API + * requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the MongoDB database events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String location, String instanceId) { + return new PagedFlux<>(() -> listSinglePageAsync(location, instanceId)); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB databases under the restorable + * account. This helps in scenario where database was accidentally deleted to get the deletion time. This API + * requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the MongoDB database events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String location, String instanceId, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(location, instanceId, context)); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB databases under the restorable + * account. This helps in scenario where database was accidentally deleted to get the deletion time. This API + * requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the MongoDB database events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String location, String instanceId) { + return new PagedIterable<>(listAsync(location, instanceId)); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB databases under the restorable + * account. This helps in scenario where database was accidentally deleted to get the deletion time. This API + * requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the MongoDB database events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String location, String instanceId, Context context) { + return new PagedIterable<>(listAsync(location, instanceId, context)); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbDatabasesImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbDatabasesImpl.java new file mode 100644 index 0000000000000..2dfa5e0198083 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbDatabasesImpl.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.RestorableMongodbDatabasesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableMongodbDatabaseGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbDatabaseGetResult; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbDatabases; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class RestorableMongodbDatabasesImpl implements RestorableMongodbDatabases { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableMongodbDatabasesImpl.class); + + private final RestorableMongodbDatabasesClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public RestorableMongodbDatabasesImpl( + RestorableMongodbDatabasesClient innerClient, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String location, String instanceId) { + PagedIterable inner = this.serviceClient().list(location, instanceId); + return Utils.mapPage(inner, inner1 -> new RestorableMongodbDatabaseGetResultImpl(inner1, this.manager())); + } + + public PagedIterable list(String location, String instanceId, Context context) { + PagedIterable inner = + this.serviceClient().list(location, instanceId, context); + return Utils.mapPage(inner, inner1 -> new RestorableMongodbDatabaseGetResultImpl(inner1, this.manager())); + } + + private RestorableMongodbDatabasesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbResourcesClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbResourcesClientImpl.java new file mode 100644 index 0000000000000..3874a5d4a3679 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbResourcesClientImpl.java @@ -0,0 +1,294 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.RestorableMongodbResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseRestoreResourceInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbResourcesListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RestorableMongodbResourcesClient. */ +public final class RestorableMongodbResourcesClientImpl implements RestorableMongodbResourcesClient { + private final ClientLogger logger = new ClientLogger(RestorableMongodbResourcesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final RestorableMongodbResourcesService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of RestorableMongodbResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RestorableMongodbResourcesClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy + .create( + RestorableMongodbResourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientRestorableMongodbResources to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface RestorableMongodbResourcesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}" + + "/restorableDatabaseAccounts/{instanceId}/restorableMongodbResources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, + @PathParam("instanceId") String instanceId, + @QueryParam("restoreLocation") String restoreLocation, + @QueryParam("restoreTimestampInUtc") String restoreTimestampInUtc, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Return a list of database and collection combo that exist on the account at the given timestamp and location. + * This helps in scenarios to validate what resources exist at given timestamp and location. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restoreLocation The location where the restorable resources are located. + * @param restoreTimestampInUtc The timestamp when the restorable resources existed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the restorable MongoDB resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String location, String instanceId, String restoreLocation, String restoreTimestampInUtc) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + instanceId, + restoreLocation, + restoreTimestampInUtc, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Return a list of database and collection combo that exist on the account at the given timestamp and location. + * This helps in scenarios to validate what resources exist at given timestamp and location. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restoreLocation The location where the restorable resources are located. + * @param restoreTimestampInUtc The timestamp when the restorable resources existed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the restorable MongoDB resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String location, String instanceId, String restoreLocation, String restoreTimestampInUtc, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + instanceId, + restoreLocation, + restoreTimestampInUtc, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Return a list of database and collection combo that exist on the account at the given timestamp and location. + * This helps in scenarios to validate what resources exist at given timestamp and location. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restoreLocation The location where the restorable resources are located. + * @param restoreTimestampInUtc The timestamp when the restorable resources existed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the restorable MongoDB resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String location, String instanceId, String restoreLocation, String restoreTimestampInUtc) { + return new PagedFlux<>(() -> listSinglePageAsync(location, instanceId, restoreLocation, restoreTimestampInUtc)); + } + + /** + * Return a list of database and collection combo that exist on the account at the given timestamp and location. + * This helps in scenarios to validate what resources exist at given timestamp and location. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the restorable MongoDB resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String location, String instanceId) { + final String restoreLocation = null; + final String restoreTimestampInUtc = null; + return new PagedFlux<>(() -> listSinglePageAsync(location, instanceId, restoreLocation, restoreTimestampInUtc)); + } + + /** + * Return a list of database and collection combo that exist on the account at the given timestamp and location. + * This helps in scenarios to validate what resources exist at given timestamp and location. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restoreLocation The location where the restorable resources are located. + * @param restoreTimestampInUtc The timestamp when the restorable resources existed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the restorable MongoDB resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String location, String instanceId, String restoreLocation, String restoreTimestampInUtc, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(location, instanceId, restoreLocation, restoreTimestampInUtc, context)); + } + + /** + * Return a list of database and collection combo that exist on the account at the given timestamp and location. + * This helps in scenarios to validate what resources exist at given timestamp and location. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the restorable MongoDB resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String location, String instanceId) { + final String restoreLocation = null; + final String restoreTimestampInUtc = null; + return new PagedIterable<>(listAsync(location, instanceId, restoreLocation, restoreTimestampInUtc)); + } + + /** + * Return a list of database and collection combo that exist on the account at the given timestamp and location. + * This helps in scenarios to validate what resources exist at given timestamp and location. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restoreLocation The location where the restorable resources are located. + * @param restoreTimestampInUtc The timestamp when the restorable resources existed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the restorable MongoDB resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String location, String instanceId, String restoreLocation, String restoreTimestampInUtc, Context context) { + return new PagedIterable<>(listAsync(location, instanceId, restoreLocation, restoreTimestampInUtc, context)); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbResourcesImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbResourcesImpl.java new file mode 100644 index 0000000000000..e7746c23e0f48 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbResourcesImpl.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.RestorableMongodbResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseRestoreResourceInner; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseRestoreResource; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbResources; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class RestorableMongodbResourcesImpl implements RestorableMongodbResources { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableMongodbResourcesImpl.class); + + private final RestorableMongodbResourcesClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public RestorableMongodbResourcesImpl( + RestorableMongodbResourcesClient innerClient, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String location, String instanceId) { + PagedIterable inner = this.serviceClient().list(location, instanceId); + return Utils.mapPage(inner, inner1 -> new DatabaseRestoreResourceImpl(inner1, this.manager())); + } + + public PagedIterable list( + String location, String instanceId, String restoreLocation, String restoreTimestampInUtc, Context context) { + PagedIterable inner = + this.serviceClient().list(location, instanceId, restoreLocation, restoreTimestampInUtc, context); + return Utils.mapPage(inner, inner1 -> new DatabaseRestoreResourceImpl(inner1, this.manager())); + } + + private RestorableMongodbResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlContainerGetResultImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlContainerGetResultImpl.java new file mode 100644 index 0000000000000..7a0629d1d88c2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlContainerGetResultImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableSqlContainerGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlContainerGetResult; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlContainerPropertiesResource; + +public final class RestorableSqlContainerGetResultImpl implements RestorableSqlContainerGetResult { + private RestorableSqlContainerGetResultInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + RestorableSqlContainerGetResultImpl( + RestorableSqlContainerGetResultInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public RestorableSqlContainerPropertiesResource resource() { + return this.innerModel().resource(); + } + + public RestorableSqlContainerGetResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlContainersClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlContainersClientImpl.java new file mode 100644 index 0000000000000..0806c99803374 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlContainersClientImpl.java @@ -0,0 +1,321 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.RestorableSqlContainersClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableSqlContainerGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlContainersListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RestorableSqlContainersClient. */ +public final class RestorableSqlContainersClientImpl implements RestorableSqlContainersClient { + private final ClientLogger logger = new ClientLogger(RestorableSqlContainersClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final RestorableSqlContainersService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of RestorableSqlContainersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RestorableSqlContainersClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy + .create(RestorableSqlContainersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientRestorableSqlContainers to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface RestorableSqlContainersService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}" + + "/restorableDatabaseAccounts/{instanceId}/restorableSqlContainers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, + @PathParam("instanceId") String instanceId, + @QueryParam("restorableSqlDatabaseRid") String restorableSqlDatabaseRid, + @QueryParam("startTime") String startTime, + @QueryParam("endTime") String endTime, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB SQL containers under a specific database. + * This helps in scenario where container was accidentally deleted. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restorableSqlDatabaseRid The resource ID of the SQL database. + * @param startTime The snapshot create timestamp after which snapshots need to be listed. + * @param endTime The snapshot create timestamp before which snapshots need to be listed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the SQL container events and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String location, String instanceId, String restorableSqlDatabaseRid, String startTime, String endTime) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + instanceId, + restorableSqlDatabaseRid, + startTime, + endTime, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB SQL containers under a specific database. + * This helps in scenario where container was accidentally deleted. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restorableSqlDatabaseRid The resource ID of the SQL database. + * @param startTime The snapshot create timestamp after which snapshots need to be listed. + * @param endTime The snapshot create timestamp before which snapshots need to be listed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the SQL container events and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String location, + String instanceId, + String restorableSqlDatabaseRid, + String startTime, + String endTime, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + instanceId, + restorableSqlDatabaseRid, + startTime, + endTime, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB SQL containers under a specific database. + * This helps in scenario where container was accidentally deleted. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restorableSqlDatabaseRid The resource ID of the SQL database. + * @param startTime The snapshot create timestamp after which snapshots need to be listed. + * @param endTime The snapshot create timestamp before which snapshots need to be listed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the SQL container events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String location, String instanceId, String restorableSqlDatabaseRid, String startTime, String endTime) { + return new PagedFlux<>( + () -> listSinglePageAsync(location, instanceId, restorableSqlDatabaseRid, startTime, endTime)); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB SQL containers under a specific database. + * This helps in scenario where container was accidentally deleted. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the SQL container events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String location, String instanceId) { + final String restorableSqlDatabaseRid = null; + final String startTime = null; + final String endTime = null; + return new PagedFlux<>( + () -> listSinglePageAsync(location, instanceId, restorableSqlDatabaseRid, startTime, endTime)); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB SQL containers under a specific database. + * This helps in scenario where container was accidentally deleted. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restorableSqlDatabaseRid The resource ID of the SQL database. + * @param startTime The snapshot create timestamp after which snapshots need to be listed. + * @param endTime The snapshot create timestamp before which snapshots need to be listed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the SQL container events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String location, + String instanceId, + String restorableSqlDatabaseRid, + String startTime, + String endTime, + Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(location, instanceId, restorableSqlDatabaseRid, startTime, endTime, context)); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB SQL containers under a specific database. + * This helps in scenario where container was accidentally deleted. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the SQL container events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String location, String instanceId) { + final String restorableSqlDatabaseRid = null; + final String startTime = null; + final String endTime = null; + return new PagedIterable<>(listAsync(location, instanceId, restorableSqlDatabaseRid, startTime, endTime)); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB SQL containers under a specific database. + * This helps in scenario where container was accidentally deleted. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restorableSqlDatabaseRid The resource ID of the SQL database. + * @param startTime The snapshot create timestamp after which snapshots need to be listed. + * @param endTime The snapshot create timestamp before which snapshots need to be listed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the SQL container events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String location, + String instanceId, + String restorableSqlDatabaseRid, + String startTime, + String endTime, + Context context) { + return new PagedIterable<>( + listAsync(location, instanceId, restorableSqlDatabaseRid, startTime, endTime, context)); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlContainersImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlContainersImpl.java new file mode 100644 index 0000000000000..72bac7350c48d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlContainersImpl.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.RestorableSqlContainersClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableSqlContainerGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlContainerGetResult; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlContainers; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class RestorableSqlContainersImpl implements RestorableSqlContainers { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableSqlContainersImpl.class); + + private final RestorableSqlContainersClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public RestorableSqlContainersImpl( + RestorableSqlContainersClient innerClient, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String location, String instanceId) { + PagedIterable inner = this.serviceClient().list(location, instanceId); + return Utils.mapPage(inner, inner1 -> new RestorableSqlContainerGetResultImpl(inner1, this.manager())); + } + + public PagedIterable list( + String location, + String instanceId, + String restorableSqlDatabaseRid, + String startTime, + String endTime, + Context context) { + PagedIterable inner = + this.serviceClient().list(location, instanceId, restorableSqlDatabaseRid, startTime, endTime, context); + return Utils.mapPage(inner, inner1 -> new RestorableSqlContainerGetResultImpl(inner1, this.manager())); + } + + private RestorableSqlContainersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlDatabaseGetResultImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlDatabaseGetResultImpl.java new file mode 100644 index 0000000000000..1bf685340975e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlDatabaseGetResultImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableSqlDatabaseGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlDatabaseGetResult; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlDatabasePropertiesResource; + +public final class RestorableSqlDatabaseGetResultImpl implements RestorableSqlDatabaseGetResult { + private RestorableSqlDatabaseGetResultInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + RestorableSqlDatabaseGetResultImpl( + RestorableSqlDatabaseGetResultInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public RestorableSqlDatabasePropertiesResource resource() { + return this.innerModel().resource(); + } + + public RestorableSqlDatabaseGetResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlDatabasesClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlDatabasesClientImpl.java new file mode 100644 index 0000000000000..93c67eb801d30 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlDatabasesClientImpl.java @@ -0,0 +1,254 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.RestorableSqlDatabasesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableSqlDatabaseGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlDatabasesListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RestorableSqlDatabasesClient. */ +public final class RestorableSqlDatabasesClientImpl implements RestorableSqlDatabasesClient { + private final ClientLogger logger = new ClientLogger(RestorableSqlDatabasesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final RestorableSqlDatabasesService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of RestorableSqlDatabasesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RestorableSqlDatabasesClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy + .create(RestorableSqlDatabasesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientRestorableSqlDatabases to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface RestorableSqlDatabasesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}" + + "/restorableDatabaseAccounts/{instanceId}/restorableSqlDatabases") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, + @PathParam("instanceId") String instanceId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB SQL databases under the restorable account. + * This helps in scenario where database was accidentally deleted to get the deletion time. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the SQL database events and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String location, String instanceId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + instanceId, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB SQL databases under the restorable account. + * This helps in scenario where database was accidentally deleted to get the deletion time. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the SQL database events and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String location, String instanceId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + instanceId, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB SQL databases under the restorable account. + * This helps in scenario where database was accidentally deleted to get the deletion time. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the SQL database events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String location, String instanceId) { + return new PagedFlux<>(() -> listSinglePageAsync(location, instanceId)); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB SQL databases under the restorable account. + * This helps in scenario where database was accidentally deleted to get the deletion time. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the SQL database events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String location, String instanceId, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(location, instanceId, context)); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB SQL databases under the restorable account. + * This helps in scenario where database was accidentally deleted to get the deletion time. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the SQL database events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String location, String instanceId) { + return new PagedIterable<>(listAsync(location, instanceId)); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB SQL databases under the restorable account. + * This helps in scenario where database was accidentally deleted to get the deletion time. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the SQL database events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String location, String instanceId, Context context) { + return new PagedIterable<>(listAsync(location, instanceId, context)); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlDatabasesImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlDatabasesImpl.java new file mode 100644 index 0000000000000..ce882c2e2eba3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlDatabasesImpl.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.RestorableSqlDatabasesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableSqlDatabaseGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlDatabaseGetResult; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlDatabases; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class RestorableSqlDatabasesImpl implements RestorableSqlDatabases { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableSqlDatabasesImpl.class); + + private final RestorableSqlDatabasesClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public RestorableSqlDatabasesImpl( + RestorableSqlDatabasesClient innerClient, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String location, String instanceId) { + PagedIterable inner = this.serviceClient().list(location, instanceId); + return Utils.mapPage(inner, inner1 -> new RestorableSqlDatabaseGetResultImpl(inner1, this.manager())); + } + + public PagedIterable list(String location, String instanceId, Context context) { + PagedIterable inner = + this.serviceClient().list(location, instanceId, context); + return Utils.mapPage(inner, inner1 -> new RestorableSqlDatabaseGetResultImpl(inner1, this.manager())); + } + + private RestorableSqlDatabasesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlResourcesClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlResourcesClientImpl.java new file mode 100644 index 0000000000000..6f3380132335c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlResourcesClientImpl.java @@ -0,0 +1,293 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.RestorableSqlResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseRestoreResourceInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlResourcesListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RestorableSqlResourcesClient. */ +public final class RestorableSqlResourcesClientImpl implements RestorableSqlResourcesClient { + private final ClientLogger logger = new ClientLogger(RestorableSqlResourcesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final RestorableSqlResourcesService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of RestorableSqlResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RestorableSqlResourcesClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy + .create(RestorableSqlResourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientRestorableSqlResources to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface RestorableSqlResourcesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}" + + "/restorableDatabaseAccounts/{instanceId}/restorableSqlResources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, + @PathParam("instanceId") String instanceId, + @QueryParam("restoreLocation") String restoreLocation, + @QueryParam("restoreTimestampInUtc") String restoreTimestampInUtc, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Return a list of database and container combo that exist on the account at the given timestamp and location. This + * helps in scenarios to validate what resources exist at given timestamp and location. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restoreLocation The location where the restorable resources are located. + * @param restoreTimestampInUtc The timestamp when the restorable resources existed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the restorable SQL resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String location, String instanceId, String restoreLocation, String restoreTimestampInUtc) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + instanceId, + restoreLocation, + restoreTimestampInUtc, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Return a list of database and container combo that exist on the account at the given timestamp and location. This + * helps in scenarios to validate what resources exist at given timestamp and location. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restoreLocation The location where the restorable resources are located. + * @param restoreTimestampInUtc The timestamp when the restorable resources existed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the restorable SQL resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String location, String instanceId, String restoreLocation, String restoreTimestampInUtc, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + instanceId, + restoreLocation, + restoreTimestampInUtc, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Return a list of database and container combo that exist on the account at the given timestamp and location. This + * helps in scenarios to validate what resources exist at given timestamp and location. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restoreLocation The location where the restorable resources are located. + * @param restoreTimestampInUtc The timestamp when the restorable resources existed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the restorable SQL resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String location, String instanceId, String restoreLocation, String restoreTimestampInUtc) { + return new PagedFlux<>(() -> listSinglePageAsync(location, instanceId, restoreLocation, restoreTimestampInUtc)); + } + + /** + * Return a list of database and container combo that exist on the account at the given timestamp and location. This + * helps in scenarios to validate what resources exist at given timestamp and location. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the restorable SQL resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String location, String instanceId) { + final String restoreLocation = null; + final String restoreTimestampInUtc = null; + return new PagedFlux<>(() -> listSinglePageAsync(location, instanceId, restoreLocation, restoreTimestampInUtc)); + } + + /** + * Return a list of database and container combo that exist on the account at the given timestamp and location. This + * helps in scenarios to validate what resources exist at given timestamp and location. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restoreLocation The location where the restorable resources are located. + * @param restoreTimestampInUtc The timestamp when the restorable resources existed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the restorable SQL resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String location, String instanceId, String restoreLocation, String restoreTimestampInUtc, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(location, instanceId, restoreLocation, restoreTimestampInUtc, context)); + } + + /** + * Return a list of database and container combo that exist on the account at the given timestamp and location. This + * helps in scenarios to validate what resources exist at given timestamp and location. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the restorable SQL resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String location, String instanceId) { + final String restoreLocation = null; + final String restoreTimestampInUtc = null; + return new PagedIterable<>(listAsync(location, instanceId, restoreLocation, restoreTimestampInUtc)); + } + + /** + * Return a list of database and container combo that exist on the account at the given timestamp and location. This + * helps in scenarios to validate what resources exist at given timestamp and location. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restoreLocation The location where the restorable resources are located. + * @param restoreTimestampInUtc The timestamp when the restorable resources existed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the restorable SQL resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String location, String instanceId, String restoreLocation, String restoreTimestampInUtc, Context context) { + return new PagedIterable<>(listAsync(location, instanceId, restoreLocation, restoreTimestampInUtc, context)); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlResourcesImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlResourcesImpl.java new file mode 100644 index 0000000000000..94eb475f1bd03 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlResourcesImpl.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.RestorableSqlResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseRestoreResourceInner; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseRestoreResource; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlResources; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class RestorableSqlResourcesImpl implements RestorableSqlResources { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableSqlResourcesImpl.class); + + private final RestorableSqlResourcesClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public RestorableSqlResourcesImpl( + RestorableSqlResourcesClient innerClient, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String location, String instanceId) { + PagedIterable inner = this.serviceClient().list(location, instanceId); + return Utils.mapPage(inner, inner1 -> new DatabaseRestoreResourceImpl(inner1, this.manager())); + } + + public PagedIterable list( + String location, String instanceId, String restoreLocation, String restoreTimestampInUtc, Context context) { + PagedIterable inner = + this.serviceClient().list(location, instanceId, restoreLocation, restoreTimestampInUtc, context); + return Utils.mapPage(inner, inner1 -> new DatabaseRestoreResourceImpl(inner1, this.manager())); + } + + private RestorableSqlResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/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..db092ba6ef2d5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlContainerGetResultsImpl.java @@ -0,0 +1,256 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.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 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..7e235cc044b01 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlDatabaseGetResultsImpl.java @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.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 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..56af947c04295 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlResourcesClientImpl.java @@ -0,0 +1,10755 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.cosmos.generated.fluent.SqlResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.BackupInformationInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlContainerGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlDatabaseGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlRoleAssignmentGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlRoleDefinitionGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlStoredProcedureGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlTriggerGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlUserDefinedFunctionGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ThroughputSettingsGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.ContinuousBackupRestoreLocation; +import com.azure.resourcemanager.cosmos.generated.models.SqlContainerCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.SqlContainerListResult; +import com.azure.resourcemanager.cosmos.generated.models.SqlDatabaseCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.SqlDatabaseListResult; +import com.azure.resourcemanager.cosmos.generated.models.SqlRoleAssignmentCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.SqlRoleAssignmentListResult; +import com.azure.resourcemanager.cosmos.generated.models.SqlRoleDefinitionCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.SqlRoleDefinitionListResult; +import com.azure.resourcemanager.cosmos.generated.models.SqlStoredProcedureCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.SqlStoredProcedureListResult; +import com.azure.resourcemanager.cosmos.generated.models.SqlTriggerCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.SqlTriggerListResult; +import com.azure.resourcemanager.cosmos.generated.models.SqlUserDefinedFunctionCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.SqlUserDefinedFunctionListResult; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SqlResourcesClient. */ +public final class SqlResourcesClientImpl implements SqlResourcesClient { + private final ClientLogger logger = new ClientLogger(SqlResourcesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final SqlResourcesService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of SqlResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SqlResourcesClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy.create(SqlResourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientSqlResources to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface SqlResourcesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listSqlDatabases( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getSqlDatabase( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createUpdateSqlDatabase( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SqlDatabaseCreateUpdateParameters createUpdateSqlDatabaseParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> deleteSqlDatabase( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getSqlDatabaseThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> updateSqlDatabaseThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ThroughputSettingsUpdateParameters updateThroughputParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default" + + "/migrateToAutoscale") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> migrateSqlDatabaseToAutoscale( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default" + + "/migrateToManualThroughput") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> migrateSqlDatabaseToManualThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listSqlContainers( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getSqlContainer( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("containerName") String containerName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createUpdateSqlContainer( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("containerName") String containerName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> deleteSqlContainer( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("containerName") String containerName, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}" + + "/throughputSettings/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getSqlContainerThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("containerName") String containerName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}" + + "/throughputSettings/default") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> updateSqlContainerThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("containerName") String containerName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ThroughputSettingsUpdateParameters updateThroughputParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}" + + "/throughputSettings/default/migrateToAutoscale") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> migrateSqlContainerToAutoscale( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("containerName") String containerName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}" + + "/throughputSettings/default/migrateToManualThroughput") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> migrateSqlContainerToManualThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("containerName") String containerName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}" + + "/storedProcedures") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listSqlStoredProcedures( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("containerName") String containerName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}" + + "/storedProcedures/{storedProcedureName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getSqlStoredProcedure( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("containerName") String containerName, + @PathParam("storedProcedureName") String storedProcedureName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}" + + "/storedProcedures/{storedProcedureName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createUpdateSqlStoredProcedure( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("containerName") String containerName, + @PathParam("storedProcedureName") String storedProcedureName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") + SqlStoredProcedureCreateUpdateParameters createUpdateSqlStoredProcedureParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}" + + "/storedProcedures/{storedProcedureName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> deleteSqlStoredProcedure( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("containerName") String containerName, + @PathParam("storedProcedureName") String storedProcedureName, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}" + + "/userDefinedFunctions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listSqlUserDefinedFunctions( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("containerName") String containerName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}" + + "/userDefinedFunctions/{userDefinedFunctionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getSqlUserDefinedFunction( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("containerName") String containerName, + @PathParam("userDefinedFunctionName") String userDefinedFunctionName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}" + + "/userDefinedFunctions/{userDefinedFunctionName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createUpdateSqlUserDefinedFunction( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("containerName") String containerName, + @PathParam("userDefinedFunctionName") String userDefinedFunctionName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") + SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}" + + "/userDefinedFunctions/{userDefinedFunctionName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> deleteSqlUserDefinedFunction( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("containerName") String containerName, + @PathParam("userDefinedFunctionName") String userDefinedFunctionName, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listSqlTriggers( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("containerName") String containerName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers" + + "/{triggerName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getSqlTrigger( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("containerName") String containerName, + @PathParam("triggerName") String triggerName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers" + + "/{triggerName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createUpdateSqlTrigger( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("containerName") String containerName, + @PathParam("triggerName") String triggerName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers" + + "/{triggerName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> deleteSqlTrigger( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("containerName") String containerName, + @PathParam("triggerName") String triggerName, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlRoleDefinitions/{roleDefinitionId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getSqlRoleDefinition( + @HostParam("$host") String endpoint, + @PathParam("roleDefinitionId") String roleDefinitionId, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlRoleDefinitions/{roleDefinitionId}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createUpdateSqlRoleDefinition( + @HostParam("$host") String endpoint, + @PathParam("roleDefinitionId") String roleDefinitionId, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") + SqlRoleDefinitionCreateUpdateParameters createUpdateSqlRoleDefinitionParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlRoleDefinitions/{roleDefinitionId}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> deleteSqlRoleDefinition( + @HostParam("$host") String endpoint, + @PathParam("roleDefinitionId") String roleDefinitionId, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlRoleDefinitions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listSqlRoleDefinitions( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getSqlRoleAssignment( + @HostParam("$host") String endpoint, + @PathParam("roleAssignmentId") String roleAssignmentId, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createUpdateSqlRoleAssignment( + @HostParam("$host") String endpoint, + @PathParam("roleAssignmentId") String roleAssignmentId, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") + SqlRoleAssignmentCreateUpdateParameters createUpdateSqlRoleAssignmentParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> deleteSqlRoleAssignment( + @HostParam("$host") String endpoint, + @PathParam("roleAssignmentId") String roleAssignmentId, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlRoleAssignments") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listSqlRoleAssignments( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}" + + "/retrieveContinuousBackupInformation") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> retrieveContinuousBackupInformation( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("containerName") String containerName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ContinuousBackupRestoreLocation location, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the SQL databases under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the SQL databases and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSqlDatabasesSinglePageAsync( + String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listSqlDatabases( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the SQL databases under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the SQL databases and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSqlDatabasesSinglePageAsync( + String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listSqlDatabases( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Lists the SQL databases under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the SQL databases and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listSqlDatabasesAsync(String resourceGroupName, String accountName) { + return new PagedFlux<>(() -> listSqlDatabasesSinglePageAsync(resourceGroupName, accountName)); + } + + /** + * Lists the SQL databases under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the SQL databases and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listSqlDatabasesAsync( + String resourceGroupName, String accountName, Context context) { + return new PagedFlux<>(() -> listSqlDatabasesSinglePageAsync(resourceGroupName, accountName, context)); + } + + /** + * Lists the SQL databases under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the SQL databases and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSqlDatabases(String resourceGroupName, String accountName) { + return new PagedIterable<>(listSqlDatabasesAsync(resourceGroupName, accountName)); + } + + /** + * Lists the SQL databases under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the SQL databases and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSqlDatabases( + String resourceGroupName, String accountName, Context context) { + return new PagedIterable<>(listSqlDatabasesAsync(resourceGroupName, accountName, context)); + } + + /** + * Gets the SQL database under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL database under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSqlDatabaseWithResponseAsync( + String resourceGroupName, String accountName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getSqlDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the SQL database under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL database under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSqlDatabaseWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getSqlDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the SQL database under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL database under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getSqlDatabaseAsync( + String resourceGroupName, String accountName, String databaseName) { + return getSqlDatabaseWithResponseAsync(resourceGroupName, accountName, databaseName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the SQL database under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL database under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlDatabaseGetResultsInner getSqlDatabase( + String resourceGroupName, String accountName, String databaseName) { + return getSqlDatabaseAsync(resourceGroupName, accountName, databaseName).block(); + } + + /** + * Gets the SQL database under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL database under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getSqlDatabaseWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context) { + return getSqlDatabaseWithResponseAsync(resourceGroupName, accountName, databaseName, context).block(); + } + + /** + * Create or update an Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateSqlDatabaseParameters The parameters to provide for the current SQL database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateSqlDatabaseWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + SqlDatabaseCreateUpdateParameters createUpdateSqlDatabaseParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (createUpdateSqlDatabaseParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateSqlDatabaseParameters is required and cannot be null.")); + } else { + createUpdateSqlDatabaseParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createUpdateSqlDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + createUpdateSqlDatabaseParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update an Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateSqlDatabaseParameters The parameters to provide for the current SQL database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateSqlDatabaseWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + SqlDatabaseCreateUpdateParameters createUpdateSqlDatabaseParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (createUpdateSqlDatabaseParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateSqlDatabaseParameters is required and cannot be null.")); + } else { + createUpdateSqlDatabaseParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createUpdateSqlDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + createUpdateSqlDatabaseParameters, + accept, + context); + } + + /** + * Create or update an Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateSqlDatabaseParameters The parameters to provide for the current SQL database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, SqlDatabaseGetResultsInner> + beginCreateUpdateSqlDatabaseAsync( + String resourceGroupName, + String accountName, + String databaseName, + SqlDatabaseCreateUpdateParameters createUpdateSqlDatabaseParameters) { + Mono>> mono = + createUpdateSqlDatabaseWithResponseAsync( + resourceGroupName, accountName, databaseName, createUpdateSqlDatabaseParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SqlDatabaseGetResultsInner.class, + SqlDatabaseGetResultsInner.class, + Context.NONE); + } + + /** + * Create or update an Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateSqlDatabaseParameters The parameters to provide for the current SQL database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, SqlDatabaseGetResultsInner> + beginCreateUpdateSqlDatabaseAsync( + String resourceGroupName, + String accountName, + String databaseName, + SqlDatabaseCreateUpdateParameters createUpdateSqlDatabaseParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createUpdateSqlDatabaseWithResponseAsync( + resourceGroupName, accountName, databaseName, createUpdateSqlDatabaseParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SqlDatabaseGetResultsInner.class, + SqlDatabaseGetResultsInner.class, + context); + } + + /** + * Create or update an Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateSqlDatabaseParameters The parameters to provide for the current SQL database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, SqlDatabaseGetResultsInner> beginCreateUpdateSqlDatabase( + String resourceGroupName, + String accountName, + String databaseName, + SqlDatabaseCreateUpdateParameters createUpdateSqlDatabaseParameters) { + return beginCreateUpdateSqlDatabaseAsync( + resourceGroupName, accountName, databaseName, createUpdateSqlDatabaseParameters) + .getSyncPoller(); + } + + /** + * Create or update an Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateSqlDatabaseParameters The parameters to provide for the current SQL database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, SqlDatabaseGetResultsInner> beginCreateUpdateSqlDatabase( + String resourceGroupName, + String accountName, + String databaseName, + SqlDatabaseCreateUpdateParameters createUpdateSqlDatabaseParameters, + Context context) { + return beginCreateUpdateSqlDatabaseAsync( + resourceGroupName, accountName, databaseName, createUpdateSqlDatabaseParameters, context) + .getSyncPoller(); + } + + /** + * Create or update an Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateSqlDatabaseParameters The parameters to provide for the current SQL database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateSqlDatabaseAsync( + String resourceGroupName, + String accountName, + String databaseName, + SqlDatabaseCreateUpdateParameters createUpdateSqlDatabaseParameters) { + return beginCreateUpdateSqlDatabaseAsync( + resourceGroupName, accountName, databaseName, createUpdateSqlDatabaseParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update an Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateSqlDatabaseParameters The parameters to provide for the current SQL database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateSqlDatabaseAsync( + String resourceGroupName, + String accountName, + String databaseName, + SqlDatabaseCreateUpdateParameters createUpdateSqlDatabaseParameters, + Context context) { + return beginCreateUpdateSqlDatabaseAsync( + resourceGroupName, accountName, databaseName, createUpdateSqlDatabaseParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update an Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateSqlDatabaseParameters The parameters to provide for the current SQL database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlDatabaseGetResultsInner createUpdateSqlDatabase( + String resourceGroupName, + String accountName, + String databaseName, + SqlDatabaseCreateUpdateParameters createUpdateSqlDatabaseParameters) { + return createUpdateSqlDatabaseAsync( + resourceGroupName, accountName, databaseName, createUpdateSqlDatabaseParameters) + .block(); + } + + /** + * Create or update an Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateSqlDatabaseParameters The parameters to provide for the current SQL database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlDatabaseGetResultsInner createUpdateSqlDatabase( + String resourceGroupName, + String accountName, + String databaseName, + SqlDatabaseCreateUpdateParameters createUpdateSqlDatabaseParameters, + Context context) { + return createUpdateSqlDatabaseAsync( + resourceGroupName, accountName, databaseName, createUpdateSqlDatabaseParameters, context) + .block(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteSqlDatabaseWithResponseAsync( + String resourceGroupName, String accountName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .deleteSqlDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteSqlDatabaseWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + context = this.client.mergeContext(context); + return service + .deleteSqlDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + context); + } + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteSqlDatabaseAsync( + String resourceGroupName, String accountName, String databaseName) { + Mono>> mono = + deleteSqlDatabaseWithResponseAsync(resourceGroupName, accountName, databaseName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteSqlDatabaseAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteSqlDatabaseWithResponseAsync(resourceGroupName, accountName, databaseName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDeleteSqlDatabase( + String resourceGroupName, String accountName, String databaseName) { + return beginDeleteSqlDatabaseAsync(resourceGroupName, accountName, databaseName).getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDeleteSqlDatabase( + String resourceGroupName, String accountName, String databaseName, Context context) { + return beginDeleteSqlDatabaseAsync(resourceGroupName, accountName, databaseName, context).getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteSqlDatabaseAsync(String resourceGroupName, String accountName, String databaseName) { + return beginDeleteSqlDatabaseAsync(resourceGroupName, accountName, databaseName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteSqlDatabaseAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + return beginDeleteSqlDatabaseAsync(resourceGroupName, accountName, databaseName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteSqlDatabase(String resourceGroupName, String accountName, String databaseName) { + deleteSqlDatabaseAsync(resourceGroupName, accountName, databaseName).block(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteSqlDatabase(String resourceGroupName, String accountName, String databaseName, Context context) { + deleteSqlDatabaseAsync(resourceGroupName, accountName, databaseName, context).block(); + } + + /** + * Gets the RUs per second of the SQL database under an existing Azure Cosmos DB database account with the provided + * name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the SQL database under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSqlDatabaseThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getSqlDatabaseThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the RUs per second of the SQL database under an existing Azure Cosmos DB database account with the provided + * name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the SQL database under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSqlDatabaseThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getSqlDatabaseThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the RUs per second of the SQL database under an existing Azure Cosmos DB database account with the provided + * name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the SQL database under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getSqlDatabaseThroughputAsync( + String resourceGroupName, String accountName, String databaseName) { + return getSqlDatabaseThroughputWithResponseAsync(resourceGroupName, accountName, databaseName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the RUs per second of the SQL database under an existing Azure Cosmos DB database account with the provided + * name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the SQL database under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner getSqlDatabaseThroughput( + String resourceGroupName, String accountName, String databaseName) { + return getSqlDatabaseThroughputAsync(resourceGroupName, accountName, databaseName).block(); + } + + /** + * Gets the RUs per second of the SQL database under an existing Azure Cosmos DB database account with the provided + * name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the SQL database under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getSqlDatabaseThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context) { + return getSqlDatabaseThroughputWithResponseAsync(resourceGroupName, accountName, databaseName, context).block(); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateSqlDatabaseThroughputWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (updateThroughputParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter updateThroughputParameters is required and cannot be null.")); + } else { + updateThroughputParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateSqlDatabaseThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + updateThroughputParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateSqlDatabaseThroughputWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (updateThroughputParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter updateThroughputParameters is required and cannot be null.")); + } else { + updateThroughputParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateSqlDatabaseThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + updateThroughputParameters, + accept, + context); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginUpdateSqlDatabaseThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + Mono>> mono = + updateSqlDatabaseThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginUpdateSqlDatabaseThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateSqlDatabaseThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateSqlDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateSqlDatabaseThroughputAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters) + .getSyncPoller(); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateSqlDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return beginUpdateSqlDatabaseThroughputAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters, context) + .getSyncPoller(); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateSqlDatabaseThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateSqlDatabaseThroughputAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateSqlDatabaseThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return beginUpdateSqlDatabaseThroughputAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner updateSqlDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return updateSqlDatabaseThroughputAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters) + .block(); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner updateSqlDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return updateSqlDatabaseThroughputAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters, context) + .block(); + } + + /** + * Migrate an Azure Cosmos DB SQL database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateSqlDatabaseToAutoscaleWithResponseAsync( + String resourceGroupName, String accountName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateSqlDatabaseToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Migrate an Azure Cosmos DB SQL database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateSqlDatabaseToAutoscaleWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateSqlDatabaseToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Migrate an Azure Cosmos DB SQL database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateSqlDatabaseToAutoscaleAsync(String resourceGroupName, String accountName, String databaseName) { + Mono>> mono = + migrateSqlDatabaseToAutoscaleWithResponseAsync(resourceGroupName, accountName, databaseName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * Migrate an Azure Cosmos DB SQL database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateSqlDatabaseToAutoscaleAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + migrateSqlDatabaseToAutoscaleWithResponseAsync(resourceGroupName, accountName, databaseName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * Migrate an Azure Cosmos DB SQL database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateSqlDatabaseToAutoscale(String resourceGroupName, String accountName, String databaseName) { + return beginMigrateSqlDatabaseToAutoscaleAsync(resourceGroupName, accountName, databaseName).getSyncPoller(); + } + + /** + * Migrate an Azure Cosmos DB SQL database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateSqlDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName, Context context) { + return beginMigrateSqlDatabaseToAutoscaleAsync(resourceGroupName, accountName, databaseName, context) + .getSyncPoller(); + } + + /** + * Migrate an Azure Cosmos DB SQL database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateSqlDatabaseToAutoscaleAsync( + String resourceGroupName, String accountName, String databaseName) { + return beginMigrateSqlDatabaseToAutoscaleAsync(resourceGroupName, accountName, databaseName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Migrate an Azure Cosmos DB SQL database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateSqlDatabaseToAutoscaleAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + return beginMigrateSqlDatabaseToAutoscaleAsync(resourceGroupName, accountName, databaseName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Migrate an Azure Cosmos DB SQL database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateSqlDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName) { + return migrateSqlDatabaseToAutoscaleAsync(resourceGroupName, accountName, databaseName).block(); + } + + /** + * Migrate an Azure Cosmos DB SQL database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateSqlDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName, Context context) { + return migrateSqlDatabaseToAutoscaleAsync(resourceGroupName, accountName, databaseName, context).block(); + } + + /** + * Migrate an Azure Cosmos DB SQL database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateSqlDatabaseToManualThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateSqlDatabaseToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Migrate an Azure Cosmos DB SQL database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateSqlDatabaseToManualThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateSqlDatabaseToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Migrate an Azure Cosmos DB SQL database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateSqlDatabaseToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName) { + Mono>> mono = + migrateSqlDatabaseToManualThroughputWithResponseAsync(resourceGroupName, accountName, databaseName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * Migrate an Azure Cosmos DB SQL database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateSqlDatabaseToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + migrateSqlDatabaseToManualThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * Migrate an Azure Cosmos DB SQL database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateSqlDatabaseToManualThroughput(String resourceGroupName, String accountName, String databaseName) { + return beginMigrateSqlDatabaseToManualThroughputAsync(resourceGroupName, accountName, databaseName) + .getSyncPoller(); + } + + /** + * Migrate an Azure Cosmos DB SQL database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateSqlDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName, Context context) { + return beginMigrateSqlDatabaseToManualThroughputAsync(resourceGroupName, accountName, databaseName, context) + .getSyncPoller(); + } + + /** + * Migrate an Azure Cosmos DB SQL database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateSqlDatabaseToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName) { + return beginMigrateSqlDatabaseToManualThroughputAsync(resourceGroupName, accountName, databaseName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Migrate an Azure Cosmos DB SQL database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateSqlDatabaseToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + return beginMigrateSqlDatabaseToManualThroughputAsync(resourceGroupName, accountName, databaseName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Migrate an Azure Cosmos DB SQL database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateSqlDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName) { + return migrateSqlDatabaseToManualThroughputAsync(resourceGroupName, accountName, databaseName).block(); + } + + /** + * Migrate an Azure Cosmos DB SQL database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateSqlDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName, Context context) { + return migrateSqlDatabaseToManualThroughputAsync(resourceGroupName, accountName, databaseName, context).block(); + } + + /** + * Lists the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the containers and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSqlContainersSinglePageAsync( + String resourceGroupName, String accountName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listSqlContainers( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the containers and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSqlContainersSinglePageAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listSqlContainers( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Lists the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the containers and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listSqlContainersAsync( + String resourceGroupName, String accountName, String databaseName) { + return new PagedFlux<>(() -> listSqlContainersSinglePageAsync(resourceGroupName, accountName, databaseName)); + } + + /** + * Lists the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the containers and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listSqlContainersAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listSqlContainersSinglePageAsync(resourceGroupName, accountName, databaseName, context)); + } + + /** + * Lists the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the containers and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSqlContainers( + String resourceGroupName, String accountName, String databaseName) { + return new PagedIterable<>(listSqlContainersAsync(resourceGroupName, accountName, databaseName)); + } + + /** + * Lists the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the containers and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSqlContainers( + String resourceGroupName, String accountName, String databaseName, Context context) { + return new PagedIterable<>(listSqlContainersAsync(resourceGroupName, accountName, databaseName, context)); + } + + /** + * Gets the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL container under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSqlContainerWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String containerName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getSqlContainer( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL container under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSqlContainerWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getSqlContainer( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL container under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getSqlContainerAsync( + String resourceGroupName, String accountName, String databaseName, String containerName) { + return getSqlContainerWithResponseAsync(resourceGroupName, accountName, databaseName, containerName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL container under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlContainerGetResultsInner getSqlContainer( + String resourceGroupName, String accountName, String databaseName, String containerName) { + return getSqlContainerAsync(resourceGroupName, accountName, databaseName, containerName).block(); + } + + /** + * Gets the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL container under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getSqlContainerWithResponse( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + return getSqlContainerWithResponseAsync(resourceGroupName, accountName, databaseName, containerName, context) + .block(); + } + + /** + * Create or update an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param createUpdateSqlContainerParameters The parameters to provide for the current SQL container. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateSqlContainerWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (createUpdateSqlContainerParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateSqlContainerParameters is required and cannot be null.")); + } else { + createUpdateSqlContainerParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createUpdateSqlContainer( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + this.client.getApiVersion(), + createUpdateSqlContainerParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param createUpdateSqlContainerParameters The parameters to provide for the current SQL container. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateSqlContainerWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (createUpdateSqlContainerParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateSqlContainerParameters is required and cannot be null.")); + } else { + createUpdateSqlContainerParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createUpdateSqlContainer( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + this.client.getApiVersion(), + createUpdateSqlContainerParameters, + accept, + context); + } + + /** + * Create or update an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param createUpdateSqlContainerParameters The parameters to provide for the current SQL container. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, SqlContainerGetResultsInner> + beginCreateUpdateSqlContainerAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters) { + Mono>> mono = + createUpdateSqlContainerWithResponseAsync( + resourceGroupName, accountName, databaseName, containerName, createUpdateSqlContainerParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SqlContainerGetResultsInner.class, + SqlContainerGetResultsInner.class, + Context.NONE); + } + + /** + * Create or update an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param createUpdateSqlContainerParameters The parameters to provide for the current SQL container. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, SqlContainerGetResultsInner> + beginCreateUpdateSqlContainerAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createUpdateSqlContainerWithResponseAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + createUpdateSqlContainerParameters, + context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SqlContainerGetResultsInner.class, + SqlContainerGetResultsInner.class, + context); + } + + /** + * Create or update an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param createUpdateSqlContainerParameters The parameters to provide for the current SQL container. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, SqlContainerGetResultsInner> + beginCreateUpdateSqlContainer( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters) { + return beginCreateUpdateSqlContainerAsync( + resourceGroupName, accountName, databaseName, containerName, createUpdateSqlContainerParameters) + .getSyncPoller(); + } + + /** + * Create or update an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param createUpdateSqlContainerParameters The parameters to provide for the current SQL container. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, SqlContainerGetResultsInner> + beginCreateUpdateSqlContainer( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters, + Context context) { + return beginCreateUpdateSqlContainerAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + createUpdateSqlContainerParameters, + context) + .getSyncPoller(); + } + + /** + * Create or update an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param createUpdateSqlContainerParameters The parameters to provide for the current SQL container. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateSqlContainerAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters) { + return beginCreateUpdateSqlContainerAsync( + resourceGroupName, accountName, databaseName, containerName, createUpdateSqlContainerParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param createUpdateSqlContainerParameters The parameters to provide for the current SQL container. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateSqlContainerAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters, + Context context) { + return beginCreateUpdateSqlContainerAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + createUpdateSqlContainerParameters, + context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param createUpdateSqlContainerParameters The parameters to provide for the current SQL container. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlContainerGetResultsInner createUpdateSqlContainer( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters) { + return createUpdateSqlContainerAsync( + resourceGroupName, accountName, databaseName, containerName, createUpdateSqlContainerParameters) + .block(); + } + + /** + * Create or update an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param createUpdateSqlContainerParameters The parameters to provide for the current SQL container. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlContainerGetResultsInner createUpdateSqlContainer( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters, + Context context) { + return createUpdateSqlContainerAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + createUpdateSqlContainerParameters, + context) + .block(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteSqlContainerWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String containerName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .deleteSqlContainer( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + this.client.getApiVersion(), + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an existing Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteSqlContainerWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + context = this.client.mergeContext(context); + return service + .deleteSqlContainer( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + this.client.getApiVersion(), + context); + } + + /** + * Deletes an existing Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteSqlContainerAsync( + String resourceGroupName, String accountName, String databaseName, String containerName) { + Mono>> mono = + deleteSqlContainerWithResponseAsync(resourceGroupName, accountName, databaseName, containerName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes an existing Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteSqlContainerAsync( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteSqlContainerWithResponseAsync(resourceGroupName, accountName, databaseName, containerName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes an existing Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDeleteSqlContainer( + String resourceGroupName, String accountName, String databaseName, String containerName) { + return beginDeleteSqlContainerAsync(resourceGroupName, accountName, databaseName, containerName) + .getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDeleteSqlContainer( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + return beginDeleteSqlContainerAsync(resourceGroupName, accountName, databaseName, containerName, context) + .getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteSqlContainerAsync( + String resourceGroupName, String accountName, String databaseName, String containerName) { + return beginDeleteSqlContainerAsync(resourceGroupName, accountName, databaseName, containerName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteSqlContainerAsync( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + return beginDeleteSqlContainerAsync(resourceGroupName, accountName, databaseName, containerName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteSqlContainer( + String resourceGroupName, String accountName, String databaseName, String containerName) { + deleteSqlContainerAsync(resourceGroupName, accountName, databaseName, containerName).block(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteSqlContainer( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + deleteSqlContainerAsync(resourceGroupName, accountName, databaseName, containerName, context).block(); + } + + /** + * Gets the RUs per second of the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the SQL container under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSqlContainerThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String containerName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getSqlContainerThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the RUs per second of the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the SQL container under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSqlContainerThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getSqlContainerThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the RUs per second of the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the SQL container under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getSqlContainerThroughputAsync( + String resourceGroupName, String accountName, String databaseName, String containerName) { + return getSqlContainerThroughputWithResponseAsync(resourceGroupName, accountName, databaseName, containerName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the RUs per second of the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the SQL container under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner getSqlContainerThroughput( + String resourceGroupName, String accountName, String databaseName, String containerName) { + return getSqlContainerThroughputAsync(resourceGroupName, accountName, databaseName, containerName).block(); + } + + /** + * Gets the RUs per second of the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the SQL container under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getSqlContainerThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + return getSqlContainerThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, containerName, context) + .block(); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL container. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateSqlContainerThroughputWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (updateThroughputParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter updateThroughputParameters is required and cannot be null.")); + } else { + updateThroughputParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateSqlContainerThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + this.client.getApiVersion(), + updateThroughputParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL container. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateSqlContainerThroughputWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (updateThroughputParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter updateThroughputParameters is required and cannot be null.")); + } else { + updateThroughputParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateSqlContainerThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + this.client.getApiVersion(), + updateThroughputParameters, + accept, + context); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL container. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginUpdateSqlContainerThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + Mono>> mono = + updateSqlContainerThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL container. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginUpdateSqlContainerThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateSqlContainerThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL container. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateSqlContainerThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateSqlContainerThroughputAsync( + resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters) + .getSyncPoller(); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL container. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateSqlContainerThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return beginUpdateSqlContainerThroughputAsync( + resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters, context) + .getSyncPoller(); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL container. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateSqlContainerThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateSqlContainerThroughputAsync( + resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL container. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateSqlContainerThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return beginUpdateSqlContainerThroughputAsync( + resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL container. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner updateSqlContainerThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return updateSqlContainerThroughputAsync( + resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters) + .block(); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL container. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner updateSqlContainerThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return updateSqlContainerThroughputAsync( + resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters, context) + .block(); + } + + /** + * Migrate an Azure Cosmos DB SQL container from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateSqlContainerToAutoscaleWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String containerName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateSqlContainerToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Migrate an Azure Cosmos DB SQL container from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateSqlContainerToAutoscaleWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateSqlContainerToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Migrate an Azure Cosmos DB SQL container from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateSqlContainerToAutoscaleAsync( + String resourceGroupName, String accountName, String databaseName, String containerName) { + Mono>> mono = + migrateSqlContainerToAutoscaleWithResponseAsync( + resourceGroupName, accountName, databaseName, containerName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * Migrate an Azure Cosmos DB SQL container from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateSqlContainerToAutoscaleAsync( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + migrateSqlContainerToAutoscaleWithResponseAsync( + resourceGroupName, accountName, databaseName, containerName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * Migrate an Azure Cosmos DB SQL container from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateSqlContainerToAutoscale( + String resourceGroupName, String accountName, String databaseName, String containerName) { + return beginMigrateSqlContainerToAutoscaleAsync(resourceGroupName, accountName, databaseName, containerName) + .getSyncPoller(); + } + + /** + * Migrate an Azure Cosmos DB SQL container from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateSqlContainerToAutoscale( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + return beginMigrateSqlContainerToAutoscaleAsync( + resourceGroupName, accountName, databaseName, containerName, context) + .getSyncPoller(); + } + + /** + * Migrate an Azure Cosmos DB SQL container from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateSqlContainerToAutoscaleAsync( + String resourceGroupName, String accountName, String databaseName, String containerName) { + return beginMigrateSqlContainerToAutoscaleAsync(resourceGroupName, accountName, databaseName, containerName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Migrate an Azure Cosmos DB SQL container from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateSqlContainerToAutoscaleAsync( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + return beginMigrateSqlContainerToAutoscaleAsync( + resourceGroupName, accountName, databaseName, containerName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Migrate an Azure Cosmos DB SQL container from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateSqlContainerToAutoscale( + String resourceGroupName, String accountName, String databaseName, String containerName) { + return migrateSqlContainerToAutoscaleAsync(resourceGroupName, accountName, databaseName, containerName).block(); + } + + /** + * Migrate an Azure Cosmos DB SQL container from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateSqlContainerToAutoscale( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + return migrateSqlContainerToAutoscaleAsync(resourceGroupName, accountName, databaseName, containerName, context) + .block(); + } + + /** + * Migrate an Azure Cosmos DB SQL container from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateSqlContainerToManualThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String containerName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateSqlContainerToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Migrate an Azure Cosmos DB SQL container from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateSqlContainerToManualThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateSqlContainerToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Migrate an Azure Cosmos DB SQL container from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateSqlContainerToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName, String containerName) { + Mono>> mono = + migrateSqlContainerToManualThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, containerName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * Migrate an Azure Cosmos DB SQL container from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateSqlContainerToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + migrateSqlContainerToManualThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, containerName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * Migrate an Azure Cosmos DB SQL container from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateSqlContainerToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String containerName) { + return beginMigrateSqlContainerToManualThroughputAsync( + resourceGroupName, accountName, databaseName, containerName) + .getSyncPoller(); + } + + /** + * Migrate an Azure Cosmos DB SQL container from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateSqlContainerToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + return beginMigrateSqlContainerToManualThroughputAsync( + resourceGroupName, accountName, databaseName, containerName, context) + .getSyncPoller(); + } + + /** + * Migrate an Azure Cosmos DB SQL container from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateSqlContainerToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName, String containerName) { + return beginMigrateSqlContainerToManualThroughputAsync( + resourceGroupName, accountName, databaseName, containerName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Migrate an Azure Cosmos DB SQL container from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateSqlContainerToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + return beginMigrateSqlContainerToManualThroughputAsync( + resourceGroupName, accountName, databaseName, containerName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Migrate an Azure Cosmos DB SQL container from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateSqlContainerToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String containerName) { + return migrateSqlContainerToManualThroughputAsync(resourceGroupName, accountName, databaseName, containerName) + .block(); + } + + /** + * Migrate an Azure Cosmos DB SQL container from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateSqlContainerToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + return migrateSqlContainerToManualThroughputAsync( + resourceGroupName, accountName, databaseName, containerName, context) + .block(); + } + + /** + * Lists the SQL storedProcedure under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the storedProcedures and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSqlStoredProceduresSinglePageAsync( + String resourceGroupName, String accountName, String databaseName, String containerName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listSqlStoredProcedures( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the SQL storedProcedure under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the storedProcedures and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSqlStoredProceduresSinglePageAsync( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listSqlStoredProcedures( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Lists the SQL storedProcedure under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the storedProcedures and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listSqlStoredProceduresAsync( + String resourceGroupName, String accountName, String databaseName, String containerName) { + return new PagedFlux<>( + () -> listSqlStoredProceduresSinglePageAsync(resourceGroupName, accountName, databaseName, containerName)); + } + + /** + * Lists the SQL storedProcedure under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the storedProcedures and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listSqlStoredProceduresAsync( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + return new PagedFlux<>( + () -> + listSqlStoredProceduresSinglePageAsync( + resourceGroupName, accountName, databaseName, containerName, context)); + } + + /** + * Lists the SQL storedProcedure under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the storedProcedures and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSqlStoredProcedures( + String resourceGroupName, String accountName, String databaseName, String containerName) { + return new PagedIterable<>( + listSqlStoredProceduresAsync(resourceGroupName, accountName, databaseName, containerName)); + } + + /** + * Lists the SQL storedProcedure under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the storedProcedures and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSqlStoredProcedures( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + return new PagedIterable<>( + listSqlStoredProceduresAsync(resourceGroupName, accountName, databaseName, containerName, context)); + } + + /** + * Gets the SQL storedProcedure under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL storedProcedure under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSqlStoredProcedureWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (storedProcedureName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storedProcedureName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getSqlStoredProcedure( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + storedProcedureName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the SQL storedProcedure under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL storedProcedure under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSqlStoredProcedureWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (storedProcedureName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storedProcedureName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getSqlStoredProcedure( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + storedProcedureName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the SQL storedProcedure under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL storedProcedure under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getSqlStoredProcedureAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName) { + return getSqlStoredProcedureWithResponseAsync( + resourceGroupName, accountName, databaseName, containerName, storedProcedureName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the SQL storedProcedure under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL storedProcedure under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlStoredProcedureGetResultsInner getSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName) { + return getSqlStoredProcedureAsync( + resourceGroupName, accountName, databaseName, containerName, storedProcedureName) + .block(); + } + + /** + * Gets the SQL storedProcedure under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL storedProcedure under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getSqlStoredProcedureWithResponse( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + Context context) { + return getSqlStoredProcedureWithResponseAsync( + resourceGroupName, accountName, databaseName, containerName, storedProcedureName, context) + .block(); + } + + /** + * Create or update an Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @param createUpdateSqlStoredProcedureParameters The parameters to provide for the current SQL storedProcedure. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB storedProcedure. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateSqlStoredProcedureWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + SqlStoredProcedureCreateUpdateParameters createUpdateSqlStoredProcedureParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (storedProcedureName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storedProcedureName is required and cannot be null.")); + } + if (createUpdateSqlStoredProcedureParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateSqlStoredProcedureParameters is required and cannot be null.")); + } else { + createUpdateSqlStoredProcedureParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createUpdateSqlStoredProcedure( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + storedProcedureName, + this.client.getApiVersion(), + createUpdateSqlStoredProcedureParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update an Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @param createUpdateSqlStoredProcedureParameters The parameters to provide for the current SQL storedProcedure. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB storedProcedure. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateSqlStoredProcedureWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + SqlStoredProcedureCreateUpdateParameters createUpdateSqlStoredProcedureParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (storedProcedureName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storedProcedureName is required and cannot be null.")); + } + if (createUpdateSqlStoredProcedureParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateSqlStoredProcedureParameters is required and cannot be null.")); + } else { + createUpdateSqlStoredProcedureParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createUpdateSqlStoredProcedure( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + storedProcedureName, + this.client.getApiVersion(), + createUpdateSqlStoredProcedureParameters, + accept, + context); + } + + /** + * Create or update an Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @param createUpdateSqlStoredProcedureParameters The parameters to provide for the current SQL storedProcedure. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB storedProcedure. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, SqlStoredProcedureGetResultsInner> + beginCreateUpdateSqlStoredProcedureAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + SqlStoredProcedureCreateUpdateParameters createUpdateSqlStoredProcedureParameters) { + Mono>> mono = + createUpdateSqlStoredProcedureWithResponseAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + storedProcedureName, + createUpdateSqlStoredProcedureParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SqlStoredProcedureGetResultsInner.class, + SqlStoredProcedureGetResultsInner.class, + Context.NONE); + } + + /** + * Create or update an Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @param createUpdateSqlStoredProcedureParameters The parameters to provide for the current SQL storedProcedure. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB storedProcedure. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, SqlStoredProcedureGetResultsInner> + beginCreateUpdateSqlStoredProcedureAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + SqlStoredProcedureCreateUpdateParameters createUpdateSqlStoredProcedureParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createUpdateSqlStoredProcedureWithResponseAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + storedProcedureName, + createUpdateSqlStoredProcedureParameters, + context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SqlStoredProcedureGetResultsInner.class, + SqlStoredProcedureGetResultsInner.class, + context); + } + + /** + * Create or update an Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @param createUpdateSqlStoredProcedureParameters The parameters to provide for the current SQL storedProcedure. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB storedProcedure. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, SqlStoredProcedureGetResultsInner> + beginCreateUpdateSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + SqlStoredProcedureCreateUpdateParameters createUpdateSqlStoredProcedureParameters) { + return beginCreateUpdateSqlStoredProcedureAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + storedProcedureName, + createUpdateSqlStoredProcedureParameters) + .getSyncPoller(); + } + + /** + * Create or update an Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @param createUpdateSqlStoredProcedureParameters The parameters to provide for the current SQL storedProcedure. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB storedProcedure. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, SqlStoredProcedureGetResultsInner> + beginCreateUpdateSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + SqlStoredProcedureCreateUpdateParameters createUpdateSqlStoredProcedureParameters, + Context context) { + return beginCreateUpdateSqlStoredProcedureAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + storedProcedureName, + createUpdateSqlStoredProcedureParameters, + context) + .getSyncPoller(); + } + + /** + * Create or update an Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @param createUpdateSqlStoredProcedureParameters The parameters to provide for the current SQL storedProcedure. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB storedProcedure. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateSqlStoredProcedureAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + SqlStoredProcedureCreateUpdateParameters createUpdateSqlStoredProcedureParameters) { + return beginCreateUpdateSqlStoredProcedureAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + storedProcedureName, + createUpdateSqlStoredProcedureParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update an Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @param createUpdateSqlStoredProcedureParameters The parameters to provide for the current SQL storedProcedure. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB storedProcedure. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateSqlStoredProcedureAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + SqlStoredProcedureCreateUpdateParameters createUpdateSqlStoredProcedureParameters, + Context context) { + return beginCreateUpdateSqlStoredProcedureAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + storedProcedureName, + createUpdateSqlStoredProcedureParameters, + context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update an Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @param createUpdateSqlStoredProcedureParameters The parameters to provide for the current SQL storedProcedure. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB storedProcedure. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlStoredProcedureGetResultsInner createUpdateSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + SqlStoredProcedureCreateUpdateParameters createUpdateSqlStoredProcedureParameters) { + return createUpdateSqlStoredProcedureAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + storedProcedureName, + createUpdateSqlStoredProcedureParameters) + .block(); + } + + /** + * Create or update an Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @param createUpdateSqlStoredProcedureParameters The parameters to provide for the current SQL storedProcedure. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB storedProcedure. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlStoredProcedureGetResultsInner createUpdateSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + SqlStoredProcedureCreateUpdateParameters createUpdateSqlStoredProcedureParameters, + Context context) { + return createUpdateSqlStoredProcedureAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + storedProcedureName, + createUpdateSqlStoredProcedureParameters, + context) + .block(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteSqlStoredProcedureWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (storedProcedureName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storedProcedureName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .deleteSqlStoredProcedure( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + storedProcedureName, + this.client.getApiVersion(), + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteSqlStoredProcedureWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (storedProcedureName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storedProcedureName is required and cannot be null.")); + } + context = this.client.mergeContext(context); + return service + .deleteSqlStoredProcedure( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + storedProcedureName, + this.client.getApiVersion(), + context); + } + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteSqlStoredProcedureAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName) { + Mono>> mono = + deleteSqlStoredProcedureWithResponseAsync( + resourceGroupName, accountName, databaseName, containerName, storedProcedureName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteSqlStoredProcedureAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteSqlStoredProcedureWithResponseAsync( + resourceGroupName, accountName, databaseName, containerName, storedProcedureName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDeleteSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName) { + return beginDeleteSqlStoredProcedureAsync( + resourceGroupName, accountName, databaseName, containerName, storedProcedureName) + .getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDeleteSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + Context context) { + return beginDeleteSqlStoredProcedureAsync( + resourceGroupName, accountName, databaseName, containerName, storedProcedureName, context) + .getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteSqlStoredProcedureAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName) { + return beginDeleteSqlStoredProcedureAsync( + resourceGroupName, accountName, databaseName, containerName, storedProcedureName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteSqlStoredProcedureAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + Context context) { + return beginDeleteSqlStoredProcedureAsync( + resourceGroupName, accountName, databaseName, containerName, storedProcedureName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName) { + deleteSqlStoredProcedureAsync(resourceGroupName, accountName, databaseName, containerName, storedProcedureName) + .block(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + Context context) { + deleteSqlStoredProcedureAsync( + resourceGroupName, accountName, databaseName, containerName, storedProcedureName, context) + .block(); + } + + /** + * Lists the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the userDefinedFunctions and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSqlUserDefinedFunctionsSinglePageAsync( + String resourceGroupName, String accountName, String databaseName, String containerName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listSqlUserDefinedFunctions( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the userDefinedFunctions and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSqlUserDefinedFunctionsSinglePageAsync( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listSqlUserDefinedFunctions( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Lists the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the userDefinedFunctions and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listSqlUserDefinedFunctionsAsync( + String resourceGroupName, String accountName, String databaseName, String containerName) { + return new PagedFlux<>( + () -> + listSqlUserDefinedFunctionsSinglePageAsync( + resourceGroupName, accountName, databaseName, containerName)); + } + + /** + * Lists the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the userDefinedFunctions and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listSqlUserDefinedFunctionsAsync( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + return new PagedFlux<>( + () -> + listSqlUserDefinedFunctionsSinglePageAsync( + resourceGroupName, accountName, databaseName, containerName, context)); + } + + /** + * Lists the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the userDefinedFunctions and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSqlUserDefinedFunctions( + String resourceGroupName, String accountName, String databaseName, String containerName) { + return new PagedIterable<>( + listSqlUserDefinedFunctionsAsync(resourceGroupName, accountName, databaseName, containerName)); + } + + /** + * Lists the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the userDefinedFunctions and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSqlUserDefinedFunctions( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + return new PagedIterable<>( + listSqlUserDefinedFunctionsAsync(resourceGroupName, accountName, databaseName, containerName, context)); + } + + /** + * Gets the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSqlUserDefinedFunctionWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (userDefinedFunctionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter userDefinedFunctionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getSqlUserDefinedFunction( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + userDefinedFunctionName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSqlUserDefinedFunctionWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (userDefinedFunctionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter userDefinedFunctionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getSqlUserDefinedFunction( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + userDefinedFunctionName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getSqlUserDefinedFunctionAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName) { + return getSqlUserDefinedFunctionWithResponseAsync( + resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlUserDefinedFunctionGetResultsInner getSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName) { + return getSqlUserDefinedFunctionAsync( + resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName) + .block(); + } + + /** + * Gets the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getSqlUserDefinedFunctionWithResponse( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + Context context) { + return getSqlUserDefinedFunctionWithResponseAsync( + resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, context) + .block(); + } + + /** + * Create or update an Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param createUpdateSqlUserDefinedFunctionParameters The parameters to provide for the current SQL + * userDefinedFunction. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB userDefinedFunction. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateSqlUserDefinedFunctionWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (userDefinedFunctionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter userDefinedFunctionName is required and cannot be null.")); + } + if (createUpdateSqlUserDefinedFunctionParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateSqlUserDefinedFunctionParameters is required and cannot be null.")); + } else { + createUpdateSqlUserDefinedFunctionParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createUpdateSqlUserDefinedFunction( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + userDefinedFunctionName, + this.client.getApiVersion(), + createUpdateSqlUserDefinedFunctionParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update an Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param createUpdateSqlUserDefinedFunctionParameters The parameters to provide for the current SQL + * userDefinedFunction. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB userDefinedFunction. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateSqlUserDefinedFunctionWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (userDefinedFunctionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter userDefinedFunctionName is required and cannot be null.")); + } + if (createUpdateSqlUserDefinedFunctionParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateSqlUserDefinedFunctionParameters is required and cannot be null.")); + } else { + createUpdateSqlUserDefinedFunctionParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createUpdateSqlUserDefinedFunction( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + userDefinedFunctionName, + this.client.getApiVersion(), + createUpdateSqlUserDefinedFunctionParameters, + accept, + context); + } + + /** + * Create or update an Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param createUpdateSqlUserDefinedFunctionParameters The parameters to provide for the current SQL + * userDefinedFunction. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB userDefinedFunction. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, SqlUserDefinedFunctionGetResultsInner> + beginCreateUpdateSqlUserDefinedFunctionAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters) { + Mono>> mono = + createUpdateSqlUserDefinedFunctionWithResponseAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + userDefinedFunctionName, + createUpdateSqlUserDefinedFunctionParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SqlUserDefinedFunctionGetResultsInner.class, + SqlUserDefinedFunctionGetResultsInner.class, + Context.NONE); + } + + /** + * Create or update an Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param createUpdateSqlUserDefinedFunctionParameters The parameters to provide for the current SQL + * userDefinedFunction. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB userDefinedFunction. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, SqlUserDefinedFunctionGetResultsInner> + beginCreateUpdateSqlUserDefinedFunctionAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createUpdateSqlUserDefinedFunctionWithResponseAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + userDefinedFunctionName, + createUpdateSqlUserDefinedFunctionParameters, + context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SqlUserDefinedFunctionGetResultsInner.class, + SqlUserDefinedFunctionGetResultsInner.class, + context); + } + + /** + * Create or update an Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param createUpdateSqlUserDefinedFunctionParameters The parameters to provide for the current SQL + * userDefinedFunction. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB userDefinedFunction. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, SqlUserDefinedFunctionGetResultsInner> + beginCreateUpdateSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters) { + return beginCreateUpdateSqlUserDefinedFunctionAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + userDefinedFunctionName, + createUpdateSqlUserDefinedFunctionParameters) + .getSyncPoller(); + } + + /** + * Create or update an Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param createUpdateSqlUserDefinedFunctionParameters The parameters to provide for the current SQL + * userDefinedFunction. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB userDefinedFunction. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, SqlUserDefinedFunctionGetResultsInner> + beginCreateUpdateSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters, + Context context) { + return beginCreateUpdateSqlUserDefinedFunctionAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + userDefinedFunctionName, + createUpdateSqlUserDefinedFunctionParameters, + context) + .getSyncPoller(); + } + + /** + * Create or update an Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param createUpdateSqlUserDefinedFunctionParameters The parameters to provide for the current SQL + * userDefinedFunction. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB userDefinedFunction. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateSqlUserDefinedFunctionAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters) { + return beginCreateUpdateSqlUserDefinedFunctionAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + userDefinedFunctionName, + createUpdateSqlUserDefinedFunctionParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update an Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param createUpdateSqlUserDefinedFunctionParameters The parameters to provide for the current SQL + * userDefinedFunction. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB userDefinedFunction. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateSqlUserDefinedFunctionAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters, + Context context) { + return beginCreateUpdateSqlUserDefinedFunctionAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + userDefinedFunctionName, + createUpdateSqlUserDefinedFunctionParameters, + context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update an Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param createUpdateSqlUserDefinedFunctionParameters The parameters to provide for the current SQL + * userDefinedFunction. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB userDefinedFunction. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlUserDefinedFunctionGetResultsInner createUpdateSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters) { + return createUpdateSqlUserDefinedFunctionAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + userDefinedFunctionName, + createUpdateSqlUserDefinedFunctionParameters) + .block(); + } + + /** + * Create or update an Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param createUpdateSqlUserDefinedFunctionParameters The parameters to provide for the current SQL + * userDefinedFunction. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB userDefinedFunction. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlUserDefinedFunctionGetResultsInner createUpdateSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters, + Context context) { + return createUpdateSqlUserDefinedFunctionAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + userDefinedFunctionName, + createUpdateSqlUserDefinedFunctionParameters, + context) + .block(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteSqlUserDefinedFunctionWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (userDefinedFunctionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter userDefinedFunctionName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .deleteSqlUserDefinedFunction( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + userDefinedFunctionName, + this.client.getApiVersion(), + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteSqlUserDefinedFunctionWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (userDefinedFunctionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter userDefinedFunctionName is required and cannot be null.")); + } + context = this.client.mergeContext(context); + return service + .deleteSqlUserDefinedFunction( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + userDefinedFunctionName, + this.client.getApiVersion(), + context); + } + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteSqlUserDefinedFunctionAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName) { + Mono>> mono = + deleteSqlUserDefinedFunctionWithResponseAsync( + resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteSqlUserDefinedFunctionAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteSqlUserDefinedFunctionWithResponseAsync( + resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDeleteSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName) { + return beginDeleteSqlUserDefinedFunctionAsync( + resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName) + .getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDeleteSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + Context context) { + return beginDeleteSqlUserDefinedFunctionAsync( + resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, context) + .getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteSqlUserDefinedFunctionAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName) { + return beginDeleteSqlUserDefinedFunctionAsync( + resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteSqlUserDefinedFunctionAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + Context context) { + return beginDeleteSqlUserDefinedFunctionAsync( + resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName) { + deleteSqlUserDefinedFunctionAsync( + resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName) + .block(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + Context context) { + deleteSqlUserDefinedFunctionAsync( + resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, context) + .block(); + } + + /** + * Lists the SQL trigger under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the triggers and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSqlTriggersSinglePageAsync( + String resourceGroupName, String accountName, String databaseName, String containerName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listSqlTriggers( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the SQL trigger under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the triggers and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSqlTriggersSinglePageAsync( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listSqlTriggers( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Lists the SQL trigger under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the triggers and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listSqlTriggersAsync( + String resourceGroupName, String accountName, String databaseName, String containerName) { + return new PagedFlux<>( + () -> listSqlTriggersSinglePageAsync(resourceGroupName, accountName, databaseName, containerName)); + } + + /** + * Lists the SQL trigger under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the triggers and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listSqlTriggersAsync( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + return new PagedFlux<>( + () -> listSqlTriggersSinglePageAsync(resourceGroupName, accountName, databaseName, containerName, context)); + } + + /** + * Lists the SQL trigger under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the triggers and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSqlTriggers( + String resourceGroupName, String accountName, String databaseName, String containerName) { + return new PagedIterable<>(listSqlTriggersAsync(resourceGroupName, accountName, databaseName, containerName)); + } + + /** + * Lists the SQL trigger under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the triggers and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSqlTriggers( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + return new PagedIterable<>( + listSqlTriggersAsync(resourceGroupName, accountName, databaseName, containerName, context)); + } + + /** + * Gets the SQL trigger under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL trigger under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSqlTriggerWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (triggerName == null) { + return Mono.error(new IllegalArgumentException("Parameter triggerName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getSqlTrigger( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + triggerName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the SQL trigger under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL trigger under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSqlTriggerWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (triggerName == null) { + return Mono.error(new IllegalArgumentException("Parameter triggerName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getSqlTrigger( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + triggerName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the SQL trigger under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL trigger under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getSqlTriggerAsync( + String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName) { + return getSqlTriggerWithResponseAsync(resourceGroupName, accountName, databaseName, containerName, triggerName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the SQL trigger under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL trigger under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlTriggerGetResultsInner getSqlTrigger( + String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName) { + return getSqlTriggerAsync(resourceGroupName, accountName, databaseName, containerName, triggerName).block(); + } + + /** + * Gets the SQL trigger under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL trigger under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getSqlTriggerWithResponse( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + Context context) { + return getSqlTriggerWithResponseAsync( + resourceGroupName, accountName, databaseName, containerName, triggerName, context) + .block(); + } + + /** + * Create or update an Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @param createUpdateSqlTriggerParameters The parameters to provide for the current SQL trigger. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB trigger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateSqlTriggerWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (triggerName == null) { + return Mono.error(new IllegalArgumentException("Parameter triggerName is required and cannot be null.")); + } + if (createUpdateSqlTriggerParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateSqlTriggerParameters is required and cannot be null.")); + } else { + createUpdateSqlTriggerParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createUpdateSqlTrigger( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + triggerName, + this.client.getApiVersion(), + createUpdateSqlTriggerParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update an Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @param createUpdateSqlTriggerParameters The parameters to provide for the current SQL trigger. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB trigger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateSqlTriggerWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (triggerName == null) { + return Mono.error(new IllegalArgumentException("Parameter triggerName is required and cannot be null.")); + } + if (createUpdateSqlTriggerParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateSqlTriggerParameters is required and cannot be null.")); + } else { + createUpdateSqlTriggerParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createUpdateSqlTrigger( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + triggerName, + this.client.getApiVersion(), + createUpdateSqlTriggerParameters, + accept, + context); + } + + /** + * Create or update an Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @param createUpdateSqlTriggerParameters The parameters to provide for the current SQL trigger. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB trigger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, SqlTriggerGetResultsInner> + beginCreateUpdateSqlTriggerAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters) { + Mono>> mono = + createUpdateSqlTriggerWithResponseAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + triggerName, + createUpdateSqlTriggerParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SqlTriggerGetResultsInner.class, + SqlTriggerGetResultsInner.class, + Context.NONE); + } + + /** + * Create or update an Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @param createUpdateSqlTriggerParameters The parameters to provide for the current SQL trigger. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB trigger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, SqlTriggerGetResultsInner> + beginCreateUpdateSqlTriggerAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createUpdateSqlTriggerWithResponseAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + triggerName, + createUpdateSqlTriggerParameters, + context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SqlTriggerGetResultsInner.class, + SqlTriggerGetResultsInner.class, + context); + } + + /** + * Create or update an Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @param createUpdateSqlTriggerParameters The parameters to provide for the current SQL trigger. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB trigger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, SqlTriggerGetResultsInner> beginCreateUpdateSqlTrigger( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters) { + return beginCreateUpdateSqlTriggerAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + triggerName, + createUpdateSqlTriggerParameters) + .getSyncPoller(); + } + + /** + * Create or update an Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @param createUpdateSqlTriggerParameters The parameters to provide for the current SQL trigger. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB trigger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, SqlTriggerGetResultsInner> beginCreateUpdateSqlTrigger( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters, + Context context) { + return beginCreateUpdateSqlTriggerAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + triggerName, + createUpdateSqlTriggerParameters, + context) + .getSyncPoller(); + } + + /** + * Create or update an Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @param createUpdateSqlTriggerParameters The parameters to provide for the current SQL trigger. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB trigger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateSqlTriggerAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters) { + return beginCreateUpdateSqlTriggerAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + triggerName, + createUpdateSqlTriggerParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update an Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @param createUpdateSqlTriggerParameters The parameters to provide for the current SQL trigger. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB trigger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateSqlTriggerAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters, + Context context) { + return beginCreateUpdateSqlTriggerAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + triggerName, + createUpdateSqlTriggerParameters, + context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update an Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @param createUpdateSqlTriggerParameters The parameters to provide for the current SQL trigger. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB trigger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlTriggerGetResultsInner createUpdateSqlTrigger( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters) { + return createUpdateSqlTriggerAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + triggerName, + createUpdateSqlTriggerParameters) + .block(); + } + + /** + * Create or update an Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @param createUpdateSqlTriggerParameters The parameters to provide for the current SQL trigger. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB trigger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlTriggerGetResultsInner createUpdateSqlTrigger( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters, + Context context) { + return createUpdateSqlTriggerAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + triggerName, + createUpdateSqlTriggerParameters, + context) + .block(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteSqlTriggerWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (triggerName == null) { + return Mono.error(new IllegalArgumentException("Parameter triggerName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .deleteSqlTrigger( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + triggerName, + this.client.getApiVersion(), + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteSqlTriggerWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (triggerName == null) { + return Mono.error(new IllegalArgumentException("Parameter triggerName is required and cannot be null.")); + } + context = this.client.mergeContext(context); + return service + .deleteSqlTrigger( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + triggerName, + this.client.getApiVersion(), + context); + } + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteSqlTriggerAsync( + String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName) { + Mono>> mono = + deleteSqlTriggerWithResponseAsync(resourceGroupName, accountName, databaseName, containerName, triggerName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteSqlTriggerAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteSqlTriggerWithResponseAsync( + resourceGroupName, accountName, databaseName, containerName, triggerName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDeleteSqlTrigger( + String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName) { + return beginDeleteSqlTriggerAsync(resourceGroupName, accountName, databaseName, containerName, triggerName) + .getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDeleteSqlTrigger( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + Context context) { + return beginDeleteSqlTriggerAsync( + resourceGroupName, accountName, databaseName, containerName, triggerName, context) + .getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteSqlTriggerAsync( + String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName) { + return beginDeleteSqlTriggerAsync(resourceGroupName, accountName, databaseName, containerName, triggerName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteSqlTriggerAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + Context context) { + return beginDeleteSqlTriggerAsync( + resourceGroupName, accountName, databaseName, containerName, triggerName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteSqlTrigger( + String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName) { + deleteSqlTriggerAsync(resourceGroupName, accountName, databaseName, containerName, triggerName).block(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteSqlTrigger( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + Context context) { + deleteSqlTriggerAsync(resourceGroupName, accountName, databaseName, containerName, triggerName, context) + .block(); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB SQL Role Definition with the given Id. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSqlRoleDefinitionWithResponseAsync( + String roleDefinitionId, String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (roleDefinitionId == null) { + return Mono + .error(new IllegalArgumentException("Parameter roleDefinitionId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getSqlRoleDefinition( + this.client.getEndpoint(), + roleDefinitionId, + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB SQL Role Definition with the given Id. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSqlRoleDefinitionWithResponseAsync( + String roleDefinitionId, String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (roleDefinitionId == null) { + return Mono + .error(new IllegalArgumentException("Parameter roleDefinitionId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getSqlRoleDefinition( + this.client.getEndpoint(), + roleDefinitionId, + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB SQL Role Definition with the given Id. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getSqlRoleDefinitionAsync( + String roleDefinitionId, String resourceGroupName, String accountName) { + return getSqlRoleDefinitionWithResponseAsync(roleDefinitionId, resourceGroupName, accountName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB SQL Role Definition with the given Id. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlRoleDefinitionGetResultsInner getSqlRoleDefinition( + String roleDefinitionId, String resourceGroupName, String accountName) { + return getSqlRoleDefinitionAsync(roleDefinitionId, resourceGroupName, accountName).block(); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB SQL Role Definition with the given Id. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getSqlRoleDefinitionWithResponse( + String roleDefinitionId, String resourceGroupName, String accountName, Context context) { + return getSqlRoleDefinitionWithResponseAsync(roleDefinitionId, resourceGroupName, accountName, context).block(); + } + + /** + * Creates or updates an Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleDefinitionParameters The properties required to create or update a Role Definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateSqlRoleDefinitionWithResponseAsync( + String roleDefinitionId, + String resourceGroupName, + String accountName, + SqlRoleDefinitionCreateUpdateParameters createUpdateSqlRoleDefinitionParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (roleDefinitionId == null) { + return Mono + .error(new IllegalArgumentException("Parameter roleDefinitionId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (createUpdateSqlRoleDefinitionParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateSqlRoleDefinitionParameters is required and cannot be null.")); + } else { + createUpdateSqlRoleDefinitionParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createUpdateSqlRoleDefinition( + this.client.getEndpoint(), + roleDefinitionId, + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + createUpdateSqlRoleDefinitionParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates an Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleDefinitionParameters The properties required to create or update a Role Definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateSqlRoleDefinitionWithResponseAsync( + String roleDefinitionId, + String resourceGroupName, + String accountName, + SqlRoleDefinitionCreateUpdateParameters createUpdateSqlRoleDefinitionParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (roleDefinitionId == null) { + return Mono + .error(new IllegalArgumentException("Parameter roleDefinitionId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (createUpdateSqlRoleDefinitionParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateSqlRoleDefinitionParameters is required and cannot be null.")); + } else { + createUpdateSqlRoleDefinitionParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createUpdateSqlRoleDefinition( + this.client.getEndpoint(), + roleDefinitionId, + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + createUpdateSqlRoleDefinitionParameters, + accept, + context); + } + + /** + * Creates or updates an Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleDefinitionParameters The properties required to create or update a Role Definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, SqlRoleDefinitionGetResultsInner> + beginCreateUpdateSqlRoleDefinitionAsync( + String roleDefinitionId, + String resourceGroupName, + String accountName, + SqlRoleDefinitionCreateUpdateParameters createUpdateSqlRoleDefinitionParameters) { + Mono>> mono = + createUpdateSqlRoleDefinitionWithResponseAsync( + roleDefinitionId, resourceGroupName, accountName, createUpdateSqlRoleDefinitionParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SqlRoleDefinitionGetResultsInner.class, + SqlRoleDefinitionGetResultsInner.class, + Context.NONE); + } + + /** + * Creates or updates an Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleDefinitionParameters The properties required to create or update a Role Definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, SqlRoleDefinitionGetResultsInner> + beginCreateUpdateSqlRoleDefinitionAsync( + String roleDefinitionId, + String resourceGroupName, + String accountName, + SqlRoleDefinitionCreateUpdateParameters createUpdateSqlRoleDefinitionParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createUpdateSqlRoleDefinitionWithResponseAsync( + roleDefinitionId, resourceGroupName, accountName, createUpdateSqlRoleDefinitionParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SqlRoleDefinitionGetResultsInner.class, + SqlRoleDefinitionGetResultsInner.class, + context); + } + + /** + * Creates or updates an Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleDefinitionParameters The properties required to create or update a Role Definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, SqlRoleDefinitionGetResultsInner> + beginCreateUpdateSqlRoleDefinition( + String roleDefinitionId, + String resourceGroupName, + String accountName, + SqlRoleDefinitionCreateUpdateParameters createUpdateSqlRoleDefinitionParameters) { + return beginCreateUpdateSqlRoleDefinitionAsync( + roleDefinitionId, resourceGroupName, accountName, createUpdateSqlRoleDefinitionParameters) + .getSyncPoller(); + } + + /** + * Creates or updates an Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleDefinitionParameters The properties required to create or update a Role Definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, SqlRoleDefinitionGetResultsInner> + beginCreateUpdateSqlRoleDefinition( + String roleDefinitionId, + String resourceGroupName, + String accountName, + SqlRoleDefinitionCreateUpdateParameters createUpdateSqlRoleDefinitionParameters, + Context context) { + return beginCreateUpdateSqlRoleDefinitionAsync( + roleDefinitionId, resourceGroupName, accountName, createUpdateSqlRoleDefinitionParameters, context) + .getSyncPoller(); + } + + /** + * Creates or updates an Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleDefinitionParameters The properties required to create or update a Role Definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateSqlRoleDefinitionAsync( + String roleDefinitionId, + String resourceGroupName, + String accountName, + SqlRoleDefinitionCreateUpdateParameters createUpdateSqlRoleDefinitionParameters) { + return beginCreateUpdateSqlRoleDefinitionAsync( + roleDefinitionId, resourceGroupName, accountName, createUpdateSqlRoleDefinitionParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleDefinitionParameters The properties required to create or update a Role Definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateSqlRoleDefinitionAsync( + String roleDefinitionId, + String resourceGroupName, + String accountName, + SqlRoleDefinitionCreateUpdateParameters createUpdateSqlRoleDefinitionParameters, + Context context) { + return beginCreateUpdateSqlRoleDefinitionAsync( + roleDefinitionId, resourceGroupName, accountName, createUpdateSqlRoleDefinitionParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleDefinitionParameters The properties required to create or update a Role Definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlRoleDefinitionGetResultsInner createUpdateSqlRoleDefinition( + String roleDefinitionId, + String resourceGroupName, + String accountName, + SqlRoleDefinitionCreateUpdateParameters createUpdateSqlRoleDefinitionParameters) { + return createUpdateSqlRoleDefinitionAsync( + roleDefinitionId, resourceGroupName, accountName, createUpdateSqlRoleDefinitionParameters) + .block(); + } + + /** + * Creates or updates an Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleDefinitionParameters The properties required to create or update a Role Definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlRoleDefinitionGetResultsInner createUpdateSqlRoleDefinition( + String roleDefinitionId, + String resourceGroupName, + String accountName, + SqlRoleDefinitionCreateUpdateParameters createUpdateSqlRoleDefinitionParameters, + Context context) { + return createUpdateSqlRoleDefinitionAsync( + roleDefinitionId, resourceGroupName, accountName, createUpdateSqlRoleDefinitionParameters, context) + .block(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteSqlRoleDefinitionWithResponseAsync( + String roleDefinitionId, String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (roleDefinitionId == null) { + return Mono + .error(new IllegalArgumentException("Parameter roleDefinitionId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .deleteSqlRoleDefinition( + this.client.getEndpoint(), + roleDefinitionId, + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an existing Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteSqlRoleDefinitionWithResponseAsync( + String roleDefinitionId, String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (roleDefinitionId == null) { + return Mono + .error(new IllegalArgumentException("Parameter roleDefinitionId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .deleteSqlRoleDefinition( + this.client.getEndpoint(), + roleDefinitionId, + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes an existing Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteSqlRoleDefinitionAsync( + String roleDefinitionId, String resourceGroupName, String accountName) { + Mono>> mono = + deleteSqlRoleDefinitionWithResponseAsync(roleDefinitionId, resourceGroupName, accountName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes an existing Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteSqlRoleDefinitionAsync( + String roleDefinitionId, String resourceGroupName, String accountName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteSqlRoleDefinitionWithResponseAsync(roleDefinitionId, resourceGroupName, accountName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes an existing Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDeleteSqlRoleDefinition( + String roleDefinitionId, String resourceGroupName, String accountName) { + return beginDeleteSqlRoleDefinitionAsync(roleDefinitionId, resourceGroupName, accountName).getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDeleteSqlRoleDefinition( + String roleDefinitionId, String resourceGroupName, String accountName, Context context) { + return beginDeleteSqlRoleDefinitionAsync(roleDefinitionId, resourceGroupName, accountName, context) + .getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteSqlRoleDefinitionAsync( + String roleDefinitionId, String resourceGroupName, String accountName) { + return beginDeleteSqlRoleDefinitionAsync(roleDefinitionId, resourceGroupName, accountName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteSqlRoleDefinitionAsync( + String roleDefinitionId, String resourceGroupName, String accountName, Context context) { + return beginDeleteSqlRoleDefinitionAsync(roleDefinitionId, resourceGroupName, accountName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteSqlRoleDefinition(String roleDefinitionId, String resourceGroupName, String accountName) { + deleteSqlRoleDefinitionAsync(roleDefinitionId, resourceGroupName, accountName).block(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteSqlRoleDefinition( + String roleDefinitionId, String resourceGroupName, String accountName, Context context) { + deleteSqlRoleDefinitionAsync(roleDefinitionId, resourceGroupName, accountName, context).block(); + } + + /** + * Retrieves the list of all Azure Cosmos DB SQL Role Definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the relevant Role Definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSqlRoleDefinitionsSinglePageAsync( + String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listSqlRoleDefinitions( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the list of all Azure Cosmos DB SQL Role Definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the relevant Role Definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSqlRoleDefinitionsSinglePageAsync( + String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listSqlRoleDefinitions( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieves the list of all Azure Cosmos DB SQL Role Definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the relevant Role Definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listSqlRoleDefinitionsAsync( + String resourceGroupName, String accountName) { + return new PagedFlux<>(() -> listSqlRoleDefinitionsSinglePageAsync(resourceGroupName, accountName)); + } + + /** + * Retrieves the list of all Azure Cosmos DB SQL Role Definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the relevant Role Definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listSqlRoleDefinitionsAsync( + String resourceGroupName, String accountName, Context context) { + return new PagedFlux<>(() -> listSqlRoleDefinitionsSinglePageAsync(resourceGroupName, accountName, context)); + } + + /** + * Retrieves the list of all Azure Cosmos DB SQL Role Definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the relevant Role Definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSqlRoleDefinitions( + String resourceGroupName, String accountName) { + return new PagedIterable<>(listSqlRoleDefinitionsAsync(resourceGroupName, accountName)); + } + + /** + * Retrieves the list of all Azure Cosmos DB SQL Role Definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the relevant Role Definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSqlRoleDefinitions( + String resourceGroupName, String accountName, Context context) { + return new PagedIterable<>(listSqlRoleDefinitionsAsync(resourceGroupName, accountName, context)); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB SQL Role Assignment with the given Id. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSqlRoleAssignmentWithResponseAsync( + String roleAssignmentId, String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (roleAssignmentId == null) { + return Mono + .error(new IllegalArgumentException("Parameter roleAssignmentId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getSqlRoleAssignment( + this.client.getEndpoint(), + roleAssignmentId, + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB SQL Role Assignment with the given Id. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSqlRoleAssignmentWithResponseAsync( + String roleAssignmentId, String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (roleAssignmentId == null) { + return Mono + .error(new IllegalArgumentException("Parameter roleAssignmentId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getSqlRoleAssignment( + this.client.getEndpoint(), + roleAssignmentId, + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB SQL Role Assignment with the given Id. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getSqlRoleAssignmentAsync( + String roleAssignmentId, String resourceGroupName, String accountName) { + return getSqlRoleAssignmentWithResponseAsync(roleAssignmentId, resourceGroupName, accountName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB SQL Role Assignment with the given Id. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlRoleAssignmentGetResultsInner getSqlRoleAssignment( + String roleAssignmentId, String resourceGroupName, String accountName) { + return getSqlRoleAssignmentAsync(roleAssignmentId, resourceGroupName, accountName).block(); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB SQL Role Assignment with the given Id. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getSqlRoleAssignmentWithResponse( + String roleAssignmentId, String resourceGroupName, String accountName, Context context) { + return getSqlRoleAssignmentWithResponseAsync(roleAssignmentId, resourceGroupName, accountName, context).block(); + } + + /** + * Creates or updates an Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleAssignmentParameters The properties required to create or update a Role Assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateSqlRoleAssignmentWithResponseAsync( + String roleAssignmentId, + String resourceGroupName, + String accountName, + SqlRoleAssignmentCreateUpdateParameters createUpdateSqlRoleAssignmentParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (roleAssignmentId == null) { + return Mono + .error(new IllegalArgumentException("Parameter roleAssignmentId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (createUpdateSqlRoleAssignmentParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateSqlRoleAssignmentParameters is required and cannot be null.")); + } else { + createUpdateSqlRoleAssignmentParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createUpdateSqlRoleAssignment( + this.client.getEndpoint(), + roleAssignmentId, + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + createUpdateSqlRoleAssignmentParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates an Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleAssignmentParameters The properties required to create or update a Role Assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateSqlRoleAssignmentWithResponseAsync( + String roleAssignmentId, + String resourceGroupName, + String accountName, + SqlRoleAssignmentCreateUpdateParameters createUpdateSqlRoleAssignmentParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (roleAssignmentId == null) { + return Mono + .error(new IllegalArgumentException("Parameter roleAssignmentId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (createUpdateSqlRoleAssignmentParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateSqlRoleAssignmentParameters is required and cannot be null.")); + } else { + createUpdateSqlRoleAssignmentParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createUpdateSqlRoleAssignment( + this.client.getEndpoint(), + roleAssignmentId, + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + createUpdateSqlRoleAssignmentParameters, + accept, + context); + } + + /** + * Creates or updates an Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleAssignmentParameters The properties required to create or update a Role Assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, SqlRoleAssignmentGetResultsInner> + beginCreateUpdateSqlRoleAssignmentAsync( + String roleAssignmentId, + String resourceGroupName, + String accountName, + SqlRoleAssignmentCreateUpdateParameters createUpdateSqlRoleAssignmentParameters) { + Mono>> mono = + createUpdateSqlRoleAssignmentWithResponseAsync( + roleAssignmentId, resourceGroupName, accountName, createUpdateSqlRoleAssignmentParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SqlRoleAssignmentGetResultsInner.class, + SqlRoleAssignmentGetResultsInner.class, + Context.NONE); + } + + /** + * Creates or updates an Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleAssignmentParameters The properties required to create or update a Role Assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, SqlRoleAssignmentGetResultsInner> + beginCreateUpdateSqlRoleAssignmentAsync( + String roleAssignmentId, + String resourceGroupName, + String accountName, + SqlRoleAssignmentCreateUpdateParameters createUpdateSqlRoleAssignmentParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createUpdateSqlRoleAssignmentWithResponseAsync( + roleAssignmentId, resourceGroupName, accountName, createUpdateSqlRoleAssignmentParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SqlRoleAssignmentGetResultsInner.class, + SqlRoleAssignmentGetResultsInner.class, + context); + } + + /** + * Creates or updates an Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleAssignmentParameters The properties required to create or update a Role Assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, SqlRoleAssignmentGetResultsInner> + beginCreateUpdateSqlRoleAssignment( + String roleAssignmentId, + String resourceGroupName, + String accountName, + SqlRoleAssignmentCreateUpdateParameters createUpdateSqlRoleAssignmentParameters) { + return beginCreateUpdateSqlRoleAssignmentAsync( + roleAssignmentId, resourceGroupName, accountName, createUpdateSqlRoleAssignmentParameters) + .getSyncPoller(); + } + + /** + * Creates or updates an Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleAssignmentParameters The properties required to create or update a Role Assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, SqlRoleAssignmentGetResultsInner> + beginCreateUpdateSqlRoleAssignment( + String roleAssignmentId, + String resourceGroupName, + String accountName, + SqlRoleAssignmentCreateUpdateParameters createUpdateSqlRoleAssignmentParameters, + Context context) { + return beginCreateUpdateSqlRoleAssignmentAsync( + roleAssignmentId, resourceGroupName, accountName, createUpdateSqlRoleAssignmentParameters, context) + .getSyncPoller(); + } + + /** + * Creates or updates an Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleAssignmentParameters The properties required to create or update a Role Assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateSqlRoleAssignmentAsync( + String roleAssignmentId, + String resourceGroupName, + String accountName, + SqlRoleAssignmentCreateUpdateParameters createUpdateSqlRoleAssignmentParameters) { + return beginCreateUpdateSqlRoleAssignmentAsync( + roleAssignmentId, resourceGroupName, accountName, createUpdateSqlRoleAssignmentParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleAssignmentParameters The properties required to create or update a Role Assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateSqlRoleAssignmentAsync( + String roleAssignmentId, + String resourceGroupName, + String accountName, + SqlRoleAssignmentCreateUpdateParameters createUpdateSqlRoleAssignmentParameters, + Context context) { + return beginCreateUpdateSqlRoleAssignmentAsync( + roleAssignmentId, resourceGroupName, accountName, createUpdateSqlRoleAssignmentParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleAssignmentParameters The properties required to create or update a Role Assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlRoleAssignmentGetResultsInner createUpdateSqlRoleAssignment( + String roleAssignmentId, + String resourceGroupName, + String accountName, + SqlRoleAssignmentCreateUpdateParameters createUpdateSqlRoleAssignmentParameters) { + return createUpdateSqlRoleAssignmentAsync( + roleAssignmentId, resourceGroupName, accountName, createUpdateSqlRoleAssignmentParameters) + .block(); + } + + /** + * Creates or updates an Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleAssignmentParameters The properties required to create or update a Role Assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlRoleAssignmentGetResultsInner createUpdateSqlRoleAssignment( + String roleAssignmentId, + String resourceGroupName, + String accountName, + SqlRoleAssignmentCreateUpdateParameters createUpdateSqlRoleAssignmentParameters, + Context context) { + return createUpdateSqlRoleAssignmentAsync( + roleAssignmentId, resourceGroupName, accountName, createUpdateSqlRoleAssignmentParameters, context) + .block(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteSqlRoleAssignmentWithResponseAsync( + String roleAssignmentId, String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (roleAssignmentId == null) { + return Mono + .error(new IllegalArgumentException("Parameter roleAssignmentId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .deleteSqlRoleAssignment( + this.client.getEndpoint(), + roleAssignmentId, + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an existing Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteSqlRoleAssignmentWithResponseAsync( + String roleAssignmentId, String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (roleAssignmentId == null) { + return Mono + .error(new IllegalArgumentException("Parameter roleAssignmentId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .deleteSqlRoleAssignment( + this.client.getEndpoint(), + roleAssignmentId, + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes an existing Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteSqlRoleAssignmentAsync( + String roleAssignmentId, String resourceGroupName, String accountName) { + Mono>> mono = + deleteSqlRoleAssignmentWithResponseAsync(roleAssignmentId, resourceGroupName, accountName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes an existing Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteSqlRoleAssignmentAsync( + String roleAssignmentId, String resourceGroupName, String accountName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteSqlRoleAssignmentWithResponseAsync(roleAssignmentId, resourceGroupName, accountName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes an existing Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDeleteSqlRoleAssignment( + String roleAssignmentId, String resourceGroupName, String accountName) { + return beginDeleteSqlRoleAssignmentAsync(roleAssignmentId, resourceGroupName, accountName).getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDeleteSqlRoleAssignment( + String roleAssignmentId, String resourceGroupName, String accountName, Context context) { + return beginDeleteSqlRoleAssignmentAsync(roleAssignmentId, resourceGroupName, accountName, context) + .getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteSqlRoleAssignmentAsync( + String roleAssignmentId, String resourceGroupName, String accountName) { + return beginDeleteSqlRoleAssignmentAsync(roleAssignmentId, resourceGroupName, accountName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteSqlRoleAssignmentAsync( + String roleAssignmentId, String resourceGroupName, String accountName, Context context) { + return beginDeleteSqlRoleAssignmentAsync(roleAssignmentId, resourceGroupName, accountName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteSqlRoleAssignment(String roleAssignmentId, String resourceGroupName, String accountName) { + deleteSqlRoleAssignmentAsync(roleAssignmentId, resourceGroupName, accountName).block(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteSqlRoleAssignment( + String roleAssignmentId, String resourceGroupName, String accountName, Context context) { + deleteSqlRoleAssignmentAsync(roleAssignmentId, resourceGroupName, accountName, context).block(); + } + + /** + * Retrieves the list of all Azure Cosmos DB SQL Role Assignments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the relevant Role Assignments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSqlRoleAssignmentsSinglePageAsync( + String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listSqlRoleAssignments( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the list of all Azure Cosmos DB SQL Role Assignments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the relevant Role Assignments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSqlRoleAssignmentsSinglePageAsync( + String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listSqlRoleAssignments( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieves the list of all Azure Cosmos DB SQL Role Assignments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the relevant Role Assignments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listSqlRoleAssignmentsAsync( + String resourceGroupName, String accountName) { + return new PagedFlux<>(() -> listSqlRoleAssignmentsSinglePageAsync(resourceGroupName, accountName)); + } + + /** + * Retrieves the list of all Azure Cosmos DB SQL Role Assignments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the relevant Role Assignments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listSqlRoleAssignmentsAsync( + String resourceGroupName, String accountName, Context context) { + return new PagedFlux<>(() -> listSqlRoleAssignmentsSinglePageAsync(resourceGroupName, accountName, context)); + } + + /** + * Retrieves the list of all Azure Cosmos DB SQL Role Assignments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the relevant Role Assignments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSqlRoleAssignments( + String resourceGroupName, String accountName) { + return new PagedIterable<>(listSqlRoleAssignmentsAsync(resourceGroupName, accountName)); + } + + /** + * Retrieves the list of all Azure Cosmos DB SQL Role Assignments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the relevant Role Assignments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSqlRoleAssignments( + String resourceGroupName, String accountName, Context context) { + return new PagedIterable<>(listSqlRoleAssignmentsAsync(resourceGroupName, accountName, context)); + } + + /** + * Retrieves continuous backup information for a container resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param location The name of the continuous backup restore location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup information of a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> retrieveContinuousBackupInformationWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ContinuousBackupRestoreLocation location) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } else { + location.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .retrieveContinuousBackupInformation( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + this.client.getApiVersion(), + location, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves continuous backup information for a container resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param location The name of the continuous backup restore location. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup information of a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> retrieveContinuousBackupInformationWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ContinuousBackupRestoreLocation location, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } else { + location.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .retrieveContinuousBackupInformation( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + this.client.getApiVersion(), + location, + accept, + context); + } + + /** + * Retrieves continuous backup information for a container resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param location The name of the continuous backup restore location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup information of a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, BackupInformationInner> + beginRetrieveContinuousBackupInformationAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ContinuousBackupRestoreLocation location) { + Mono>> mono = + retrieveContinuousBackupInformationWithResponseAsync( + resourceGroupName, accountName, databaseName, containerName, location); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + BackupInformationInner.class, + BackupInformationInner.class, + Context.NONE); + } + + /** + * Retrieves continuous backup information for a container resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param location The name of the continuous backup restore location. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup information of a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, BackupInformationInner> + beginRetrieveContinuousBackupInformationAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ContinuousBackupRestoreLocation location, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + retrieveContinuousBackupInformationWithResponseAsync( + resourceGroupName, accountName, databaseName, containerName, location, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + BackupInformationInner.class, + BackupInformationInner.class, + context); + } + + /** + * Retrieves continuous backup information for a container resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param location The name of the continuous backup restore location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup information of a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, BackupInformationInner> + beginRetrieveContinuousBackupInformation( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ContinuousBackupRestoreLocation location) { + return beginRetrieveContinuousBackupInformationAsync( + resourceGroupName, accountName, databaseName, containerName, location) + .getSyncPoller(); + } + + /** + * Retrieves continuous backup information for a container resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param location The name of the continuous backup restore location. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup information of a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, BackupInformationInner> + beginRetrieveContinuousBackupInformation( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ContinuousBackupRestoreLocation location, + Context context) { + return beginRetrieveContinuousBackupInformationAsync( + resourceGroupName, accountName, databaseName, containerName, location, context) + .getSyncPoller(); + } + + /** + * Retrieves continuous backup information for a container resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param location The name of the continuous backup restore location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup information of a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono retrieveContinuousBackupInformationAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ContinuousBackupRestoreLocation location) { + return beginRetrieveContinuousBackupInformationAsync( + resourceGroupName, accountName, databaseName, containerName, location) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Retrieves continuous backup information for a container resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param location The name of the continuous backup restore location. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup information of a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono retrieveContinuousBackupInformationAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ContinuousBackupRestoreLocation location, + Context context) { + return beginRetrieveContinuousBackupInformationAsync( + resourceGroupName, accountName, databaseName, containerName, location, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Retrieves continuous backup information for a container resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param location The name of the continuous backup restore location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup information of a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BackupInformationInner retrieveContinuousBackupInformation( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ContinuousBackupRestoreLocation location) { + return retrieveContinuousBackupInformationAsync( + resourceGroupName, accountName, databaseName, containerName, location) + .block(); + } + + /** + * Retrieves continuous backup information for a container resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param location The name of the continuous backup restore location. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup information of a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BackupInformationInner retrieveContinuousBackupInformation( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ContinuousBackupRestoreLocation location, + Context context) { + return retrieveContinuousBackupInformationAsync( + resourceGroupName, accountName, databaseName, containerName, location, context) + .block(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlResourcesImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlResourcesImpl.java new file mode 100644 index 0000000000000..a71c1a8287a7a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlResourcesImpl.java @@ -0,0 +1,1826 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.SqlResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.BackupInformationInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlContainerGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlDatabaseGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlRoleAssignmentGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlRoleDefinitionGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlStoredProcedureGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlTriggerGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlUserDefinedFunctionGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ThroughputSettingsGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.BackupInformation; +import com.azure.resourcemanager.cosmos.generated.models.ContinuousBackupRestoreLocation; +import com.azure.resourcemanager.cosmos.generated.models.SqlContainerGetResults; +import com.azure.resourcemanager.cosmos.generated.models.SqlDatabaseGetResults; +import com.azure.resourcemanager.cosmos.generated.models.SqlResources; +import com.azure.resourcemanager.cosmos.generated.models.SqlRoleAssignmentGetResults; +import com.azure.resourcemanager.cosmos.generated.models.SqlRoleDefinitionGetResults; +import com.azure.resourcemanager.cosmos.generated.models.SqlStoredProcedureGetResults; +import com.azure.resourcemanager.cosmos.generated.models.SqlTriggerGetResults; +import com.azure.resourcemanager.cosmos.generated.models.SqlUserDefinedFunctionGetResults; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsGetResults; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class SqlResourcesImpl implements SqlResources { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlResourcesImpl.class); + + private final SqlResourcesClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public SqlResourcesImpl( + SqlResourcesClient innerClient, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listSqlDatabases(String resourceGroupName, String accountName) { + PagedIterable inner = + this.serviceClient().listSqlDatabases(resourceGroupName, accountName); + return Utils.mapPage(inner, inner1 -> new SqlDatabaseGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listSqlDatabases( + String resourceGroupName, String accountName, Context context) { + PagedIterable inner = + this.serviceClient().listSqlDatabases(resourceGroupName, accountName, context); + return Utils.mapPage(inner, inner1 -> new SqlDatabaseGetResultsImpl(inner1, this.manager())); + } + + public SqlDatabaseGetResults getSqlDatabase(String resourceGroupName, String accountName, String databaseName) { + SqlDatabaseGetResultsInner inner = + this.serviceClient().getSqlDatabase(resourceGroupName, accountName, databaseName); + if (inner != null) { + return new SqlDatabaseGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getSqlDatabaseWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context) { + Response inner = + this.serviceClient().getSqlDatabaseWithResponse(resourceGroupName, accountName, databaseName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SqlDatabaseGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteSqlDatabase(String resourceGroupName, String accountName, String databaseName) { + this.serviceClient().deleteSqlDatabase(resourceGroupName, accountName, databaseName); + } + + public void deleteSqlDatabase(String resourceGroupName, String accountName, String databaseName, Context context) { + this.serviceClient().deleteSqlDatabase(resourceGroupName, accountName, databaseName, context); + } + + public ThroughputSettingsGetResults getSqlDatabaseThroughput( + String resourceGroupName, String accountName, String databaseName) { + ThroughputSettingsGetResultsInner inner = + this.serviceClient().getSqlDatabaseThroughput(resourceGroupName, accountName, databaseName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getSqlDatabaseThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context) { + Response inner = + this + .serviceClient() + .getSqlDatabaseThroughputWithResponse(resourceGroupName, accountName, databaseName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ThroughputSettingsGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ThroughputSettingsGetResults updateSqlDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .updateSqlDatabaseThroughput(resourceGroupName, accountName, databaseName, updateThroughputParameters); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults updateSqlDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .updateSqlDatabaseThroughput( + resourceGroupName, accountName, databaseName, updateThroughputParameters, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateSqlDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName) { + ThroughputSettingsGetResultsInner inner = + this.serviceClient().migrateSqlDatabaseToAutoscale(resourceGroupName, accountName, databaseName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateSqlDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName, Context context) { + ThroughputSettingsGetResultsInner inner = + this.serviceClient().migrateSqlDatabaseToAutoscale(resourceGroupName, accountName, databaseName, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateSqlDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName) { + ThroughputSettingsGetResultsInner inner = + this.serviceClient().migrateSqlDatabaseToManualThroughput(resourceGroupName, accountName, databaseName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateSqlDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName, Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateSqlDatabaseToManualThroughput(resourceGroupName, accountName, databaseName, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listSqlContainers( + String resourceGroupName, String accountName, String databaseName) { + PagedIterable inner = + this.serviceClient().listSqlContainers(resourceGroupName, accountName, databaseName); + return Utils.mapPage(inner, inner1 -> new SqlContainerGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listSqlContainers( + String resourceGroupName, String accountName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listSqlContainers(resourceGroupName, accountName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new SqlContainerGetResultsImpl(inner1, this.manager())); + } + + public SqlContainerGetResults getSqlContainer( + String resourceGroupName, String accountName, String databaseName, String containerName) { + SqlContainerGetResultsInner inner = + this.serviceClient().getSqlContainer(resourceGroupName, accountName, databaseName, containerName); + if (inner != null) { + return new SqlContainerGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getSqlContainerWithResponse( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + Response inner = + this + .serviceClient() + .getSqlContainerWithResponse(resourceGroupName, accountName, databaseName, containerName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SqlContainerGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteSqlContainer( + String resourceGroupName, String accountName, String databaseName, String containerName) { + this.serviceClient().deleteSqlContainer(resourceGroupName, accountName, databaseName, containerName); + } + + public void deleteSqlContainer( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + this.serviceClient().deleteSqlContainer(resourceGroupName, accountName, databaseName, containerName, context); + } + + public ThroughputSettingsGetResults getSqlContainerThroughput( + String resourceGroupName, String accountName, String databaseName, String containerName) { + ThroughputSettingsGetResultsInner inner = + this.serviceClient().getSqlContainerThroughput(resourceGroupName, accountName, databaseName, containerName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getSqlContainerThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + Response inner = + this + .serviceClient() + .getSqlContainerThroughputWithResponse( + resourceGroupName, accountName, databaseName, containerName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ThroughputSettingsGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ThroughputSettingsGetResults updateSqlContainerThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .updateSqlContainerThroughput( + resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults updateSqlContainerThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .updateSqlContainerThroughput( + resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateSqlContainerToAutoscale( + String resourceGroupName, String accountName, String databaseName, String containerName) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateSqlContainerToAutoscale(resourceGroupName, accountName, databaseName, containerName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateSqlContainerToAutoscale( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateSqlContainerToAutoscale(resourceGroupName, accountName, databaseName, containerName, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateSqlContainerToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String containerName) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateSqlContainerToManualThroughput(resourceGroupName, accountName, databaseName, containerName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateSqlContainerToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateSqlContainerToManualThroughput( + resourceGroupName, accountName, databaseName, containerName, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listSqlStoredProcedures( + String resourceGroupName, String accountName, String databaseName, String containerName) { + PagedIterable inner = + this.serviceClient().listSqlStoredProcedures(resourceGroupName, accountName, databaseName, containerName); + return Utils.mapPage(inner, inner1 -> new SqlStoredProcedureGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listSqlStoredProcedures( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + PagedIterable inner = + this + .serviceClient() + .listSqlStoredProcedures(resourceGroupName, accountName, databaseName, containerName, context); + return Utils.mapPage(inner, inner1 -> new SqlStoredProcedureGetResultsImpl(inner1, this.manager())); + } + + public SqlStoredProcedureGetResults getSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName) { + SqlStoredProcedureGetResultsInner inner = + this + .serviceClient() + .getSqlStoredProcedure( + resourceGroupName, accountName, databaseName, containerName, storedProcedureName); + if (inner != null) { + return new SqlStoredProcedureGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getSqlStoredProcedureWithResponse( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + Context context) { + Response inner = + this + .serviceClient() + .getSqlStoredProcedureWithResponse( + resourceGroupName, accountName, databaseName, containerName, storedProcedureName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SqlStoredProcedureGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName) { + this + .serviceClient() + .deleteSqlStoredProcedure(resourceGroupName, accountName, databaseName, containerName, storedProcedureName); + } + + public void deleteSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + Context context) { + this + .serviceClient() + .deleteSqlStoredProcedure( + resourceGroupName, accountName, databaseName, containerName, storedProcedureName, context); + } + + public PagedIterable listSqlUserDefinedFunctions( + String resourceGroupName, String accountName, String databaseName, String containerName) { + PagedIterable inner = + this + .serviceClient() + .listSqlUserDefinedFunctions(resourceGroupName, accountName, databaseName, containerName); + return Utils.mapPage(inner, inner1 -> new SqlUserDefinedFunctionGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listSqlUserDefinedFunctions( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + PagedIterable inner = + this + .serviceClient() + .listSqlUserDefinedFunctions(resourceGroupName, accountName, databaseName, containerName, context); + return Utils.mapPage(inner, inner1 -> new SqlUserDefinedFunctionGetResultsImpl(inner1, this.manager())); + } + + public SqlUserDefinedFunctionGetResults getSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName) { + SqlUserDefinedFunctionGetResultsInner inner = + this + .serviceClient() + .getSqlUserDefinedFunction( + resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName); + if (inner != null) { + return new SqlUserDefinedFunctionGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getSqlUserDefinedFunctionWithResponse( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + Context context) { + Response inner = + this + .serviceClient() + .getSqlUserDefinedFunctionWithResponse( + resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SqlUserDefinedFunctionGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName) { + this + .serviceClient() + .deleteSqlUserDefinedFunction( + resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName); + } + + public void deleteSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + Context context) { + this + .serviceClient() + .deleteSqlUserDefinedFunction( + resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, context); + } + + public PagedIterable listSqlTriggers( + String resourceGroupName, String accountName, String databaseName, String containerName) { + PagedIterable inner = + this.serviceClient().listSqlTriggers(resourceGroupName, accountName, databaseName, containerName); + return Utils.mapPage(inner, inner1 -> new SqlTriggerGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listSqlTriggers( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + PagedIterable inner = + this.serviceClient().listSqlTriggers(resourceGroupName, accountName, databaseName, containerName, context); + return Utils.mapPage(inner, inner1 -> new SqlTriggerGetResultsImpl(inner1, this.manager())); + } + + public SqlTriggerGetResults getSqlTrigger( + String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName) { + SqlTriggerGetResultsInner inner = + this + .serviceClient() + .getSqlTrigger(resourceGroupName, accountName, databaseName, containerName, triggerName); + if (inner != null) { + return new SqlTriggerGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getSqlTriggerWithResponse( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + Context context) { + Response inner = + this + .serviceClient() + .getSqlTriggerWithResponse( + resourceGroupName, accountName, databaseName, containerName, triggerName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SqlTriggerGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteSqlTrigger( + String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName) { + this.serviceClient().deleteSqlTrigger(resourceGroupName, accountName, databaseName, containerName, triggerName); + } + + public void deleteSqlTrigger( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + Context context) { + this + .serviceClient() + .deleteSqlTrigger(resourceGroupName, accountName, databaseName, containerName, triggerName, context); + } + + public SqlRoleDefinitionGetResults getSqlRoleDefinition( + String roleDefinitionId, String resourceGroupName, String accountName) { + SqlRoleDefinitionGetResultsInner inner = + this.serviceClient().getSqlRoleDefinition(roleDefinitionId, resourceGroupName, accountName); + if (inner != null) { + return new SqlRoleDefinitionGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getSqlRoleDefinitionWithResponse( + String roleDefinitionId, String resourceGroupName, String accountName, Context context) { + Response inner = + this + .serviceClient() + .getSqlRoleDefinitionWithResponse(roleDefinitionId, resourceGroupName, accountName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SqlRoleDefinitionGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteSqlRoleDefinition(String roleDefinitionId, String resourceGroupName, String accountName) { + this.serviceClient().deleteSqlRoleDefinition(roleDefinitionId, resourceGroupName, accountName); + } + + public void deleteSqlRoleDefinition( + String roleDefinitionId, String resourceGroupName, String accountName, Context context) { + this.serviceClient().deleteSqlRoleDefinition(roleDefinitionId, resourceGroupName, accountName, context); + } + + public PagedIterable listSqlRoleDefinitions( + String resourceGroupName, String accountName) { + PagedIterable inner = + this.serviceClient().listSqlRoleDefinitions(resourceGroupName, accountName); + return Utils.mapPage(inner, inner1 -> new SqlRoleDefinitionGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listSqlRoleDefinitions( + String resourceGroupName, String accountName, Context context) { + PagedIterable inner = + this.serviceClient().listSqlRoleDefinitions(resourceGroupName, accountName, context); + return Utils.mapPage(inner, inner1 -> new SqlRoleDefinitionGetResultsImpl(inner1, this.manager())); + } + + public SqlRoleAssignmentGetResults getSqlRoleAssignment( + String roleAssignmentId, String resourceGroupName, String accountName) { + SqlRoleAssignmentGetResultsInner inner = + this.serviceClient().getSqlRoleAssignment(roleAssignmentId, resourceGroupName, accountName); + if (inner != null) { + return new SqlRoleAssignmentGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getSqlRoleAssignmentWithResponse( + String roleAssignmentId, String resourceGroupName, String accountName, Context context) { + Response inner = + this + .serviceClient() + .getSqlRoleAssignmentWithResponse(roleAssignmentId, resourceGroupName, accountName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SqlRoleAssignmentGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteSqlRoleAssignment(String roleAssignmentId, String resourceGroupName, String accountName) { + this.serviceClient().deleteSqlRoleAssignment(roleAssignmentId, resourceGroupName, accountName); + } + + public void deleteSqlRoleAssignment( + String roleAssignmentId, String resourceGroupName, String accountName, Context context) { + this.serviceClient().deleteSqlRoleAssignment(roleAssignmentId, resourceGroupName, accountName, context); + } + + public PagedIterable listSqlRoleAssignments( + String resourceGroupName, String accountName) { + PagedIterable inner = + this.serviceClient().listSqlRoleAssignments(resourceGroupName, accountName); + return Utils.mapPage(inner, inner1 -> new SqlRoleAssignmentGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listSqlRoleAssignments( + String resourceGroupName, String accountName, Context context) { + PagedIterable inner = + this.serviceClient().listSqlRoleAssignments(resourceGroupName, accountName, context); + return Utils.mapPage(inner, inner1 -> new SqlRoleAssignmentGetResultsImpl(inner1, this.manager())); + } + + public BackupInformation retrieveContinuousBackupInformation( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ContinuousBackupRestoreLocation location) { + BackupInformationInner inner = + this + .serviceClient() + .retrieveContinuousBackupInformation( + resourceGroupName, accountName, databaseName, containerName, location); + if (inner != null) { + return new BackupInformationImpl(inner, this.manager()); + } else { + return null; + } + } + + public BackupInformation retrieveContinuousBackupInformation( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ContinuousBackupRestoreLocation location, + Context context) { + BackupInformationInner inner = + this + .serviceClient() + .retrieveContinuousBackupInformation( + resourceGroupName, accountName, databaseName, containerName, location, context); + if (inner != null) { + return new BackupInformationImpl(inner, this.manager()); + } else { + return null; + } + } + + public SqlDatabaseGetResults getSqlDatabaseById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + return this.getSqlDatabaseWithResponse(resourceGroupName, accountName, databaseName, Context.NONE).getValue(); + } + + public Response getSqlDatabaseByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + return this.getSqlDatabaseWithResponse(resourceGroupName, accountName, databaseName, context); + } + + public SqlContainerGetResults getSqlContainerById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + return this + .getSqlContainerWithResponse(resourceGroupName, accountName, databaseName, containerName, Context.NONE) + .getValue(); + } + + public Response getSqlContainerByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + return this.getSqlContainerWithResponse(resourceGroupName, accountName, databaseName, containerName, context); + } + + public SqlStoredProcedureGetResults getSqlStoredProcedureById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + String storedProcedureName = Utils.getValueFromIdByName(id, "storedProcedures"); + if (storedProcedureName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'storedProcedures'.", id))); + } + return this + .getSqlStoredProcedureWithResponse( + resourceGroupName, accountName, databaseName, containerName, storedProcedureName, Context.NONE) + .getValue(); + } + + public Response getSqlStoredProcedureByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + String storedProcedureName = Utils.getValueFromIdByName(id, "storedProcedures"); + if (storedProcedureName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'storedProcedures'.", id))); + } + return this + .getSqlStoredProcedureWithResponse( + resourceGroupName, accountName, databaseName, containerName, storedProcedureName, context); + } + + public SqlUserDefinedFunctionGetResults getSqlUserDefinedFunctionById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + String userDefinedFunctionName = Utils.getValueFromIdByName(id, "userDefinedFunctions"); + if (userDefinedFunctionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'userDefinedFunctions'.", + id))); + } + return this + .getSqlUserDefinedFunctionWithResponse( + resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, Context.NONE) + .getValue(); + } + + public Response getSqlUserDefinedFunctionByIdWithResponse( + String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + String userDefinedFunctionName = Utils.getValueFromIdByName(id, "userDefinedFunctions"); + if (userDefinedFunctionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'userDefinedFunctions'.", + id))); + } + return this + .getSqlUserDefinedFunctionWithResponse( + resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, context); + } + + public SqlTriggerGetResults getSqlTriggerById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + String triggerName = Utils.getValueFromIdByName(id, "triggers"); + if (triggerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'triggers'.", id))); + } + return this + .getSqlTriggerWithResponse( + resourceGroupName, accountName, databaseName, containerName, triggerName, Context.NONE) + .getValue(); + } + + public Response getSqlTriggerByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + String triggerName = Utils.getValueFromIdByName(id, "triggers"); + if (triggerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'triggers'.", id))); + } + return this + .getSqlTriggerWithResponse( + resourceGroupName, accountName, databaseName, containerName, triggerName, context); + } + + public SqlRoleDefinitionGetResults getSqlRoleDefinitionById(String id) { + String roleDefinitionId = Utils.getValueFromIdByName(id, "sqlRoleDefinitions"); + if (roleDefinitionId == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlRoleDefinitions'.", id))); + } + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + return this + .getSqlRoleDefinitionWithResponse(roleDefinitionId, resourceGroupName, accountName, Context.NONE) + .getValue(); + } + + public Response getSqlRoleDefinitionByIdWithResponse(String id, Context context) { + String roleDefinitionId = Utils.getValueFromIdByName(id, "sqlRoleDefinitions"); + if (roleDefinitionId == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlRoleDefinitions'.", id))); + } + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + return this.getSqlRoleDefinitionWithResponse(roleDefinitionId, resourceGroupName, accountName, context); + } + + public SqlRoleAssignmentGetResults getSqlRoleAssignmentById(String id) { + String roleAssignmentId = Utils.getValueFromIdByName(id, "sqlRoleAssignments"); + if (roleAssignmentId == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlRoleAssignments'.", id))); + } + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + return this + .getSqlRoleAssignmentWithResponse(roleAssignmentId, resourceGroupName, accountName, Context.NONE) + .getValue(); + } + + public Response getSqlRoleAssignmentByIdWithResponse(String id, Context context) { + String roleAssignmentId = Utils.getValueFromIdByName(id, "sqlRoleAssignments"); + if (roleAssignmentId == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlRoleAssignments'.", id))); + } + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + return this.getSqlRoleAssignmentWithResponse(roleAssignmentId, resourceGroupName, accountName, context); + } + + public void deleteSqlDatabaseById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + this.deleteSqlDatabase(resourceGroupName, accountName, databaseName, Context.NONE); + } + + public void deleteSqlDatabaseByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + this.deleteSqlDatabase(resourceGroupName, accountName, databaseName, context); + } + + public void deleteSqlContainerById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + this.deleteSqlContainer(resourceGroupName, accountName, databaseName, containerName, Context.NONE); + } + + public void deleteSqlContainerByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + this.deleteSqlContainer(resourceGroupName, accountName, databaseName, containerName, context); + } + + public void deleteSqlStoredProcedureById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + String storedProcedureName = Utils.getValueFromIdByName(id, "storedProcedures"); + if (storedProcedureName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'storedProcedures'.", id))); + } + this + .deleteSqlStoredProcedure( + resourceGroupName, accountName, databaseName, containerName, storedProcedureName, Context.NONE); + } + + public void deleteSqlStoredProcedureByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + String storedProcedureName = Utils.getValueFromIdByName(id, "storedProcedures"); + if (storedProcedureName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'storedProcedures'.", id))); + } + this + .deleteSqlStoredProcedure( + resourceGroupName, accountName, databaseName, containerName, storedProcedureName, context); + } + + public void deleteSqlUserDefinedFunctionById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + String userDefinedFunctionName = Utils.getValueFromIdByName(id, "userDefinedFunctions"); + if (userDefinedFunctionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'userDefinedFunctions'.", + id))); + } + this + .deleteSqlUserDefinedFunction( + resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, Context.NONE); + } + + public void deleteSqlUserDefinedFunctionByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + String userDefinedFunctionName = Utils.getValueFromIdByName(id, "userDefinedFunctions"); + if (userDefinedFunctionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'userDefinedFunctions'.", + id))); + } + this + .deleteSqlUserDefinedFunction( + resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, context); + } + + public void deleteSqlTriggerById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + String triggerName = Utils.getValueFromIdByName(id, "triggers"); + if (triggerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'triggers'.", id))); + } + this.deleteSqlTrigger(resourceGroupName, accountName, databaseName, containerName, triggerName, Context.NONE); + } + + public void deleteSqlTriggerByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + String triggerName = Utils.getValueFromIdByName(id, "triggers"); + if (triggerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'triggers'.", id))); + } + this.deleteSqlTrigger(resourceGroupName, accountName, databaseName, containerName, triggerName, context); + } + + public void deleteSqlRoleDefinitionById(String id) { + String roleDefinitionId = Utils.getValueFromIdByName(id, "sqlRoleDefinitions"); + if (roleDefinitionId == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlRoleDefinitions'.", id))); + } + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + this.deleteSqlRoleDefinition(roleDefinitionId, resourceGroupName, accountName, Context.NONE); + } + + public void deleteSqlRoleDefinitionByIdWithResponse(String id, Context context) { + String roleDefinitionId = Utils.getValueFromIdByName(id, "sqlRoleDefinitions"); + if (roleDefinitionId == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlRoleDefinitions'.", id))); + } + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + this.deleteSqlRoleDefinition(roleDefinitionId, resourceGroupName, accountName, context); + } + + public void deleteSqlRoleAssignmentById(String id) { + String roleAssignmentId = Utils.getValueFromIdByName(id, "sqlRoleAssignments"); + if (roleAssignmentId == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlRoleAssignments'.", id))); + } + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + this.deleteSqlRoleAssignment(roleAssignmentId, resourceGroupName, accountName, Context.NONE); + } + + public void deleteSqlRoleAssignmentByIdWithResponse(String id, Context context) { + String roleAssignmentId = Utils.getValueFromIdByName(id, "sqlRoleAssignments"); + if (roleAssignmentId == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlRoleAssignments'.", id))); + } + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + this.deleteSqlRoleAssignment(roleAssignmentId, resourceGroupName, accountName, context); + } + + private SqlResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + public SqlDatabaseGetResultsImpl defineUpdateSqlDatabase(String name) { + return new SqlDatabaseGetResultsImpl(name, this.manager()); + } + + public SqlContainerGetResultsImpl defineUpdateSqlContainer(String name) { + return new SqlContainerGetResultsImpl(name, this.manager()); + } + + public SqlStoredProcedureGetResultsImpl defineUpdateSqlStoredProcedure(String name) { + return new SqlStoredProcedureGetResultsImpl(name, this.manager()); + } + + public SqlUserDefinedFunctionGetResultsImpl defineUpdateSqlUserDefinedFunction(String name) { + return new SqlUserDefinedFunctionGetResultsImpl(name, this.manager()); + } + + public SqlTriggerGetResultsImpl defineUpdateSqlTrigger(String name) { + return new SqlTriggerGetResultsImpl(name, this.manager()); + } + + public SqlRoleDefinitionGetResultsImpl defineUpdateSqlRoleDefinition(String name) { + return new SqlRoleDefinitionGetResultsImpl(name, this.manager()); + } + + public SqlRoleAssignmentGetResultsImpl defineUpdateSqlRoleAssignment(String name) { + return new SqlRoleAssignmentGetResultsImpl(name, this.manager()); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlRoleAssignmentGetResultsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlRoleAssignmentGetResultsImpl.java new file mode 100644 index 0000000000000..abd15496cb7c1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlRoleAssignmentGetResultsImpl.java @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlRoleAssignmentGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.SqlRoleAssignmentCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.SqlRoleAssignmentGetResults; + +public final class SqlRoleAssignmentGetResultsImpl + implements SqlRoleAssignmentGetResults, SqlRoleAssignmentGetResults.Definition, SqlRoleAssignmentGetResults.Update { + private SqlRoleAssignmentGetResultsInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String roleDefinitionId() { + return this.innerModel().roleDefinitionId(); + } + + public String scope() { + return this.innerModel().scope(); + } + + public String principalId() { + return this.innerModel().principalId(); + } + + public SqlRoleAssignmentGetResultsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + private String roleAssignmentId; + + private String resourceGroupName; + + private String accountName; + + private SqlRoleAssignmentCreateUpdateParameters createCreateUpdateSqlRoleAssignmentParameters; + + private SqlRoleAssignmentCreateUpdateParameters updateCreateUpdateSqlRoleAssignmentParameters; + + public SqlRoleAssignmentGetResultsImpl withExistingDatabaseAccount(String resourceGroupName, String accountName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + return this; + } + + public SqlRoleAssignmentGetResults create() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .createUpdateSqlRoleAssignment( + roleAssignmentId, + resourceGroupName, + accountName, + createCreateUpdateSqlRoleAssignmentParameters, + Context.NONE); + return this; + } + + public SqlRoleAssignmentGetResults create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .createUpdateSqlRoleAssignment( + roleAssignmentId, + resourceGroupName, + accountName, + createCreateUpdateSqlRoleAssignmentParameters, + context); + return this; + } + + SqlRoleAssignmentGetResultsImpl( + String name, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = new SqlRoleAssignmentGetResultsInner(); + this.serviceManager = serviceManager; + this.roleAssignmentId = name; + this.createCreateUpdateSqlRoleAssignmentParameters = new SqlRoleAssignmentCreateUpdateParameters(); + } + + public SqlRoleAssignmentGetResultsImpl update() { + this.updateCreateUpdateSqlRoleAssignmentParameters = new SqlRoleAssignmentCreateUpdateParameters(); + return this; + } + + public SqlRoleAssignmentGetResults apply() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .createUpdateSqlRoleAssignment( + roleAssignmentId, + resourceGroupName, + accountName, + updateCreateUpdateSqlRoleAssignmentParameters, + Context.NONE); + return this; + } + + public SqlRoleAssignmentGetResults apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .createUpdateSqlRoleAssignment( + roleAssignmentId, + resourceGroupName, + accountName, + updateCreateUpdateSqlRoleAssignmentParameters, + context); + return this; + } + + SqlRoleAssignmentGetResultsImpl( + SqlRoleAssignmentGetResultsInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.roleAssignmentId = Utils.getValueFromIdByName(innerObject.id(), "sqlRoleAssignments"); + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + } + + public SqlRoleAssignmentGetResults refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .getSqlRoleAssignmentWithResponse(roleAssignmentId, resourceGroupName, accountName, Context.NONE) + .getValue(); + return this; + } + + public SqlRoleAssignmentGetResults refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .getSqlRoleAssignmentWithResponse(roleAssignmentId, resourceGroupName, accountName, context) + .getValue(); + return this; + } + + public SqlRoleAssignmentGetResultsImpl withRoleDefinitionId(String roleDefinitionId) { + if (isInCreateMode()) { + this.createCreateUpdateSqlRoleAssignmentParameters.withRoleDefinitionId(roleDefinitionId); + return this; + } else { + this.updateCreateUpdateSqlRoleAssignmentParameters.withRoleDefinitionId(roleDefinitionId); + return this; + } + } + + public SqlRoleAssignmentGetResultsImpl withScope(String scope) { + if (isInCreateMode()) { + this.createCreateUpdateSqlRoleAssignmentParameters.withScope(scope); + return this; + } else { + this.updateCreateUpdateSqlRoleAssignmentParameters.withScope(scope); + return this; + } + } + + public SqlRoleAssignmentGetResultsImpl withPrincipalId(String principalId) { + if (isInCreateMode()) { + this.createCreateUpdateSqlRoleAssignmentParameters.withPrincipalId(principalId); + return this; + } else { + this.updateCreateUpdateSqlRoleAssignmentParameters.withPrincipalId(principalId); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlRoleDefinitionGetResultsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlRoleDefinitionGetResultsImpl.java new file mode 100644 index 0000000000000..a5343871369a0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlRoleDefinitionGetResultsImpl.java @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlRoleDefinitionGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.Permission; +import com.azure.resourcemanager.cosmos.generated.models.RoleDefinitionType; +import com.azure.resourcemanager.cosmos.generated.models.SqlRoleDefinitionCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.SqlRoleDefinitionGetResults; +import java.util.Collections; +import java.util.List; + +public final class SqlRoleDefinitionGetResultsImpl + implements SqlRoleDefinitionGetResults, SqlRoleDefinitionGetResults.Definition, SqlRoleDefinitionGetResults.Update { + private SqlRoleDefinitionGetResultsInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String roleName() { + return this.innerModel().roleName(); + } + + public RoleDefinitionType typePropertiesType() { + return this.innerModel().typePropertiesType(); + } + + public List assignableScopes() { + List inner = this.innerModel().assignableScopes(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List permissions() { + List inner = this.innerModel().permissions(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public SqlRoleDefinitionGetResultsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + private String roleDefinitionId; + + private String resourceGroupName; + + private String accountName; + + private SqlRoleDefinitionCreateUpdateParameters createCreateUpdateSqlRoleDefinitionParameters; + + private SqlRoleDefinitionCreateUpdateParameters updateCreateUpdateSqlRoleDefinitionParameters; + + public SqlRoleDefinitionGetResultsImpl withExistingDatabaseAccount(String resourceGroupName, String accountName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + return this; + } + + public SqlRoleDefinitionGetResults create() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .createUpdateSqlRoleDefinition( + roleDefinitionId, + resourceGroupName, + accountName, + createCreateUpdateSqlRoleDefinitionParameters, + Context.NONE); + return this; + } + + public SqlRoleDefinitionGetResults create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .createUpdateSqlRoleDefinition( + roleDefinitionId, + resourceGroupName, + accountName, + createCreateUpdateSqlRoleDefinitionParameters, + context); + return this; + } + + SqlRoleDefinitionGetResultsImpl( + String name, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = new SqlRoleDefinitionGetResultsInner(); + this.serviceManager = serviceManager; + this.roleDefinitionId = name; + this.createCreateUpdateSqlRoleDefinitionParameters = new SqlRoleDefinitionCreateUpdateParameters(); + } + + public SqlRoleDefinitionGetResultsImpl update() { + this.updateCreateUpdateSqlRoleDefinitionParameters = new SqlRoleDefinitionCreateUpdateParameters(); + return this; + } + + public SqlRoleDefinitionGetResults apply() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .createUpdateSqlRoleDefinition( + roleDefinitionId, + resourceGroupName, + accountName, + updateCreateUpdateSqlRoleDefinitionParameters, + Context.NONE); + return this; + } + + public SqlRoleDefinitionGetResults apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .createUpdateSqlRoleDefinition( + roleDefinitionId, + resourceGroupName, + accountName, + updateCreateUpdateSqlRoleDefinitionParameters, + context); + return this; + } + + SqlRoleDefinitionGetResultsImpl( + SqlRoleDefinitionGetResultsInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.roleDefinitionId = Utils.getValueFromIdByName(innerObject.id(), "sqlRoleDefinitions"); + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + } + + public SqlRoleDefinitionGetResults refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .getSqlRoleDefinitionWithResponse(roleDefinitionId, resourceGroupName, accountName, Context.NONE) + .getValue(); + return this; + } + + public SqlRoleDefinitionGetResults refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .getSqlRoleDefinitionWithResponse(roleDefinitionId, resourceGroupName, accountName, context) + .getValue(); + return this; + } + + public SqlRoleDefinitionGetResultsImpl withRoleName(String roleName) { + if (isInCreateMode()) { + this.createCreateUpdateSqlRoleDefinitionParameters.withRoleName(roleName); + return this; + } else { + this.updateCreateUpdateSqlRoleDefinitionParameters.withRoleName(roleName); + return this; + } + } + + public SqlRoleDefinitionGetResultsImpl withType(RoleDefinitionType type) { + if (isInCreateMode()) { + this.createCreateUpdateSqlRoleDefinitionParameters.withType(type); + return this; + } else { + this.updateCreateUpdateSqlRoleDefinitionParameters.withType(type); + return this; + } + } + + public SqlRoleDefinitionGetResultsImpl withAssignableScopes(List assignableScopes) { + if (isInCreateMode()) { + this.createCreateUpdateSqlRoleDefinitionParameters.withAssignableScopes(assignableScopes); + return this; + } else { + this.updateCreateUpdateSqlRoleDefinitionParameters.withAssignableScopes(assignableScopes); + return this; + } + } + + public SqlRoleDefinitionGetResultsImpl withPermissions(List permissions) { + if (isInCreateMode()) { + this.createCreateUpdateSqlRoleDefinitionParameters.withPermissions(permissions); + return this; + } else { + this.updateCreateUpdateSqlRoleDefinitionParameters.withPermissions(permissions); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlStoredProcedureGetResultsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlStoredProcedureGetResultsImpl.java new file mode 100644 index 0000000000000..b745e37477a0c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlStoredProcedureGetResultsImpl.java @@ -0,0 +1,248 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.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 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..beefd25f961ff --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlTriggerGetResultsImpl.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.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 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..ac31667ff794e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlUserDefinedFunctionGetResultsImpl.java @@ -0,0 +1,248 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.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 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..342d3b40acf17 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/TableGetResultsImpl.java @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.TableGetResultsInner; +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 TableGetResultsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String accountName; + + private String tableName; + + private TableCreateUpdateParameters createCreateUpdateTableParameters; + + private TableCreateUpdateParameters updateCreateUpdateTableParameters; + + public TableGetResultsImpl withExistingDatabaseAccount(String resourceGroupName, String accountName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + return this; + } + + public TableGetResults create() { + this.innerObject = + serviceManager + .serviceClient() + .getTableResources() + .createUpdateTable( + resourceGroupName, accountName, tableName, createCreateUpdateTableParameters, Context.NONE); + return this; + } + + public TableGetResults create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getTableResources() + .createUpdateTable( + resourceGroupName, accountName, tableName, createCreateUpdateTableParameters, context); + return this; + } + + TableGetResultsImpl(String name, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = new TableGetResultsInner(); + this.serviceManager = serviceManager; + this.tableName = name; + this.createCreateUpdateTableParameters = new TableCreateUpdateParameters(); + } + + public TableGetResultsImpl update() { + this.updateCreateUpdateTableParameters = new TableCreateUpdateParameters(); + return this; + } + + public TableGetResults apply() { + this.innerObject = + serviceManager + .serviceClient() + .getTableResources() + .createUpdateTable( + resourceGroupName, accountName, tableName, updateCreateUpdateTableParameters, Context.NONE); + return this; + } + + public TableGetResults apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getTableResources() + .createUpdateTable( + resourceGroupName, accountName, tableName, updateCreateUpdateTableParameters, context); + return this; + } + + TableGetResultsImpl( + TableGetResultsInner innerObject, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.tableName = Utils.getValueFromIdByName(innerObject.id(), "tables"); + } + + public TableGetResults refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getTableResources() + .getTableWithResponse(resourceGroupName, accountName, tableName, Context.NONE) + .getValue(); + return this; + } + + public TableGetResults refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getTableResources() + .getTableWithResponse(resourceGroupName, accountName, tableName, context) + .getValue(); + return this; + } + + public TableGetResultsImpl withRegion(Region location) { + this.createCreateUpdateTableParameters.withLocation(location.toString()); + return this; + } + + public TableGetResultsImpl withRegion(String location) { + this.createCreateUpdateTableParameters.withLocation(location); + return this; + } + + public TableGetResultsImpl withResource(TableResource resource) { + if (isInCreateMode()) { + this.createCreateUpdateTableParameters.withResource(resource); + return this; + } else { + this.updateCreateUpdateTableParameters.withResource(resource); + return this; + } + } + + public TableGetResultsImpl withTags(Map tags) { + if (isInCreateMode()) { + this.createCreateUpdateTableParameters.withTags(tags); + return this; + } else { + this.updateCreateUpdateTableParameters.withTags(tags); + return this; + } + } + + public TableGetResultsImpl 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..2ed88e03ba177 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/TableResourcesClientImpl.java @@ -0,0 +1,2160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.cosmos.generated.fluent.TableResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.TableGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ThroughputSettingsGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.TableCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.TableListResult; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in TableResourcesClient. */ +public final class TableResourcesClientImpl implements TableResourcesClient { + private final ClientLogger logger = new ClientLogger(TableResourcesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final TableResourcesService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of TableResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TableResourcesClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy.create(TableResourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientTableResources to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface TableResourcesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/tables") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listTables( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/tables/{tableName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getTable( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("tableName") String tableName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/tables/{tableName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createUpdateTable( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("tableName") String tableName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") TableCreateUpdateParameters createUpdateTableParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/tables/{tableName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> deleteTable( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("tableName") String tableName, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getTableThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("tableName") String tableName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> updateTableThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("tableName") String tableName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ThroughputSettingsUpdateParameters updateThroughputParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default/migrateToAutoscale") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> migrateTableToAutoscale( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("tableName") String tableName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default" + + "/migrateToManualThroughput") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> migrateTableToManualThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("tableName") String tableName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the Tables under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the Table and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listTablesSinglePageAsync( + String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listTables( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the Tables under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the Table and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listTablesSinglePageAsync( + String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listTables( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Lists the Tables under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the Table and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listTablesAsync(String resourceGroupName, String accountName) { + return new PagedFlux<>(() -> listTablesSinglePageAsync(resourceGroupName, accountName)); + } + + /** + * Lists the Tables under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the Table and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listTablesAsync( + String resourceGroupName, String accountName, Context context) { + return new PagedFlux<>(() -> listTablesSinglePageAsync(resourceGroupName, accountName, context)); + } + + /** + * Lists the Tables under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the Table and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listTables(String resourceGroupName, String accountName) { + return new PagedIterable<>(listTablesAsync(resourceGroupName, accountName)); + } + + /** + * Lists the Tables under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the Table and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listTables( + String resourceGroupName, String accountName, Context context) { + return new PagedIterable<>(listTablesAsync(resourceGroupName, accountName, context)); + } + + /** + * Gets the Tables under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Tables under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getTableWithResponseAsync( + String resourceGroupName, String accountName, String tableName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getTable( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + tableName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the Tables under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Tables under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getTableWithResponseAsync( + String resourceGroupName, String accountName, String tableName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getTable( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + tableName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the Tables under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Tables under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getTableAsync(String resourceGroupName, String accountName, String tableName) { + return getTableWithResponseAsync(resourceGroupName, accountName, tableName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the Tables under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Tables under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TableGetResultsInner getTable(String resourceGroupName, String accountName, String tableName) { + return getTableAsync(resourceGroupName, accountName, tableName).block(); + } + + /** + * Gets the Tables under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Tables under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTableWithResponse( + String resourceGroupName, String accountName, String tableName, Context context) { + return getTableWithResponseAsync(resourceGroupName, accountName, tableName, context).block(); + } + + /** + * Create or update an Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param createUpdateTableParameters The parameters to provide for the current Table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateTableWithResponseAsync( + String resourceGroupName, + String accountName, + String tableName, + TableCreateUpdateParameters createUpdateTableParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (createUpdateTableParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateTableParameters is required and cannot be null.")); + } else { + createUpdateTableParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createUpdateTable( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + tableName, + this.client.getApiVersion(), + createUpdateTableParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update an Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param createUpdateTableParameters The parameters to provide for the current Table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateTableWithResponseAsync( + String resourceGroupName, + String accountName, + String tableName, + TableCreateUpdateParameters createUpdateTableParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (createUpdateTableParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateTableParameters is required and cannot be null.")); + } else { + createUpdateTableParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createUpdateTable( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + tableName, + this.client.getApiVersion(), + createUpdateTableParameters, + accept, + context); + } + + /** + * Create or update an Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param createUpdateTableParameters The parameters to provide for the current Table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, TableGetResultsInner> beginCreateUpdateTableAsync( + String resourceGroupName, + String accountName, + String tableName, + TableCreateUpdateParameters createUpdateTableParameters) { + Mono>> mono = + createUpdateTableWithResponseAsync(resourceGroupName, accountName, tableName, createUpdateTableParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + TableGetResultsInner.class, + TableGetResultsInner.class, + Context.NONE); + } + + /** + * Create or update an Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param createUpdateTableParameters The parameters to provide for the current Table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, TableGetResultsInner> beginCreateUpdateTableAsync( + String resourceGroupName, + String accountName, + String tableName, + TableCreateUpdateParameters createUpdateTableParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createUpdateTableWithResponseAsync( + resourceGroupName, accountName, tableName, createUpdateTableParameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), TableGetResultsInner.class, TableGetResultsInner.class, context); + } + + /** + * Create or update an Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param createUpdateTableParameters The parameters to provide for the current Table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, TableGetResultsInner> beginCreateUpdateTable( + String resourceGroupName, + String accountName, + String tableName, + TableCreateUpdateParameters createUpdateTableParameters) { + return beginCreateUpdateTableAsync(resourceGroupName, accountName, tableName, createUpdateTableParameters) + .getSyncPoller(); + } + + /** + * Create or update an Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param createUpdateTableParameters The parameters to provide for the current Table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, TableGetResultsInner> beginCreateUpdateTable( + String resourceGroupName, + String accountName, + String tableName, + TableCreateUpdateParameters createUpdateTableParameters, + Context context) { + return beginCreateUpdateTableAsync( + resourceGroupName, accountName, tableName, createUpdateTableParameters, context) + .getSyncPoller(); + } + + /** + * Create or update an Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param createUpdateTableParameters The parameters to provide for the current Table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateTableAsync( + String resourceGroupName, + String accountName, + String tableName, + TableCreateUpdateParameters createUpdateTableParameters) { + return beginCreateUpdateTableAsync(resourceGroupName, accountName, tableName, createUpdateTableParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update an Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param createUpdateTableParameters The parameters to provide for the current Table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateTableAsync( + String resourceGroupName, + String accountName, + String tableName, + TableCreateUpdateParameters createUpdateTableParameters, + Context context) { + return beginCreateUpdateTableAsync( + resourceGroupName, accountName, tableName, createUpdateTableParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update an Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param createUpdateTableParameters The parameters to provide for the current Table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TableGetResultsInner createUpdateTable( + String resourceGroupName, + String accountName, + String tableName, + TableCreateUpdateParameters createUpdateTableParameters) { + return createUpdateTableAsync(resourceGroupName, accountName, tableName, createUpdateTableParameters).block(); + } + + /** + * Create or update an Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param createUpdateTableParameters The parameters to provide for the current Table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TableGetResultsInner createUpdateTable( + String resourceGroupName, + String accountName, + String tableName, + TableCreateUpdateParameters createUpdateTableParameters, + Context context) { + return createUpdateTableAsync(resourceGroupName, accountName, tableName, createUpdateTableParameters, context) + .block(); + } + + /** + * Deletes an existing Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteTableWithResponseAsync( + String resourceGroupName, String accountName, String tableName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .deleteTable( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + tableName, + this.client.getApiVersion(), + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an existing Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteTableWithResponseAsync( + String resourceGroupName, String accountName, String tableName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + context = this.client.mergeContext(context); + return service + .deleteTable( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + tableName, + this.client.getApiVersion(), + context); + } + + /** + * Deletes an existing Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteTableAsync( + String resourceGroupName, String accountName, String tableName) { + Mono>> mono = deleteTableWithResponseAsync(resourceGroupName, accountName, tableName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes an existing Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteTableAsync( + String resourceGroupName, String accountName, String tableName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteTableWithResponseAsync(resourceGroupName, accountName, tableName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes an existing Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDeleteTable( + String resourceGroupName, String accountName, String tableName) { + return beginDeleteTableAsync(resourceGroupName, accountName, tableName).getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDeleteTable( + String resourceGroupName, String accountName, String tableName, Context context) { + return beginDeleteTableAsync(resourceGroupName, accountName, tableName, context).getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteTableAsync(String resourceGroupName, String accountName, String tableName) { + return beginDeleteTableAsync(resourceGroupName, accountName, tableName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteTableAsync( + String resourceGroupName, String accountName, String tableName, Context context) { + return beginDeleteTableAsync(resourceGroupName, accountName, tableName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteTable(String resourceGroupName, String accountName, String tableName) { + deleteTableAsync(resourceGroupName, accountName, tableName).block(); + } + + /** + * Deletes an existing Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteTable(String resourceGroupName, String accountName, String tableName, Context context) { + deleteTableAsync(resourceGroupName, accountName, tableName, context).block(); + } + + /** + * Gets the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided + * name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getTableThroughputWithResponseAsync( + String resourceGroupName, String accountName, String tableName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getTableThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + tableName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided + * name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getTableThroughputWithResponseAsync( + String resourceGroupName, String accountName, String tableName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getTableThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + tableName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided + * name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getTableThroughputAsync( + String resourceGroupName, String accountName, String tableName) { + return getTableThroughputWithResponseAsync(resourceGroupName, accountName, tableName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided + * name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner getTableThroughput( + String resourceGroupName, String accountName, String tableName) { + return getTableThroughputAsync(resourceGroupName, accountName, tableName).block(); + } + + /** + * Gets the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided + * name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTableThroughputWithResponse( + String resourceGroupName, String accountName, String tableName, Context context) { + return getTableThroughputWithResponseAsync(resourceGroupName, accountName, tableName, context).block(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current Table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateTableThroughputWithResponseAsync( + String resourceGroupName, + String accountName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (updateThroughputParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter updateThroughputParameters is required and cannot be null.")); + } else { + updateThroughputParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateTableThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + tableName, + this.client.getApiVersion(), + updateThroughputParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update RUs per second of an Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current Table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateTableThroughputWithResponseAsync( + String resourceGroupName, + String accountName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (updateThroughputParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter updateThroughputParameters is required and cannot be null.")); + } else { + updateThroughputParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateTableThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + tableName, + this.client.getApiVersion(), + updateThroughputParameters, + accept, + context); + } + + /** + * Update RUs per second of an Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current Table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginUpdateTableThroughputAsync( + String resourceGroupName, + String accountName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + Mono>> mono = + updateTableThroughputWithResponseAsync( + resourceGroupName, accountName, tableName, updateThroughputParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * Update RUs per second of an Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current Table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginUpdateTableThroughputAsync( + String resourceGroupName, + String accountName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateTableThroughputWithResponseAsync( + resourceGroupName, accountName, tableName, updateThroughputParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * Update RUs per second of an Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current Table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateTableThroughput( + String resourceGroupName, + String accountName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateTableThroughputAsync(resourceGroupName, accountName, tableName, updateThroughputParameters) + .getSyncPoller(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current Table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateTableThroughput( + String resourceGroupName, + String accountName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return beginUpdateTableThroughputAsync( + resourceGroupName, accountName, tableName, updateThroughputParameters, context) + .getSyncPoller(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current Table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateTableThroughputAsync( + String resourceGroupName, + String accountName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateTableThroughputAsync(resourceGroupName, accountName, tableName, updateThroughputParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update RUs per second of an Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current Table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateTableThroughputAsync( + String resourceGroupName, + String accountName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return beginUpdateTableThroughputAsync( + resourceGroupName, accountName, tableName, updateThroughputParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update RUs per second of an Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current Table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner updateTableThroughput( + String resourceGroupName, + String accountName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return updateTableThroughputAsync(resourceGroupName, accountName, tableName, updateThroughputParameters) + .block(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current Table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner updateTableThroughput( + String resourceGroupName, + String accountName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return updateTableThroughputAsync( + resourceGroupName, accountName, tableName, updateThroughputParameters, context) + .block(); + } + + /** + * Migrate an Azure Cosmos DB Table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateTableToAutoscaleWithResponseAsync( + String resourceGroupName, String accountName, String tableName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateTableToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + tableName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Migrate an Azure Cosmos DB Table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateTableToAutoscaleWithResponseAsync( + String resourceGroupName, String accountName, String tableName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateTableToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + tableName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Migrate an Azure Cosmos DB Table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateTableToAutoscaleAsync(String resourceGroupName, String accountName, String tableName) { + Mono>> mono = + migrateTableToAutoscaleWithResponseAsync(resourceGroupName, accountName, tableName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * Migrate an Azure Cosmos DB Table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateTableToAutoscaleAsync( + String resourceGroupName, String accountName, String tableName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + migrateTableToAutoscaleWithResponseAsync(resourceGroupName, accountName, tableName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * Migrate an Azure Cosmos DB Table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateTableToAutoscale(String resourceGroupName, String accountName, String tableName) { + return beginMigrateTableToAutoscaleAsync(resourceGroupName, accountName, tableName).getSyncPoller(); + } + + /** + * Migrate an Azure Cosmos DB Table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateTableToAutoscale(String resourceGroupName, String accountName, String tableName, Context context) { + return beginMigrateTableToAutoscaleAsync(resourceGroupName, accountName, tableName, context).getSyncPoller(); + } + + /** + * Migrate an Azure Cosmos DB Table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateTableToAutoscaleAsync( + String resourceGroupName, String accountName, String tableName) { + return beginMigrateTableToAutoscaleAsync(resourceGroupName, accountName, tableName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Migrate an Azure Cosmos DB Table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateTableToAutoscaleAsync( + String resourceGroupName, String accountName, String tableName, Context context) { + return beginMigrateTableToAutoscaleAsync(resourceGroupName, accountName, tableName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Migrate an Azure Cosmos DB Table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateTableToAutoscale( + String resourceGroupName, String accountName, String tableName) { + return migrateTableToAutoscaleAsync(resourceGroupName, accountName, tableName).block(); + } + + /** + * Migrate an Azure Cosmos DB Table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateTableToAutoscale( + String resourceGroupName, String accountName, String tableName, Context context) { + return migrateTableToAutoscaleAsync(resourceGroupName, accountName, tableName, context).block(); + } + + /** + * Migrate an Azure Cosmos DB Table from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateTableToManualThroughputWithResponseAsync( + String resourceGroupName, String accountName, String tableName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateTableToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + tableName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Migrate an Azure Cosmos DB Table from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateTableToManualThroughputWithResponseAsync( + String resourceGroupName, String accountName, String tableName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateTableToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + tableName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Migrate an Azure Cosmos DB Table from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateTableToManualThroughputAsync(String resourceGroupName, String accountName, String tableName) { + Mono>> mono = + migrateTableToManualThroughputWithResponseAsync(resourceGroupName, accountName, tableName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * Migrate an Azure Cosmos DB Table from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateTableToManualThroughputAsync( + String resourceGroupName, String accountName, String tableName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + migrateTableToManualThroughputWithResponseAsync(resourceGroupName, accountName, tableName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * Migrate an Azure Cosmos DB Table from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateTableToManualThroughput(String resourceGroupName, String accountName, String tableName) { + return beginMigrateTableToManualThroughputAsync(resourceGroupName, accountName, tableName).getSyncPoller(); + } + + /** + * Migrate an Azure Cosmos DB Table from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateTableToManualThroughput( + String resourceGroupName, String accountName, String tableName, Context context) { + return beginMigrateTableToManualThroughputAsync(resourceGroupName, accountName, tableName, context) + .getSyncPoller(); + } + + /** + * Migrate an Azure Cosmos DB Table from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateTableToManualThroughputAsync( + String resourceGroupName, String accountName, String tableName) { + return beginMigrateTableToManualThroughputAsync(resourceGroupName, accountName, tableName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Migrate an Azure Cosmos DB Table from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateTableToManualThroughputAsync( + String resourceGroupName, String accountName, String tableName, Context context) { + return beginMigrateTableToManualThroughputAsync(resourceGroupName, accountName, tableName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Migrate an Azure Cosmos DB Table from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateTableToManualThroughput( + String resourceGroupName, String accountName, String tableName) { + return migrateTableToManualThroughputAsync(resourceGroupName, accountName, tableName).block(); + } + + /** + * Migrate an Azure Cosmos DB Table from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateTableToManualThroughput( + String resourceGroupName, String accountName, String tableName, Context context) { + return migrateTableToManualThroughputAsync(resourceGroupName, accountName, tableName, context).block(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/TableResourcesImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/TableResourcesImpl.java new file mode 100644 index 0000000000000..7b153c1a89d3d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/TableResourcesImpl.java @@ -0,0 +1,303 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.TableResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.TableGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ThroughputSettingsGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.TableGetResults; +import com.azure.resourcemanager.cosmos.generated.models.TableResources; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsGetResults; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class TableResourcesImpl implements TableResources { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TableResourcesImpl.class); + + private final TableResourcesClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public TableResourcesImpl( + TableResourcesClient innerClient, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listTables(String resourceGroupName, String accountName) { + PagedIterable inner = this.serviceClient().listTables(resourceGroupName, accountName); + return Utils.mapPage(inner, inner1 -> new TableGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listTables(String resourceGroupName, String accountName, Context context) { + PagedIterable inner = + this.serviceClient().listTables(resourceGroupName, accountName, context); + return Utils.mapPage(inner, inner1 -> new TableGetResultsImpl(inner1, this.manager())); + } + + public TableGetResults getTable(String resourceGroupName, String accountName, String tableName) { + TableGetResultsInner inner = this.serviceClient().getTable(resourceGroupName, accountName, tableName); + if (inner != null) { + return new TableGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getTableWithResponse( + String resourceGroupName, String accountName, String tableName, Context context) { + Response inner = + this.serviceClient().getTableWithResponse(resourceGroupName, accountName, tableName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new TableGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteTable(String resourceGroupName, String accountName, String tableName) { + this.serviceClient().deleteTable(resourceGroupName, accountName, tableName); + } + + public void deleteTable(String resourceGroupName, String accountName, String tableName, Context context) { + this.serviceClient().deleteTable(resourceGroupName, accountName, tableName, context); + } + + public ThroughputSettingsGetResults getTableThroughput( + String resourceGroupName, String accountName, String tableName) { + ThroughputSettingsGetResultsInner inner = + this.serviceClient().getTableThroughput(resourceGroupName, accountName, tableName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getTableThroughputWithResponse( + String resourceGroupName, String accountName, String tableName, Context context) { + Response inner = + this.serviceClient().getTableThroughputWithResponse(resourceGroupName, accountName, tableName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ThroughputSettingsGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ThroughputSettingsGetResults updateTableThroughput( + String resourceGroupName, + String accountName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .updateTableThroughput(resourceGroupName, accountName, tableName, updateThroughputParameters); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults updateTableThroughput( + String resourceGroupName, + String accountName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .updateTableThroughput(resourceGroupName, accountName, tableName, updateThroughputParameters, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateTableToAutoscale( + String resourceGroupName, String accountName, String tableName) { + ThroughputSettingsGetResultsInner inner = + this.serviceClient().migrateTableToAutoscale(resourceGroupName, accountName, tableName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateTableToAutoscale( + String resourceGroupName, String accountName, String tableName, Context context) { + ThroughputSettingsGetResultsInner inner = + this.serviceClient().migrateTableToAutoscale(resourceGroupName, accountName, tableName, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateTableToManualThroughput( + String resourceGroupName, String accountName, String tableName) { + ThroughputSettingsGetResultsInner inner = + this.serviceClient().migrateTableToManualThroughput(resourceGroupName, accountName, tableName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateTableToManualThroughput( + String resourceGroupName, String accountName, String tableName, Context context) { + ThroughputSettingsGetResultsInner inner = + this.serviceClient().migrateTableToManualThroughput(resourceGroupName, accountName, tableName, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public TableGetResults getTableById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String tableName = Utils.getValueFromIdByName(id, "tables"); + if (tableName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tables'.", id))); + } + return this.getTableWithResponse(resourceGroupName, accountName, tableName, Context.NONE).getValue(); + } + + public Response getTableByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String tableName = Utils.getValueFromIdByName(id, "tables"); + if (tableName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tables'.", id))); + } + return this.getTableWithResponse(resourceGroupName, accountName, tableName, context); + } + + public void deleteTableById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String tableName = Utils.getValueFromIdByName(id, "tables"); + if (tableName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tables'.", id))); + } + this.deleteTable(resourceGroupName, accountName, tableName, Context.NONE); + } + + public void deleteTableByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String tableName = Utils.getValueFromIdByName(id, "tables"); + if (tableName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tables'.", id))); + } + this.deleteTable(resourceGroupName, accountName, tableName, context); + } + + private TableResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + public TableGetResultsImpl define(String name) { + return new TableGetResultsImpl(name, this.manager()); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/ThroughputSettingsGetResultsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/ThroughputSettingsGetResultsImpl.java new file mode 100644 index 0000000000000..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/AnalyticalStorageConfiguration.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AnalyticalStorageConfiguration.java new file mode 100644 index 0000000000000..47ed2b1272ac5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AnalyticalStorageConfiguration.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Analytical storage specific properties. */ +@Fluent +public final class AnalyticalStorageConfiguration { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AnalyticalStorageConfiguration.class); + + /* + * Describes the types of schema for analytical storage. + */ + @JsonProperty(value = "schemaType") + private AnalyticalStorageSchemaType schemaType; + + /** + * Get the schemaType property: Describes the types of schema for analytical storage. + * + * @return the schemaType value. + */ + public AnalyticalStorageSchemaType schemaType() { + return this.schemaType; + } + + /** + * Set the schemaType property: Describes the types of schema for analytical storage. + * + * @param schemaType the schemaType value to set. + * @return the AnalyticalStorageConfiguration object itself. + */ + public AnalyticalStorageConfiguration withSchemaType(AnalyticalStorageSchemaType schemaType) { + this.schemaType = schemaType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AnalyticalStorageSchemaType.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AnalyticalStorageSchemaType.java new file mode 100644 index 0000000000000..cc0cd84f4f29b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AnalyticalStorageSchemaType.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AnalyticalStorageSchemaType. */ +public final class AnalyticalStorageSchemaType extends ExpandableStringEnum { + /** Static value WellDefined for AnalyticalStorageSchemaType. */ + public static final AnalyticalStorageSchemaType WELL_DEFINED = fromString("WellDefined"); + + /** Static value FullFidelity for AnalyticalStorageSchemaType. */ + public static final AnalyticalStorageSchemaType FULL_FIDELITY = fromString("FullFidelity"); + + /** + * Creates or finds a AnalyticalStorageSchemaType from its string representation. + * + * @param name a name to look for. + * @return the corresponding AnalyticalStorageSchemaType. + */ + @JsonCreator + public static AnalyticalStorageSchemaType fromString(String name) { + return fromString(name, AnalyticalStorageSchemaType.class); + } + + /** @return known AnalyticalStorageSchemaType values. */ + public static Collection values() { + return values(AnalyticalStorageSchemaType.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ApiProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ApiProperties.java new file mode 100644 index 0000000000000..754bf62b1b0a3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ApiProperties.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ApiProperties model. */ +@Fluent +public final class ApiProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApiProperties.class); + + /* + * Describes the ServerVersion of an a MongoDB account. + */ + @JsonProperty(value = "serverVersion") + private ServerVersion serverVersion; + + /** + * Get the serverVersion property: Describes the ServerVersion of an a MongoDB account. + * + * @return the serverVersion value. + */ + public ServerVersion serverVersion() { + return this.serverVersion; + } + + /** + * Set the serverVersion property: Describes the ServerVersion of an a MongoDB account. + * + * @param serverVersion the serverVersion value to set. + * @return the ApiProperties object itself. + */ + public ApiProperties withServerVersion(ServerVersion serverVersion) { + this.serverVersion = serverVersion; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ApiType.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ApiType.java new file mode 100644 index 0000000000000..e978790d5f66f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ApiType.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ApiType. */ +public final class ApiType extends ExpandableStringEnum { + /** Static value MongoDB for ApiType. */ + public static final ApiType MONGO_DB = fromString("MongoDB"); + + /** Static value Gremlin for ApiType. */ + public static final ApiType GREMLIN = fromString("Gremlin"); + + /** Static value Cassandra for ApiType. */ + public static final ApiType CASSANDRA = fromString("Cassandra"); + + /** Static value Table for ApiType. */ + public static final ApiType TABLE = fromString("Table"); + + /** Static value Sql for ApiType. */ + public static final ApiType SQL = fromString("Sql"); + + /** Static value GremlinV2 for ApiType. */ + public static final ApiType GREMLIN_V2 = fromString("GremlinV2"); + + /** + * Creates or finds a ApiType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ApiType. + */ + @JsonCreator + public static ApiType fromString(String name) { + return fromString(name, ApiType.class); + } + + /** @return known ApiType values. */ + public static Collection values() { + return values(ApiType.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ArmProxyResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ArmProxyResource.java new file mode 100644 index 0000000000000..f5ea0550a4a79 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ArmProxyResource.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** + * The resource model definition for a ARM proxy resource. It will have everything other than required location and + * tags. + */ +@Immutable +public class ArmProxyResource extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ArmProxyResource.class); + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ArmResourceProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ArmResourceProperties.java new file mode 100644 index 0000000000000..d39435b6c01e4 --- /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 com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Map; + +/** The core properties of ARM resources. */ +@Fluent +public class ArmResourceProperties extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ArmResourceProperties.class); + + /** {@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/AutoUpgradePolicyResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AutoUpgradePolicyResource.java new file mode 100644 index 0000000000000..f1a61ffe3254f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AutoUpgradePolicyResource.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB resource auto-upgrade policy. */ +@Fluent +public final class AutoUpgradePolicyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AutoUpgradePolicyResource.class); + + /* + * Represents throughput policy which service must adhere to for + * auto-upgrade + */ + @JsonProperty(value = "throughputPolicy") + private ThroughputPolicyResource throughputPolicy; + + /** + * Get the throughputPolicy property: Represents throughput policy which service must adhere to for auto-upgrade. + * + * @return the throughputPolicy value. + */ + public ThroughputPolicyResource throughputPolicy() { + return this.throughputPolicy; + } + + /** + * Set the throughputPolicy property: Represents throughput policy which service must adhere to for auto-upgrade. + * + * @param throughputPolicy the throughputPolicy value to set. + * @return the AutoUpgradePolicyResource object itself. + */ + public AutoUpgradePolicyResource withThroughputPolicy(ThroughputPolicyResource throughputPolicy) { + this.throughputPolicy = throughputPolicy; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (throughputPolicy() != null) { + throughputPolicy().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AutoscaleSettings.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AutoscaleSettings.java new file mode 100644 index 0000000000000..8f41712681bef --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AutoscaleSettings.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The AutoscaleSettings model. */ +@Fluent +public final class AutoscaleSettings { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AutoscaleSettings.class); + + /* + * Represents maximum throughput, the resource can scale up to. + */ + @JsonProperty(value = "maxThroughput") + private Integer maxThroughput; + + /** + * Get the maxThroughput property: Represents maximum throughput, the resource can scale up to. + * + * @return the maxThroughput value. + */ + public Integer maxThroughput() { + return this.maxThroughput; + } + + /** + * Set the maxThroughput property: Represents maximum throughput, the resource can scale up to. + * + * @param maxThroughput the maxThroughput value to set. + * @return the AutoscaleSettings object itself. + */ + public AutoscaleSettings withMaxThroughput(Integer maxThroughput) { + this.maxThroughput = maxThroughput; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AutoscaleSettingsResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AutoscaleSettingsResource.java new file mode 100644 index 0000000000000..2f194bb7eabef --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AutoscaleSettingsResource.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB provisioned throughput settings object. */ +@Fluent +public final class AutoscaleSettingsResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AutoscaleSettingsResource.class); + + /* + * Represents maximum throughput container can scale up to. + */ + @JsonProperty(value = "maxThroughput", required = true) + private int maxThroughput; + + /* + * Cosmos DB resource auto-upgrade policy + */ + @JsonProperty(value = "autoUpgradePolicy") + private AutoUpgradePolicyResource autoUpgradePolicy; + + /* + * Represents target maximum throughput container can scale up to once + * offer is no longer in pending state. + */ + @JsonProperty(value = "targetMaxThroughput", access = JsonProperty.Access.WRITE_ONLY) + private Integer targetMaxThroughput; + + /** + * Get the maxThroughput property: Represents maximum throughput container can scale up to. + * + * @return the maxThroughput value. + */ + public int maxThroughput() { + return this.maxThroughput; + } + + /** + * Set the maxThroughput property: Represents maximum throughput container can scale up to. + * + * @param maxThroughput the maxThroughput value to set. + * @return the AutoscaleSettingsResource object itself. + */ + public AutoscaleSettingsResource withMaxThroughput(int maxThroughput) { + this.maxThroughput = maxThroughput; + return this; + } + + /** + * Get the autoUpgradePolicy property: Cosmos DB resource auto-upgrade policy. + * + * @return the autoUpgradePolicy value. + */ + public AutoUpgradePolicyResource autoUpgradePolicy() { + return this.autoUpgradePolicy; + } + + /** + * Set the autoUpgradePolicy property: Cosmos DB resource auto-upgrade policy. + * + * @param autoUpgradePolicy the autoUpgradePolicy value to set. + * @return the AutoscaleSettingsResource object itself. + */ + public AutoscaleSettingsResource withAutoUpgradePolicy(AutoUpgradePolicyResource autoUpgradePolicy) { + this.autoUpgradePolicy = autoUpgradePolicy; + return this; + } + + /** + * Get the targetMaxThroughput property: Represents target maximum throughput container can scale up to once offer + * is no longer in pending state. + * + * @return the targetMaxThroughput value. + */ + public Integer targetMaxThroughput() { + return this.targetMaxThroughput; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (autoUpgradePolicy() != null) { + autoUpgradePolicy().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupInformation.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupInformation.java new file mode 100644 index 0000000000000..3010af64800e6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupInformation.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.BackupInformationInner; + +/** An immutable client-side representation of BackupInformation. */ +public interface BackupInformation { + /** + * Gets the continuousBackupInformation property: Information about the status of continuous backups. + * + * @return the continuousBackupInformation value. + */ + ContinuousBackupInformation continuousBackupInformation(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.BackupInformationInner object. + * + * @return the inner object. + */ + BackupInformationInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupPolicy.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupPolicy.java new file mode 100644 index 0000000000000..6ac7d0cc18de9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupPolicy.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The object representing the policy for taking backups on an account. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "type", + defaultImpl = BackupPolicy.class) +@JsonTypeName("BackupPolicy") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "Periodic", value = PeriodicModeBackupPolicy.class), + @JsonSubTypes.Type(name = "Continuous", value = ContinuousModeBackupPolicy.class) +}) +@Fluent +public class BackupPolicy { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BackupPolicy.class); + + /* + * The object representing the state of the migration between the backup + * policies. + */ + @JsonProperty(value = "migrationState") + private BackupPolicyMigrationState migrationState; + + /** + * Get the migrationState property: The object representing the state of the migration between the backup policies. + * + * @return the migrationState value. + */ + public BackupPolicyMigrationState migrationState() { + return this.migrationState; + } + + /** + * Set the migrationState property: The object representing the state of the migration between the backup policies. + * + * @param migrationState the migrationState value to set. + * @return the BackupPolicy object itself. + */ + public BackupPolicy withMigrationState(BackupPolicyMigrationState migrationState) { + this.migrationState = migrationState; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (migrationState() != null) { + migrationState().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupPolicyMigrationState.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupPolicyMigrationState.java new file mode 100644 index 0000000000000..e28b96790558f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupPolicyMigrationState.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The object representing the state of the migration between the backup policies. */ +@Fluent +public final class BackupPolicyMigrationState { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BackupPolicyMigrationState.class); + + /* + * Describes the status of migration between backup policy types. + */ + @JsonProperty(value = "status") + private BackupPolicyMigrationStatus status; + + /* + * Describes the target backup policy type of the backup policy migration. + */ + @JsonProperty(value = "targetType") + private BackupPolicyType targetType; + + /* + * Time at which the backup policy migration started (ISO-8601 format). + */ + @JsonProperty(value = "startTime") + private OffsetDateTime startTime; + + /** + * Get the status property: Describes the status of migration between backup policy types. + * + * @return the status value. + */ + public BackupPolicyMigrationStatus status() { + return this.status; + } + + /** + * Set the status property: Describes the status of migration between backup policy types. + * + * @param status the status value to set. + * @return the BackupPolicyMigrationState object itself. + */ + public BackupPolicyMigrationState withStatus(BackupPolicyMigrationStatus status) { + this.status = status; + return this; + } + + /** + * Get the targetType property: Describes the target backup policy type of the backup policy migration. + * + * @return the targetType value. + */ + public BackupPolicyType targetType() { + return this.targetType; + } + + /** + * Set the targetType property: Describes the target backup policy type of the backup policy migration. + * + * @param targetType the targetType value to set. + * @return the BackupPolicyMigrationState object itself. + */ + public BackupPolicyMigrationState withTargetType(BackupPolicyType targetType) { + this.targetType = targetType; + return this; + } + + /** + * Get the startTime property: Time at which the backup policy migration started (ISO-8601 format). + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime property: Time at which the backup policy migration started (ISO-8601 format). + * + * @param startTime the startTime value to set. + * @return the BackupPolicyMigrationState object itself. + */ + public BackupPolicyMigrationState withStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupPolicyMigrationStatus.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupPolicyMigrationStatus.java new file mode 100644 index 0000000000000..ffcd6bce6dd3e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupPolicyMigrationStatus.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for BackupPolicyMigrationStatus. */ +public final class BackupPolicyMigrationStatus extends ExpandableStringEnum { + /** Static value Invalid for BackupPolicyMigrationStatus. */ + public static final BackupPolicyMigrationStatus INVALID = fromString("Invalid"); + + /** Static value InProgress for BackupPolicyMigrationStatus. */ + public static final BackupPolicyMigrationStatus IN_PROGRESS = fromString("InProgress"); + + /** Static value Completed for BackupPolicyMigrationStatus. */ + public static final BackupPolicyMigrationStatus COMPLETED = fromString("Completed"); + + /** Static value Failed for BackupPolicyMigrationStatus. */ + public static final BackupPolicyMigrationStatus FAILED = fromString("Failed"); + + /** + * Creates or finds a BackupPolicyMigrationStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding BackupPolicyMigrationStatus. + */ + @JsonCreator + public static BackupPolicyMigrationStatus fromString(String name) { + return fromString(name, BackupPolicyMigrationStatus.class); + } + + /** @return known BackupPolicyMigrationStatus values. */ + public static Collection values() { + return values(BackupPolicyMigrationStatus.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupPolicyType.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupPolicyType.java new file mode 100644 index 0000000000000..2fa04a067d702 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupPolicyType.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for BackupPolicyType. */ +public final class BackupPolicyType extends ExpandableStringEnum { + /** Static value Periodic for BackupPolicyType. */ + public static final BackupPolicyType PERIODIC = fromString("Periodic"); + + /** Static value Continuous for BackupPolicyType. */ + public static final BackupPolicyType CONTINUOUS = fromString("Continuous"); + + /** + * Creates or finds a BackupPolicyType from its string representation. + * + * @param name a name to look for. + * @return the corresponding BackupPolicyType. + */ + @JsonCreator + public static BackupPolicyType fromString(String name) { + return fromString(name, BackupPolicyType.class); + } + + /** @return known BackupPolicyType values. */ + public static Collection values() { + return values(BackupPolicyType.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Capability.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Capability.java new file mode 100644 index 0000000000000..325a570bb807d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Capability.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB capability object. */ +@Fluent +public final class Capability { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Capability.class); + + /* + * Name of the Cosmos DB capability. For example, "name": + * "EnableCassandra". Current values also include "EnableTable" and + * "EnableGremlin". + */ + @JsonProperty(value = "name") + private String name; + + /** + * Get the name property: Name of the Cosmos DB capability. For example, "name": "EnableCassandra". Current values + * also include "EnableTable" and "EnableGremlin". + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the Cosmos DB capability. For example, "name": "EnableCassandra". Current values + * also include "EnableTable" and "EnableGremlin". + * + * @param name the name value to set. + * @return the Capability object itself. + */ + public Capability withName(String name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/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..95b91ca72c241 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceCreateUpdateParameters.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Parameters to create and update Cosmos DB Cassandra keyspace. */ +@JsonFlatten +@Fluent +public class CassandraKeyspaceCreateUpdateParameters extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CassandraKeyspaceCreateUpdateParameters.class); + + /* + * The standard JSON format of a Cassandra keyspace + */ + @JsonProperty(value = "properties.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 = "properties.options") + private CreateUpdateOptions options; + + /** + * Get the resource property: The standard JSON format of a Cassandra keyspace. + * + * @return the resource value. + */ + public CassandraKeyspaceResource resource() { + return this.resource; + } + + /** + * Set the resource property: The standard JSON format of a Cassandra keyspace. + * + * @param resource the resource value to set. + * @return the CassandraKeyspaceCreateUpdateParameters object itself. + */ + public CassandraKeyspaceCreateUpdateParameters 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 CassandraKeyspaceCreateUpdateParameters object itself. + */ + public CassandraKeyspaceCreateUpdateParameters withOptions(CreateUpdateOptions options) { + this.options = options; + return this; + } + + /** {@inheritDoc} */ + @Override + public CassandraKeyspaceCreateUpdateParameters withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public CassandraKeyspaceCreateUpdateParameters withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (resource() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property resource in model CassandraKeyspaceCreateUpdateParameters")); + } else { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceGetPropertiesOptions.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceGetPropertiesOptions.java new file mode 100644 index 0000000000000..1d027577cca49 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceGetPropertiesOptions.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** The CassandraKeyspaceGetPropertiesOptions model. */ +@Fluent +public final class CassandraKeyspaceGetPropertiesOptions extends OptionsResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CassandraKeyspaceGetPropertiesOptions.class); + + /** {@inheritDoc} */ + @Override + public CassandraKeyspaceGetPropertiesOptions withThroughput(Integer throughput) { + super.withThroughput(throughput); + return this; + } + + /** {@inheritDoc} */ + @Override + public CassandraKeyspaceGetPropertiesOptions withAutoscaleSettings(AutoscaleSettings autoscaleSettings) { + super.withAutoscaleSettings(autoscaleSettings); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceGetPropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceGetPropertiesResource.java new file mode 100644 index 0000000000000..56411b8277674 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceGetPropertiesResource.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The CassandraKeyspaceGetPropertiesResource model. */ +@Fluent +public final class CassandraKeyspaceGetPropertiesResource extends CassandraKeyspaceResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CassandraKeyspaceGetPropertiesResource.class); + + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the rid property: A system generated property. A unique identifier. + * + * @return the rid value. + */ + public String rid() { + return this.rid; + } + + /** + * Get the ts property: A system generated property that denotes the last updated timestamp of the resource. + * + * @return the ts value. + */ + public Float ts() { + return this.ts; + } + + /** + * Get the etag property: A system generated property representing the resource etag required for optimistic + * concurrency control. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** {@inheritDoc} */ + @Override + public CassandraKeyspaceGetPropertiesResource withId(String id) { + super.withId(id); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceGetResults.java new file mode 100644 index 0000000000000..d02d7e149268d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceGetResults.java @@ -0,0 +1,252 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.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 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..6aad7ec7131d9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.CassandraKeyspaceGetResultsInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the Cassandra keyspaces and their properties. */ +@Immutable +public final class CassandraKeyspaceListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CassandraKeyspaceListResult.class); + + /* + * List of Cassandra keyspaces and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of Cassandra keyspaces and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceResource.java new file mode 100644 index 0000000000000..7365b796dcdbb --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceResource.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB Cassandra keyspace resource object. */ +@Fluent +public class CassandraKeyspaceResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CassandraKeyspaceResource.class); + + /* + * Name of the Cosmos DB Cassandra keyspace + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * Get the id property: Name of the Cosmos DB Cassandra keyspace. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Name of the Cosmos DB Cassandra keyspace. + * + * @param id the id value to set. + * @return the CassandraKeyspaceResource object itself. + */ + public CassandraKeyspaceResource withId(String id) { + this.id = id; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model CassandraKeyspaceResource")); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraPartitionKey.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraPartitionKey.java new file mode 100644 index 0000000000000..608cf94fbf3db --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraPartitionKey.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB Cassandra table partition key. */ +@Fluent +public final class CassandraPartitionKey { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CassandraPartitionKey.class); + + /* + * Name of the Cosmos DB Cassandra table partition key + */ + @JsonProperty(value = "name") + private String name; + + /** + * Get the name property: Name of the Cosmos DB Cassandra table partition key. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the Cosmos DB Cassandra table partition key. + * + * @param name the name value to set. + * @return the CassandraPartitionKey object itself. + */ + public CassandraPartitionKey withName(String name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraResources.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraResources.java new file mode 100644 index 0000000000000..f15237f0b7f15 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraResources.java @@ -0,0 +1,555 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of CassandraResources. */ +public interface CassandraResources { + /** + * Lists the Cassandra keyspaces under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the Cassandra keyspaces and their properties. + */ + PagedIterable listCassandraKeyspaces(String resourceGroupName, String accountName); + + /** + * Lists the Cassandra keyspaces under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the Cassandra keyspaces and their properties. + */ + PagedIterable listCassandraKeyspaces( + String resourceGroupName, String accountName, Context context); + + /** + * Gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. + */ + CassandraKeyspaceGetResults getCassandraKeyspace(String resourceGroupName, String accountName, String keyspaceName); + + /** + * Gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. + */ + Response getCassandraKeyspaceWithResponse( + String resourceGroupName, String accountName, String keyspaceName, Context context); + + /** + * Deletes an existing Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteCassandraKeyspace(String resourceGroupName, String accountName, String keyspaceName); + + /** + * Deletes an existing Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteCassandraKeyspace(String resourceGroupName, String accountName, String keyspaceName, Context context); + + /** + * Gets the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database account with the + * provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database account with the + * provided name. + */ + ThroughputSettingsGetResults getCassandraKeyspaceThroughput( + String resourceGroupName, String accountName, String keyspaceName); + + /** + * Gets the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database account with the + * provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database account with the + * provided name. + */ + Response getCassandraKeyspaceThroughputWithResponse( + String resourceGroupName, String accountName, String keyspaceName, Context context); + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * Keyspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults updateCassandraKeyspaceThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * Keyspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults updateCassandraKeyspaceThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * Migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateCassandraKeyspaceToAutoscale( + String resourceGroupName, String accountName, String keyspaceName); + + /** + * Migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateCassandraKeyspaceToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, Context context); + + /** + * Migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateCassandraKeyspaceToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName); + + /** + * Migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateCassandraKeyspaceToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName, Context context); + + /** + * Lists the Cassandra table under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the Cassandra tables and their properties. + */ + PagedIterable listCassandraTables( + String resourceGroupName, String accountName, String keyspaceName); + + /** + * Lists the Cassandra table under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the Cassandra tables and their properties. + */ + PagedIterable listCassandraTables( + String resourceGroupName, String accountName, String keyspaceName, Context context); + + /** + * Gets the Cassandra table under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra table under an existing Azure Cosmos DB database account. + */ + CassandraTableGetResults getCassandraTable( + String resourceGroupName, String accountName, String keyspaceName, String tableName); + + /** + * Gets the Cassandra table under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra table under an existing Azure Cosmos DB database account. + */ + Response getCassandraTableWithResponse( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context); + + /** + * Deletes an existing Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteCassandraTable(String resourceGroupName, String accountName, String keyspaceName, String tableName); + + /** + * Deletes an existing Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteCassandraTable( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context); + + /** + * Gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the + * provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the + * provided name. + */ + ThroughputSettingsGetResults getCassandraTableThroughput( + String resourceGroupName, String accountName, String keyspaceName, String tableName); + + /** + * Gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the + * provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the + * provided name. + */ + Response getCassandraTableThroughputWithResponse( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context); + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults updateCassandraTableThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults updateCassandraTableThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * Migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateCassandraTableToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, String tableName); + + /** + * Migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateCassandraTableToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context); + + /** + * Migrate an Azure Cosmos DB Cassandra table from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateCassandraTableToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName, String tableName); + + /** + * Migrate an Azure Cosmos DB Cassandra table from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateCassandraTableToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context); + + /** + * Gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. + */ + CassandraKeyspaceGetResults getCassandraKeyspaceById(String id); + + /** + * Gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. + */ + Response getCassandraKeyspaceByIdWithResponse(String id, Context context); + + /** + * Gets the Cassandra table under an existing Azure Cosmos DB database account. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra table under an existing Azure Cosmos DB database account. + */ + CassandraTableGetResults getCassandraTableById(String id); + + /** + * Gets the Cassandra table under an existing Azure Cosmos DB database account. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra table under an existing Azure Cosmos DB database account. + */ + Response getCassandraTableByIdWithResponse(String id, Context context); + + /** + * 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..3e144a9cf971e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraSchema.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Cosmos DB Cassandra table schema. */ +@Fluent +public final class CassandraSchema { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CassandraSchema.class); + + /* + * List of Cassandra table columns. + */ + @JsonProperty(value = "columns") + private List columns; + + /* + * List of partition key. + */ + @JsonProperty(value = "partitionKeys") + private List partitionKeys; + + /* + * List of cluster key. + */ + @JsonProperty(value = "clusterKeys") + private List clusterKeys; + + /** + * Get the columns property: List of Cassandra table columns. + * + * @return the columns value. + */ + public List columns() { + return this.columns; + } + + /** + * Set the columns property: List of Cassandra table columns. + * + * @param columns the columns value to set. + * @return the CassandraSchema object itself. + */ + public CassandraSchema withColumns(List columns) { + this.columns = columns; + return this; + } + + /** + * Get the partitionKeys property: List of partition key. + * + * @return the partitionKeys value. + */ + public List partitionKeys() { + return this.partitionKeys; + } + + /** + * Set the partitionKeys property: List of partition key. + * + * @param partitionKeys the partitionKeys value to set. + * @return the CassandraSchema object itself. + */ + public CassandraSchema withPartitionKeys(List partitionKeys) { + this.partitionKeys = partitionKeys; + return this; + } + + /** + * Get the clusterKeys property: List of cluster key. + * + * @return the clusterKeys value. + */ + public List clusterKeys() { + return this.clusterKeys; + } + + /** + * Set the clusterKeys property: List of cluster key. + * + * @param clusterKeys the clusterKeys value to set. + * @return the CassandraSchema object itself. + */ + public CassandraSchema withClusterKeys(List clusterKeys) { + this.clusterKeys = clusterKeys; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (columns() != null) { + columns().forEach(e -> e.validate()); + } + if (partitionKeys() != null) { + partitionKeys().forEach(e -> e.validate()); + } + if (clusterKeys() != null) { + clusterKeys().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableCreateUpdateParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableCreateUpdateParameters.java new file mode 100644 index 0000000000000..15b8ea33ec9da --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableCreateUpdateParameters.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Parameters to create and update Cosmos DB Cassandra table. */ +@JsonFlatten +@Fluent +public class CassandraTableCreateUpdateParameters extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CassandraTableCreateUpdateParameters.class); + + /* + * The standard JSON format of a Cassandra table + */ + @JsonProperty(value = "properties.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 = "properties.options") + private CreateUpdateOptions options; + + /** + * Get the resource property: The standard JSON format of a Cassandra table. + * + * @return the resource value. + */ + public CassandraTableResource resource() { + return this.resource; + } + + /** + * Set the resource property: The standard JSON format of a Cassandra table. + * + * @param resource the resource value to set. + * @return the CassandraTableCreateUpdateParameters object itself. + */ + public CassandraTableCreateUpdateParameters 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 CassandraTableCreateUpdateParameters object itself. + */ + public CassandraTableCreateUpdateParameters withOptions(CreateUpdateOptions options) { + this.options = options; + return this; + } + + /** {@inheritDoc} */ + @Override + public CassandraTableCreateUpdateParameters withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public CassandraTableCreateUpdateParameters withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (resource() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property resource in model CassandraTableCreateUpdateParameters")); + } else { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableGetPropertiesOptions.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableGetPropertiesOptions.java new file mode 100644 index 0000000000000..2f025d8feaf15 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableGetPropertiesOptions.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** The CassandraTableGetPropertiesOptions model. */ +@Fluent +public final class CassandraTableGetPropertiesOptions extends OptionsResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CassandraTableGetPropertiesOptions.class); + + /** {@inheritDoc} */ + @Override + public CassandraTableGetPropertiesOptions withThroughput(Integer throughput) { + super.withThroughput(throughput); + return this; + } + + /** {@inheritDoc} */ + @Override + public CassandraTableGetPropertiesOptions withAutoscaleSettings(AutoscaleSettings autoscaleSettings) { + super.withAutoscaleSettings(autoscaleSettings); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableGetPropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableGetPropertiesResource.java new file mode 100644 index 0000000000000..e5e3ceaccf838 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableGetPropertiesResource.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The CassandraTableGetPropertiesResource model. */ +@Fluent +public final class CassandraTableGetPropertiesResource extends CassandraTableResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CassandraTableGetPropertiesResource.class); + + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the rid property: A system generated property. A unique identifier. + * + * @return the rid value. + */ + public String rid() { + return this.rid; + } + + /** + * Get the ts property: A system generated property that denotes the last updated timestamp of the resource. + * + * @return the ts value. + */ + public Float ts() { + return this.ts; + } + + /** + * Get the etag property: A system generated property representing the resource etag required for optimistic + * concurrency control. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** {@inheritDoc} */ + @Override + public CassandraTableGetPropertiesResource withId(String id) { + super.withId(id); + return this; + } + + /** {@inheritDoc} */ + @Override + public CassandraTableGetPropertiesResource withDefaultTtl(Integer defaultTtl) { + super.withDefaultTtl(defaultTtl); + return this; + } + + /** {@inheritDoc} */ + @Override + public CassandraTableGetPropertiesResource withSchema(CassandraSchema schema) { + super.withSchema(schema); + return this; + } + + /** {@inheritDoc} */ + @Override + public CassandraTableGetPropertiesResource withAnalyticalStorageTtl(Integer analyticalStorageTtl) { + super.withAnalyticalStorageTtl(analyticalStorageTtl); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableGetResults.java new file mode 100644 index 0000000000000..9c85f4c321428 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableGetResults.java @@ -0,0 +1,254 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.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 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..e8a511198fc08 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.CassandraTableGetResultsInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the Cassandra tables and their properties. */ +@Immutable +public final class CassandraTableListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CassandraTableListResult.class); + + /* + * List of Cassandra tables and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of Cassandra tables and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableResource.java new file mode 100644 index 0000000000000..0343c80906184 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableResource.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB Cassandra table resource object. */ +@Fluent +public class CassandraTableResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CassandraTableResource.class); + + /* + * Name of the Cosmos DB Cassandra table + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * Time to live of the Cosmos DB Cassandra table + */ + @JsonProperty(value = "defaultTtl") + private Integer defaultTtl; + + /* + * Schema of the Cosmos DB Cassandra table + */ + @JsonProperty(value = "schema") + private CassandraSchema schema; + + /* + * Analytical TTL. + */ + @JsonProperty(value = "analyticalStorageTtl") + private Integer analyticalStorageTtl; + + /** + * Get the id property: Name of the Cosmos DB Cassandra table. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Name of the Cosmos DB Cassandra table. + * + * @param id the id value to set. + * @return the CassandraTableResource object itself. + */ + public CassandraTableResource withId(String id) { + this.id = id; + return this; + } + + /** + * Get the defaultTtl property: Time to live of the Cosmos DB Cassandra table. + * + * @return the defaultTtl value. + */ + public Integer defaultTtl() { + return this.defaultTtl; + } + + /** + * Set the defaultTtl property: Time to live of the Cosmos DB Cassandra table. + * + * @param defaultTtl the defaultTtl value to set. + * @return the CassandraTableResource object itself. + */ + public CassandraTableResource withDefaultTtl(Integer defaultTtl) { + this.defaultTtl = defaultTtl; + return this; + } + + /** + * Get the schema property: Schema of the Cosmos DB Cassandra table. + * + * @return the schema value. + */ + public CassandraSchema schema() { + return this.schema; + } + + /** + * Set the schema property: Schema of the Cosmos DB Cassandra table. + * + * @param schema the schema value to set. + * @return the CassandraTableResource object itself. + */ + public CassandraTableResource withSchema(CassandraSchema schema) { + this.schema = schema; + return this; + } + + /** + * Get the analyticalStorageTtl property: Analytical TTL. + * + * @return the analyticalStorageTtl value. + */ + public Integer analyticalStorageTtl() { + return this.analyticalStorageTtl; + } + + /** + * Set the analyticalStorageTtl property: Analytical TTL. + * + * @param analyticalStorageTtl the analyticalStorageTtl value to set. + * @return the CassandraTableResource object itself. + */ + public CassandraTableResource withAnalyticalStorageTtl(Integer analyticalStorageTtl) { + this.analyticalStorageTtl = analyticalStorageTtl; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model CassandraTableResource")); + } + if (schema() != null) { + schema().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClusterKey.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClusterKey.java new file mode 100644 index 0000000000000..f1af8e047a2ae --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClusterKey.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB Cassandra table cluster key. */ +@Fluent +public final class ClusterKey { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ClusterKey.class); + + /* + * Name of the Cosmos DB Cassandra table cluster key + */ + @JsonProperty(value = "name") + private String name; + + /* + * Order of the Cosmos DB Cassandra table cluster key, only support "Asc" + * and "Desc" + */ + @JsonProperty(value = "orderBy") + private String orderBy; + + /** + * Get the name property: Name of the Cosmos DB Cassandra table cluster key. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the Cosmos DB Cassandra table cluster key. + * + * @param name the name value to set. + * @return the ClusterKey object itself. + */ + public ClusterKey withName(String name) { + this.name = name; + return this; + } + + /** + * Get the orderBy property: Order of the Cosmos DB Cassandra table cluster key, only support "Asc" and "Desc". + * + * @return the orderBy value. + */ + public String orderBy() { + return this.orderBy; + } + + /** + * Set the orderBy property: Order of the Cosmos DB Cassandra table cluster key, only support "Asc" and "Desc". + * + * @param orderBy the orderBy value to set. + * @return the ClusterKey object itself. + */ + public ClusterKey withOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CollectionPartitionRegions.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CollectionPartitionRegions.java new file mode 100644 index 0000000000000..5ef43f34fa59a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CollectionPartitionRegions.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of CollectionPartitionRegions. */ +public interface CollectionPartitionRegions { + /** + * Retrieves the metrics determined by the given filter for the given collection and region, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter); + + /** + * Retrieves the metrics determined by the given filter for the given collection and region, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter, + Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CollectionPartitions.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CollectionPartitions.java new file mode 100644 index 0000000000000..c2ced7aa08128 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CollectionPartitions.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of CollectionPartitions. */ +public interface CollectionPartitions { + /** + * Retrieves the metrics determined by the given filter for the given collection, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + PagedIterable listMetrics( + String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter); + + /** + * Retrieves the metrics determined by the given filter for the given collection, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context); + + /** + * Retrieves the usages (most recent storage data) for the given collection, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition level usage request. + */ + PagedIterable listUsages( + String resourceGroupName, String accountName, String databaseRid, String collectionRid); + + /** + * Retrieves the usages (most recent storage data) for the given collection, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition level usage request. + */ + PagedIterable listUsages( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CollectionRegions.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CollectionRegions.java new file mode 100644 index 0000000000000..f7a7f4b69194a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CollectionRegions.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of CollectionRegions. */ +public interface CollectionRegions { + /** + * Retrieves the metrics determined by the given filter for the given database account, collection and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter); + + /** + * Retrieves the metrics determined by the given filter for the given database account, collection and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter, + Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Collections.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Collections.java new file mode 100644 index 0000000000000..a448a505c4b26 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Collections.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Collections. */ +public interface Collections { + /** + * Retrieves the metrics determined by the given filter for the given database account and collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + PagedIterable listMetrics( + String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter); + + /** + * Retrieves the metrics determined by the given filter for the given database account and collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context); + + /** + * Retrieves the usages (most recent storage data) for the given collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + PagedIterable listUsages( + String resourceGroupName, String accountName, String databaseRid, String collectionRid); + + /** + * Retrieves the usages (most recent storage data) for the given collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + PagedIterable listUsages( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context); + + /** + * Retrieves metric definitions for the given collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, String databaseRid, String collectionRid); + + /** + * Retrieves metric definitions for the given collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, String databaseRid, String collectionRid, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Column.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Column.java new file mode 100644 index 0000000000000..400b5b3f66fcd --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Column.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB Cassandra table column. */ +@Fluent +public final class Column { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Column.class); + + /* + * Name of the Cosmos DB Cassandra table column + */ + @JsonProperty(value = "name") + private String name; + + /* + * Type of the Cosmos DB Cassandra table column + */ + @JsonProperty(value = "type") + private String type; + + /** + * Get the name property: Name of the Cosmos DB Cassandra table column. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the Cosmos DB Cassandra table column. + * + * @param name the name value to set. + * @return the Column object itself. + */ + public Column withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: Type of the Cosmos DB Cassandra table column. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: Type of the Cosmos DB Cassandra table column. + * + * @param type the type value to set. + * @return the Column object itself. + */ + public Column withType(String type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CompositePath.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CompositePath.java new file mode 100644 index 0000000000000..dc27767bfb63f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CompositePath.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The CompositePath model. */ +@Fluent +public final class CompositePath { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CompositePath.class); + + /* + * The path for which the indexing behavior applies to. Index paths + * typically start with root and end with wildcard (/path/*) + */ + @JsonProperty(value = "path") + private String path; + + /* + * Sort order for composite paths. + */ + @JsonProperty(value = "order") + private CompositePathSortOrder order; + + /** + * Get the path property: The path for which the indexing behavior applies to. Index paths typically start with root + * and end with wildcard (/path/*). + * + * @return the path value. + */ + public String path() { + return this.path; + } + + /** + * Set the path property: The path for which the indexing behavior applies to. Index paths typically start with root + * and end with wildcard (/path/*). + * + * @param path the path value to set. + * @return the CompositePath object itself. + */ + public CompositePath withPath(String path) { + this.path = path; + return this; + } + + /** + * Get the order property: Sort order for composite paths. + * + * @return the order value. + */ + public CompositePathSortOrder order() { + return this.order; + } + + /** + * Set the order property: Sort order for composite paths. + * + * @param order the order value to set. + * @return the CompositePath object itself. + */ + public CompositePath withOrder(CompositePathSortOrder order) { + this.order = order; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CompositePathSortOrder.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CompositePathSortOrder.java new file mode 100644 index 0000000000000..4f7252bf95a88 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CompositePathSortOrder.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for CompositePathSortOrder. */ +public final class CompositePathSortOrder extends ExpandableStringEnum { + /** Static value ascending for CompositePathSortOrder. */ + public static final CompositePathSortOrder ASCENDING = fromString("ascending"); + + /** Static value descending for CompositePathSortOrder. */ + public static final CompositePathSortOrder DESCENDING = fromString("descending"); + + /** + * Creates or finds a CompositePathSortOrder from its string representation. + * + * @param name a name to look for. + * @return the corresponding CompositePathSortOrder. + */ + @JsonCreator + public static CompositePathSortOrder fromString(String name) { + return fromString(name, CompositePathSortOrder.class); + } + + /** @return known CompositePathSortOrder values. */ + public static Collection values() { + return values(CompositePathSortOrder.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ConflictResolutionMode.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ConflictResolutionMode.java new file mode 100644 index 0000000000000..e958cab4200fd --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ConflictResolutionMode.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ConflictResolutionMode. */ +public final class ConflictResolutionMode extends ExpandableStringEnum { + /** Static value LastWriterWins for ConflictResolutionMode. */ + public static final ConflictResolutionMode LAST_WRITER_WINS = fromString("LastWriterWins"); + + /** Static value Custom for ConflictResolutionMode. */ + public static final ConflictResolutionMode CUSTOM = fromString("Custom"); + + /** + * Creates or finds a ConflictResolutionMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding ConflictResolutionMode. + */ + @JsonCreator + public static ConflictResolutionMode fromString(String name) { + return fromString(name, ConflictResolutionMode.class); + } + + /** @return known ConflictResolutionMode values. */ + public static Collection values() { + return values(ConflictResolutionMode.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ConflictResolutionPolicy.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ConflictResolutionPolicy.java new file mode 100644 index 0000000000000..1b2ca71c84e39 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ConflictResolutionPolicy.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The conflict resolution policy for the container. */ +@Fluent +public final class ConflictResolutionPolicy { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ConflictResolutionPolicy.class); + + /* + * Indicates the conflict resolution mode. + */ + @JsonProperty(value = "mode") + private ConflictResolutionMode mode; + + /* + * The conflict resolution path in the case of LastWriterWins mode. + */ + @JsonProperty(value = "conflictResolutionPath") + private String conflictResolutionPath; + + /* + * The procedure to resolve conflicts in the case of custom mode. + */ + @JsonProperty(value = "conflictResolutionProcedure") + private String conflictResolutionProcedure; + + /** + * Get the mode property: Indicates the conflict resolution mode. + * + * @return the mode value. + */ + public ConflictResolutionMode mode() { + return this.mode; + } + + /** + * Set the mode property: Indicates the conflict resolution mode. + * + * @param mode the mode value to set. + * @return the ConflictResolutionPolicy object itself. + */ + public ConflictResolutionPolicy withMode(ConflictResolutionMode mode) { + this.mode = mode; + return this; + } + + /** + * Get the conflictResolutionPath property: The conflict resolution path in the case of LastWriterWins mode. + * + * @return the conflictResolutionPath value. + */ + public String conflictResolutionPath() { + return this.conflictResolutionPath; + } + + /** + * Set the conflictResolutionPath property: The conflict resolution path in the case of LastWriterWins mode. + * + * @param conflictResolutionPath the conflictResolutionPath value to set. + * @return the ConflictResolutionPolicy object itself. + */ + public ConflictResolutionPolicy withConflictResolutionPath(String conflictResolutionPath) { + this.conflictResolutionPath = conflictResolutionPath; + return this; + } + + /** + * Get the conflictResolutionProcedure property: The procedure to resolve conflicts in the case of custom mode. + * + * @return the conflictResolutionProcedure value. + */ + public String conflictResolutionProcedure() { + return this.conflictResolutionProcedure; + } + + /** + * Set the conflictResolutionProcedure property: The procedure to resolve conflicts in the case of custom mode. + * + * @param conflictResolutionProcedure the conflictResolutionProcedure value to set. + * @return the ConflictResolutionPolicy object itself. + */ + public ConflictResolutionPolicy withConflictResolutionProcedure(String conflictResolutionProcedure) { + this.conflictResolutionProcedure = conflictResolutionProcedure; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ConnectorOffer.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ConnectorOffer.java new file mode 100644 index 0000000000000..11f254b5a0e93 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ConnectorOffer.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ConnectorOffer. */ +public final class ConnectorOffer extends ExpandableStringEnum { + /** Static value Small for ConnectorOffer. */ + public static final ConnectorOffer SMALL = fromString("Small"); + + /** + * Creates or finds a ConnectorOffer from its string representation. + * + * @param name a name to look for. + * @return the corresponding ConnectorOffer. + */ + @JsonCreator + public static ConnectorOffer fromString(String name) { + return fromString(name, ConnectorOffer.class); + } + + /** @return known ConnectorOffer values. */ + public static Collection values() { + return values(ConnectorOffer.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ConsistencyPolicy.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ConsistencyPolicy.java new file mode 100644 index 0000000000000..c55cb0f23b19a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ConsistencyPolicy.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The consistency policy for the Cosmos DB database account. */ +@Fluent +public final class ConsistencyPolicy { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ConsistencyPolicy.class); + + /* + * The default consistency level and configuration settings of the Cosmos + * DB account. + */ + @JsonProperty(value = "defaultConsistencyLevel", required = true) + private DefaultConsistencyLevel defaultConsistencyLevel; + + /* + * When used with the Bounded Staleness consistency level, this value + * represents the number of stale requests tolerated. Accepted range for + * this value is 1 – 2,147,483,647. Required when defaultConsistencyPolicy + * is set to 'BoundedStaleness'. + */ + @JsonProperty(value = "maxStalenessPrefix") + private Long maxStalenessPrefix; + + /* + * When used with the Bounded Staleness consistency level, this value + * represents the time amount of staleness (in seconds) tolerated. Accepted + * range for this value is 5 - 86400. Required when + * defaultConsistencyPolicy is set to 'BoundedStaleness'. + */ + @JsonProperty(value = "maxIntervalInSeconds") + private Integer maxIntervalInSeconds; + + /** + * Get the defaultConsistencyLevel property: The default consistency level and configuration settings of the Cosmos + * DB account. + * + * @return the defaultConsistencyLevel value. + */ + public DefaultConsistencyLevel defaultConsistencyLevel() { + return this.defaultConsistencyLevel; + } + + /** + * Set the defaultConsistencyLevel property: The default consistency level and configuration settings of the Cosmos + * DB account. + * + * @param defaultConsistencyLevel the defaultConsistencyLevel value to set. + * @return the ConsistencyPolicy object itself. + */ + public ConsistencyPolicy withDefaultConsistencyLevel(DefaultConsistencyLevel defaultConsistencyLevel) { + this.defaultConsistencyLevel = defaultConsistencyLevel; + return this; + } + + /** + * Get the maxStalenessPrefix property: When used with the Bounded Staleness consistency level, this value + * represents the number of stale requests tolerated. Accepted range for this value is 1 – 2,147,483,647. Required + * when defaultConsistencyPolicy is set to 'BoundedStaleness'. + * + * @return the maxStalenessPrefix value. + */ + public Long maxStalenessPrefix() { + return this.maxStalenessPrefix; + } + + /** + * Set the maxStalenessPrefix property: When used with the Bounded Staleness consistency level, this value + * represents the number of stale requests tolerated. Accepted range for this value is 1 – 2,147,483,647. Required + * when defaultConsistencyPolicy is set to 'BoundedStaleness'. + * + * @param maxStalenessPrefix the maxStalenessPrefix value to set. + * @return the ConsistencyPolicy object itself. + */ + public ConsistencyPolicy withMaxStalenessPrefix(Long maxStalenessPrefix) { + this.maxStalenessPrefix = maxStalenessPrefix; + return this; + } + + /** + * Get the maxIntervalInSeconds property: When used with the Bounded Staleness consistency level, this value + * represents the time amount of staleness (in seconds) tolerated. Accepted range for this value is 5 - 86400. + * Required when defaultConsistencyPolicy is set to 'BoundedStaleness'. + * + * @return the maxIntervalInSeconds value. + */ + public Integer maxIntervalInSeconds() { + return this.maxIntervalInSeconds; + } + + /** + * Set the maxIntervalInSeconds property: When used with the Bounded Staleness consistency level, this value + * represents the time amount of staleness (in seconds) tolerated. Accepted range for this value is 5 - 86400. + * Required when defaultConsistencyPolicy is set to 'BoundedStaleness'. + * + * @param maxIntervalInSeconds the maxIntervalInSeconds value to set. + * @return the ConsistencyPolicy object itself. + */ + public ConsistencyPolicy withMaxIntervalInSeconds(Integer maxIntervalInSeconds) { + this.maxIntervalInSeconds = maxIntervalInSeconds; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (defaultConsistencyLevel() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property defaultConsistencyLevel in model ConsistencyPolicy")); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ContainerPartitionKey.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ContainerPartitionKey.java new file mode 100644 index 0000000000000..48e374b9f4b98 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ContainerPartitionKey.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The configuration of the partition key to be used for partitioning data into multiple partitions. */ +@Fluent +public final class ContainerPartitionKey { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ContainerPartitionKey.class); + + /* + * List of paths using which data within the container can be partitioned + */ + @JsonProperty(value = "paths") + private List paths; + + /* + * Indicates the kind of algorithm used for partitioning. For MultiHash, + * multiple partition keys (upto three maximum) are supported for container + * create + */ + @JsonProperty(value = "kind") + private PartitionKind kind; + + /* + * Indicates the version of the partition key definition + */ + @JsonProperty(value = "version") + private Integer version; + + /* + * Indicates if the container is using a system generated partition key + */ + @JsonProperty(value = "systemKey", access = JsonProperty.Access.WRITE_ONLY) + private Boolean systemKey; + + /** + * Get the paths property: List of paths using which data within the container can be partitioned. + * + * @return the paths value. + */ + public List paths() { + return this.paths; + } + + /** + * Set the paths property: List of paths using which data within the container can be partitioned. + * + * @param paths the paths value to set. + * @return the ContainerPartitionKey object itself. + */ + public ContainerPartitionKey withPaths(List paths) { + this.paths = paths; + return this; + } + + /** + * Get the kind property: Indicates the kind of algorithm used for partitioning. For MultiHash, multiple partition + * keys (upto three maximum) are supported for container create. + * + * @return the kind value. + */ + public PartitionKind kind() { + return this.kind; + } + + /** + * Set the kind property: Indicates the kind of algorithm used for partitioning. For MultiHash, multiple partition + * keys (upto three maximum) are supported for container create. + * + * @param kind the kind value to set. + * @return the ContainerPartitionKey object itself. + */ + public ContainerPartitionKey withKind(PartitionKind kind) { + this.kind = kind; + return this; + } + + /** + * Get the version property: Indicates the version of the partition key definition. + * + * @return the version value. + */ + public Integer version() { + return this.version; + } + + /** + * Set the version property: Indicates the version of the partition key definition. + * + * @param version the version value to set. + * @return the ContainerPartitionKey object itself. + */ + public ContainerPartitionKey withVersion(Integer version) { + this.version = version; + return this; + } + + /** + * Get the systemKey property: Indicates if the container is using a system generated partition key. + * + * @return the systemKey value. + */ + public Boolean systemKey() { + return this.systemKey; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ContinuousBackupInformation.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ContinuousBackupInformation.java new file mode 100644 index 0000000000000..79c07023c5d1b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ContinuousBackupInformation.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Information about the status of continuous backups. */ +@Fluent +public final class ContinuousBackupInformation { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ContinuousBackupInformation.class); + + /* + * The latest restorable timestamp for a resource. + */ + @JsonProperty(value = "latestRestorableTimestamp") + private String latestRestorableTimestamp; + + /** + * Get the latestRestorableTimestamp property: The latest restorable timestamp for a resource. + * + * @return the latestRestorableTimestamp value. + */ + public String latestRestorableTimestamp() { + return this.latestRestorableTimestamp; + } + + /** + * Set the latestRestorableTimestamp property: The latest restorable timestamp for a resource. + * + * @param latestRestorableTimestamp the latestRestorableTimestamp value to set. + * @return the ContinuousBackupInformation object itself. + */ + public ContinuousBackupInformation withLatestRestorableTimestamp(String latestRestorableTimestamp) { + this.latestRestorableTimestamp = latestRestorableTimestamp; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ContinuousBackupRestoreLocation.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ContinuousBackupRestoreLocation.java new file mode 100644 index 0000000000000..f16348feb6cf0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ContinuousBackupRestoreLocation.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of the regional restorable account. */ +@Fluent +public final class ContinuousBackupRestoreLocation { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ContinuousBackupRestoreLocation.class); + + /* + * The name of the continuous backup restore location. + */ + @JsonProperty(value = "location") + private String location; + + /** + * Get the location property: The name of the continuous backup restore location. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The name of the continuous backup restore location. + * + * @param location the location value to set. + * @return the ContinuousBackupRestoreLocation object itself. + */ + public ContinuousBackupRestoreLocation withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ContinuousModeBackupPolicy.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ContinuousModeBackupPolicy.java new file mode 100644 index 0000000000000..93ce2e5b59ff3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ContinuousModeBackupPolicy.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The object representing continuous mode backup policy. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Continuous") +@Fluent +public final class ContinuousModeBackupPolicy extends BackupPolicy { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ContinuousModeBackupPolicy.class); + + /** {@inheritDoc} */ + @Override + public ContinuousModeBackupPolicy withMigrationState(BackupPolicyMigrationState migrationState) { + super.withMigrationState(migrationState); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CorsPolicy.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CorsPolicy.java new file mode 100644 index 0000000000000..54409b10558d6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CorsPolicy.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The CORS policy for the Cosmos DB database account. */ +@Fluent +public final class CorsPolicy { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CorsPolicy.class); + + /* + * The origin domains that are permitted to make a request against the + * service via CORS. + */ + @JsonProperty(value = "allowedOrigins", required = true) + private String allowedOrigins; + + /* + * The methods (HTTP request verbs) that the origin domain may use for a + * CORS request. + */ + @JsonProperty(value = "allowedMethods") + private String allowedMethods; + + /* + * The request headers that the origin domain may specify on the CORS + * request. + */ + @JsonProperty(value = "allowedHeaders") + private String allowedHeaders; + + /* + * The response headers that may be sent in the response to the CORS + * request and exposed by the browser to the request issuer. + */ + @JsonProperty(value = "exposedHeaders") + private String exposedHeaders; + + /* + * The maximum amount time that a browser should cache the preflight + * OPTIONS request. + */ + @JsonProperty(value = "maxAgeInSeconds") + private Long maxAgeInSeconds; + + /** + * Get the allowedOrigins property: The origin domains that are permitted to make a request against the service via + * CORS. + * + * @return the allowedOrigins value. + */ + public String allowedOrigins() { + return this.allowedOrigins; + } + + /** + * Set the allowedOrigins property: The origin domains that are permitted to make a request against the service via + * CORS. + * + * @param allowedOrigins the allowedOrigins value to set. + * @return the CorsPolicy object itself. + */ + public CorsPolicy withAllowedOrigins(String allowedOrigins) { + this.allowedOrigins = allowedOrigins; + return this; + } + + /** + * Get the allowedMethods property: The methods (HTTP request verbs) that the origin domain may use for a CORS + * request. + * + * @return the allowedMethods value. + */ + public String allowedMethods() { + return this.allowedMethods; + } + + /** + * Set the allowedMethods property: The methods (HTTP request verbs) that the origin domain may use for a CORS + * request. + * + * @param allowedMethods the allowedMethods value to set. + * @return the CorsPolicy object itself. + */ + public CorsPolicy withAllowedMethods(String allowedMethods) { + this.allowedMethods = allowedMethods; + return this; + } + + /** + * Get the allowedHeaders property: The request headers that the origin domain may specify on the CORS request. + * + * @return the allowedHeaders value. + */ + public String allowedHeaders() { + return this.allowedHeaders; + } + + /** + * Set the allowedHeaders property: The request headers that the origin domain may specify on the CORS request. + * + * @param allowedHeaders the allowedHeaders value to set. + * @return the CorsPolicy object itself. + */ + public CorsPolicy withAllowedHeaders(String allowedHeaders) { + this.allowedHeaders = allowedHeaders; + return this; + } + + /** + * Get the exposedHeaders property: The response headers that may be sent in the response to the CORS request and + * exposed by the browser to the request issuer. + * + * @return the exposedHeaders value. + */ + public String exposedHeaders() { + return this.exposedHeaders; + } + + /** + * Set the exposedHeaders property: The response headers that may be sent in the response to the CORS request and + * exposed by the browser to the request issuer. + * + * @param exposedHeaders the exposedHeaders value to set. + * @return the CorsPolicy object itself. + */ + public CorsPolicy withExposedHeaders(String exposedHeaders) { + this.exposedHeaders = exposedHeaders; + return this; + } + + /** + * Get the maxAgeInSeconds property: The maximum amount time that a browser should cache the preflight OPTIONS + * request. + * + * @return the maxAgeInSeconds value. + */ + public Long maxAgeInSeconds() { + return this.maxAgeInSeconds; + } + + /** + * Set the maxAgeInSeconds property: The maximum amount time that a browser should cache the preflight OPTIONS + * request. + * + * @param maxAgeInSeconds the maxAgeInSeconds value to set. + * @return the CorsPolicy object itself. + */ + public CorsPolicy withMaxAgeInSeconds(Long maxAgeInSeconds) { + this.maxAgeInSeconds = maxAgeInSeconds; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (allowedOrigins() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property allowedOrigins in model CorsPolicy")); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CreateMode.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CreateMode.java new file mode 100644 index 0000000000000..59c9362150d62 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CreateMode.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for CreateMode. */ +public final class CreateMode extends ExpandableStringEnum { + /** Static value Default for CreateMode. */ + public static final CreateMode DEFAULT = fromString("Default"); + + /** Static value Restore for CreateMode. */ + public static final CreateMode RESTORE = fromString("Restore"); + + /** + * Creates or finds a CreateMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding CreateMode. + */ + @JsonCreator + public static CreateMode fromString(String name) { + return fromString(name, CreateMode.class); + } + + /** @return known CreateMode values. */ + public static Collection values() { + return values(CreateMode.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CreateUpdateOptions.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CreateUpdateOptions.java new file mode 100644 index 0000000000000..7d0ad0cc2d62b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CreateUpdateOptions.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * CreateUpdateOptions are a list of key-value pairs that describe the resource. Supported keys are "If-Match", + * "If-None-Match", "Session-Token" and "Throughput". + */ +@Fluent +public final class CreateUpdateOptions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CreateUpdateOptions.class); + + /* + * Request Units per second. For example, "throughput": 10000. + */ + @JsonProperty(value = "throughput") + private Integer throughput; + + /* + * Specifies the Autoscale settings. + */ + @JsonProperty(value = "autoscaleSettings") + private AutoscaleSettings autoscaleSettings; + + /** + * Get the throughput property: Request Units per second. For example, "throughput": 10000. + * + * @return the throughput value. + */ + public Integer throughput() { + return this.throughput; + } + + /** + * Set the throughput property: Request Units per second. For example, "throughput": 10000. + * + * @param throughput the throughput value to set. + * @return the CreateUpdateOptions object itself. + */ + public CreateUpdateOptions withThroughput(Integer throughput) { + this.throughput = throughput; + return this; + } + + /** + * Get the autoscaleSettings property: Specifies the Autoscale settings. + * + * @return the autoscaleSettings value. + */ + public AutoscaleSettings autoscaleSettings() { + return this.autoscaleSettings; + } + + /** + * Set the autoscaleSettings property: Specifies the Autoscale settings. + * + * @param autoscaleSettings the autoscaleSettings value to set. + * @return the CreateUpdateOptions object itself. + */ + public CreateUpdateOptions withAutoscaleSettings(AutoscaleSettings autoscaleSettings) { + this.autoscaleSettings = autoscaleSettings; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (autoscaleSettings() != null) { + autoscaleSettings().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DataType.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DataType.java new file mode 100644 index 0000000000000..c279860e047f7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DataType.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DataType. */ +public final class DataType extends ExpandableStringEnum { + /** Static value String for DataType. */ + public static final DataType STRING = fromString("String"); + + /** Static value Number for DataType. */ + public static final DataType NUMBER = fromString("Number"); + + /** Static value Point for DataType. */ + public static final DataType POINT = fromString("Point"); + + /** Static value Polygon for DataType. */ + public static final DataType POLYGON = fromString("Polygon"); + + /** Static value LineString for DataType. */ + public static final DataType LINE_STRING = fromString("LineString"); + + /** Static value MultiPolygon for DataType. */ + public static final DataType MULTI_POLYGON = fromString("MultiPolygon"); + + /** + * Creates or finds a DataType from its string representation. + * + * @param name a name to look for. + * @return the corresponding DataType. + */ + @JsonCreator + public static DataType fromString(String name) { + return fromString(name, DataType.class); + } + + /** @return known DataType values. */ + public static Collection values() { + return values(DataType.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountConnectionString.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountConnectionString.java new file mode 100644 index 0000000000000..214b9ed1dee1e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountConnectionString.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Connection string for the Cosmos DB account. */ +@Immutable +public final class DatabaseAccountConnectionString { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseAccountConnectionString.class); + + /* + * Value of the connection string + */ + @JsonProperty(value = "connectionString", access = JsonProperty.Access.WRITE_ONLY) + private String connectionString; + + /* + * Description of the connection string + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * Get the connectionString property: Value of the connection string. + * + * @return the connectionString value. + */ + public String connectionString() { + return this.connectionString; + } + + /** + * Get the description property: Description of the connection string. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountCreateUpdateParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountCreateUpdateParameters.java new file mode 100644 index 0000000000000..1df3620cb6b2f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountCreateUpdateParameters.java @@ -0,0 +1,850 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// 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.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Parameters to create and update Cosmos DB database accounts. */ +@JsonFlatten +@Fluent +public class DatabaseAccountCreateUpdateParameters extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseAccountCreateUpdateParameters.class); + + /* + * Indicates the type of database account. This can only be set at database + * account creation. + */ + @JsonProperty(value = "kind") + private DatabaseAccountKind kind; + + /* + * Identity for the resource. + */ + @JsonProperty(value = "identity") + private ManagedServiceIdentity identity; + + /* + * The consistency policy for the Cosmos DB account. + */ + @JsonProperty(value = "properties.consistencyPolicy") + private ConsistencyPolicy consistencyPolicy; + + /* + * An array that contains the georeplication locations enabled for the + * Cosmos DB account. + */ + @JsonProperty(value = "properties.locations", required = true) + private List locations; + + /* + * The offer type for the database + */ + @JsonProperty(value = "properties.databaseAccountOfferType", required = true) + private String databaseAccountOfferType; + + /* + * List of IpRules. + */ + @JsonProperty(value = "properties.ipRules") + private List ipRules; + + /* + * Flag to indicate whether to enable/disable Virtual Network ACL rules. + */ + @JsonProperty(value = "properties.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 = "properties.enableAutomaticFailover") + private Boolean enableAutomaticFailover; + + /* + * List of Cosmos DB capabilities for the account + */ + @JsonProperty(value = "properties.capabilities") + private List capabilities; + + /* + * List of Virtual Network ACL rules configured for the Cosmos DB account. + */ + @JsonProperty(value = "properties.virtualNetworkRules") + private List virtualNetworkRules; + + /* + * Enables the account to write in multiple locations + */ + @JsonProperty(value = "properties.enableMultipleWriteLocations") + private Boolean enableMultipleWriteLocations; + + /* + * Enables the cassandra connector on the Cosmos DB C* account + */ + @JsonProperty(value = "properties.enableCassandraConnector") + private Boolean enableCassandraConnector; + + /* + * The cassandra connector offer type for the Cosmos DB database C* + * account. + */ + @JsonProperty(value = "properties.connectorOffer") + private ConnectorOffer connectorOffer; + + /* + * Disable write operations on metadata resources (databases, containers, + * throughput) via account keys + */ + @JsonProperty(value = "properties.disableKeyBasedMetadataWriteAccess") + private Boolean disableKeyBasedMetadataWriteAccess; + + /* + * The URI of the key vault + */ + @JsonProperty(value = "properties.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 = "properties.defaultIdentity") + private String defaultIdentity; + + /* + * Whether requests from Public Network are allowed + */ + @JsonProperty(value = "properties.publicNetworkAccess") + private PublicNetworkAccess publicNetworkAccess; + + /* + * Flag to indicate whether Free Tier is enabled. + */ + @JsonProperty(value = "properties.enableFreeTier") + private Boolean enableFreeTier; + + /* + * API specific properties. Currently, supported only for MongoDB API. + */ + @JsonProperty(value = "properties.apiProperties") + private ApiProperties apiProperties; + + /* + * Flag to indicate whether to enable storage analytics. + */ + @JsonProperty(value = "properties.enableAnalyticalStorage") + private Boolean enableAnalyticalStorage; + + /* + * Analytical storage specific properties. + */ + @JsonProperty(value = "properties.analyticalStorageConfiguration") + private AnalyticalStorageConfiguration analyticalStorageConfiguration; + + /* + * Enum to indicate the mode of account creation. + */ + @JsonProperty(value = "properties.createMode") + private CreateMode createMode; + + /* + * The object representing the policy for taking backups on an account. + */ + @JsonProperty(value = "properties.backupPolicy") + private BackupPolicy backupPolicy; + + /* + * The CORS policy for the Cosmos DB database account. + */ + @JsonProperty(value = "properties.cors") + private List cors; + + /* + * Indicates what services are allowed to bypass firewall checks. + */ + @JsonProperty(value = "properties.networkAclBypass") + private NetworkAclBypass networkAclBypass; + + /* + * An array that contains the Resource Ids for Network Acl Bypass for the + * Cosmos DB account. + */ + @JsonProperty(value = "properties.networkAclBypassResourceIds") + private List networkAclBypassResourceIds; + + /* + * Opt-out of local authentication and ensure only MSI and AAD can be used + * exclusively for authentication. + */ + @JsonProperty(value = "properties.disableLocalAuth") + private Boolean disableLocalAuth; + + /* + * Parameters to indicate the information about the restore. + */ + @JsonProperty(value = "properties.restoreParameters") + private RestoreParameters restoreParameters; + + /** Creates an instance of DatabaseAccountCreateUpdateParameters class. */ + public DatabaseAccountCreateUpdateParameters() { + databaseAccountOfferType = "Standard"; + } + + /** + * 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 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 DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters 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 DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters 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 DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters 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 DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters 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 DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters 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 DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters 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 DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters 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 DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters 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 DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters 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 DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters 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 DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters 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 DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters 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 DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters 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 DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters 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 DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters 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 DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters 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 DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters 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 DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters 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 DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters 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 DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters 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 DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters 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 DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters 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 DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters 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 DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters 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 DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters 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 DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withRestoreParameters(RestoreParameters restoreParameters) { + this.restoreParameters = restoreParameters; + return this; + } + + /** {@inheritDoc} */ + @Override + public DatabaseAccountCreateUpdateParameters withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public DatabaseAccountCreateUpdateParameters withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (identity() != null) { + identity().validate(); + } + if (consistencyPolicy() != null) { + consistencyPolicy().validate(); + } + if (locations() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property locations in model DatabaseAccountCreateUpdateParameters")); + } 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(); + } + } +} 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..27494c7ffa39d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountGetResults.java @@ -0,0 +1,1232 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountGetResultsInner object. + * + * @return the inner object. + */ + DatabaseAccountGetResultsInner innerModel(); + + /** The entirety of the DatabaseAccountGetResults definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithLocations, + DefinitionStages.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 { + /** + * 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); + } + } + /** + * 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 { + /** + * 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); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DatabaseAccountGetResults refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DatabaseAccountGetResults refresh(Context context); + + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a + * write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values + * must be unique for each of the regions in which the database account exists. + * + * @param failoverParameters The new failover policies for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void failoverPriorityChange(FailoverPolicies failoverParameters); + + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a + * write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values + * must be unique for each of the regions in which the database account exists. + * + * @param failoverParameters The new failover policies for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void failoverPriorityChange(FailoverPolicies failoverParameters, Context context); + + /** + * Lists the access keys for the specified Azure Cosmos DB database account. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the access keys for the given database account. + */ + DatabaseAccountListKeysResult listKeys(); + + /** + * Lists the access keys for the specified Azure Cosmos DB database account. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the access keys for the given database account. + */ + Response listKeysWithResponse(Context context); + + /** + * Lists the connection strings for the specified Azure Cosmos DB database account. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connection strings for the given database account. + */ + DatabaseAccountListConnectionStringsResult listConnectionStrings(); + + /** + * Lists the connection strings for the specified Azure Cosmos DB database account. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connection strings for the given database account. + */ + Response listConnectionStringsWithResponse(Context context); + + /** + * Offline the specified region for the specified Azure Cosmos DB database account. + * + * @param regionParameterForOffline Cosmos DB region to offline for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void offlineRegion(RegionForOnlineOffline regionParameterForOffline); + + /** + * Offline the specified region for the specified Azure Cosmos DB database account. + * + * @param regionParameterForOffline Cosmos DB region to offline for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void offlineRegion(RegionForOnlineOffline regionParameterForOffline, Context context); + + /** + * Online the specified region for the specified Azure Cosmos DB database account. + * + * @param regionParameterForOnline Cosmos DB region to online for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void onlineRegion(RegionForOnlineOffline regionParameterForOnline); + + /** + * Online the specified region for the specified Azure Cosmos DB database account. + * + * @param regionParameterForOnline Cosmos DB region to online for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void onlineRegion(RegionForOnlineOffline regionParameterForOnline, Context context); + + /** + * Lists the read-only access keys for the specified Azure Cosmos DB database account. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the read-only access keys for the given database account. + */ + DatabaseAccountListReadOnlyKeysResult listReadOnlyKeys(); + + /** + * Lists the read-only access keys for the specified Azure Cosmos DB database account. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the read-only access keys for the given database account. + */ + Response listReadOnlyKeysWithResponse(Context context); + + /** + * Regenerates an access key for the specified Azure Cosmos DB database account. + * + * @param keyToRegenerate The name of the key to regenerate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void regenerateKey(DatabaseAccountRegenerateKeyParameters keyToRegenerate); + + /** + * Regenerates an access key for the specified Azure Cosmos DB database account. + * + * @param keyToRegenerate The name of the key to regenerate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void regenerateKey(DatabaseAccountRegenerateKeyParameters keyToRegenerate, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountKind.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountKind.java new file mode 100644 index 0000000000000..deeecee5001c5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountKind.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DatabaseAccountKind. */ +public final class DatabaseAccountKind extends ExpandableStringEnum { + /** Static value GlobalDocumentDB for DatabaseAccountKind. */ + public static final DatabaseAccountKind GLOBAL_DOCUMENT_DB = fromString("GlobalDocumentDB"); + + /** Static value MongoDB for DatabaseAccountKind. */ + public static final DatabaseAccountKind MONGO_DB = fromString("MongoDB"); + + /** Static value Parse for DatabaseAccountKind. */ + public static final DatabaseAccountKind PARSE = fromString("Parse"); + + /** + * Creates or finds a DatabaseAccountKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding DatabaseAccountKind. + */ + @JsonCreator + public static DatabaseAccountKind fromString(String name) { + return fromString(name, DatabaseAccountKind.class); + } + + /** @return known DatabaseAccountKind values. */ + public static Collection values() { + return values(DatabaseAccountKind.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountListConnectionStringsResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountListConnectionStringsResult.java new file mode 100644 index 0000000000000..e6e13dcddb379 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountListConnectionStringsResult.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountListConnectionStringsResultInner; +import java.util.List; + +/** An immutable client-side representation of DatabaseAccountListConnectionStringsResult. */ +public interface DatabaseAccountListConnectionStringsResult { + /** + * Gets the connectionStrings property: An array that contains the connection strings for the Cosmos DB account. + * + * @return the connectionStrings value. + */ + List connectionStrings(); + + /** + * Gets the inner + * com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountListConnectionStringsResultInner object. + * + * @return the inner object. + */ + DatabaseAccountListConnectionStringsResultInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountListKeysResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountListKeysResult.java new file mode 100644 index 0000000000000..224abe8747755 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountListKeysResult.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountListKeysResultInner; + +/** An immutable client-side representation of DatabaseAccountListKeysResult. */ +public interface DatabaseAccountListKeysResult { + /** + * Gets the primaryReadonlyMasterKey property: Base 64 encoded value of the primary read-only key. + * + * @return the primaryReadonlyMasterKey value. + */ + String primaryReadonlyMasterKey(); + + /** + * Gets the secondaryReadonlyMasterKey property: Base 64 encoded value of the secondary read-only key. + * + * @return the secondaryReadonlyMasterKey value. + */ + String secondaryReadonlyMasterKey(); + + /** + * Gets the primaryMasterKey property: Base 64 encoded value of the primary read-write key. + * + * @return the primaryMasterKey value. + */ + String primaryMasterKey(); + + /** + * Gets the secondaryMasterKey property: Base 64 encoded value of the secondary read-write key. + * + * @return the secondaryMasterKey value. + */ + String secondaryMasterKey(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountListKeysResultInner + * object. + * + * @return the inner object. + */ + DatabaseAccountListKeysResultInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountListReadOnlyKeysResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountListReadOnlyKeysResult.java new file mode 100644 index 0000000000000..a364359a8c09d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountListReadOnlyKeysResult.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountListReadOnlyKeysResultInner; + +/** An immutable client-side representation of DatabaseAccountListReadOnlyKeysResult. */ +public interface DatabaseAccountListReadOnlyKeysResult { + /** + * Gets the primaryReadonlyMasterKey property: Base 64 encoded value of the primary read-only key. + * + * @return the primaryReadonlyMasterKey value. + */ + String primaryReadonlyMasterKey(); + + /** + * Gets the secondaryReadonlyMasterKey property: Base 64 encoded value of the secondary read-only key. + * + * @return the secondaryReadonlyMasterKey value. + */ + String secondaryReadonlyMasterKey(); + + /** + * Gets the inner + * com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountListReadOnlyKeysResultInner object. + * + * @return the inner object. + */ + DatabaseAccountListReadOnlyKeysResultInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountOfferType.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountOfferType.java new file mode 100644 index 0000000000000..ab49eceb6dcd5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountOfferType.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for DatabaseAccountOfferType. */ +public enum DatabaseAccountOfferType { + /** Enum value Standard. */ + STANDARD("Standard"); + + /** The actual serialized value for a DatabaseAccountOfferType instance. */ + private final String value; + + DatabaseAccountOfferType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a DatabaseAccountOfferType instance. + * + * @param value the serialized value to parse. + * @return the parsed DatabaseAccountOfferType object, or null if unable to parse. + */ + @JsonCreator + public static DatabaseAccountOfferType fromString(String value) { + DatabaseAccountOfferType[] items = DatabaseAccountOfferType.values(); + for (DatabaseAccountOfferType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountRegenerateKeyParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountRegenerateKeyParameters.java new file mode 100644 index 0000000000000..d6a0c08c2af76 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountRegenerateKeyParameters.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Parameters to regenerate the keys within the database account. */ +@Fluent +public final class DatabaseAccountRegenerateKeyParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseAccountRegenerateKeyParameters.class); + + /* + * The access key to regenerate. + */ + @JsonProperty(value = "keyKind", required = true) + private KeyKind keyKind; + + /** + * Get the keyKind property: The access key to regenerate. + * + * @return the keyKind value. + */ + public KeyKind keyKind() { + return this.keyKind; + } + + /** + * Set the keyKind property: The access key to regenerate. + * + * @param keyKind the keyKind value to set. + * @return the DatabaseAccountRegenerateKeyParameters object itself. + */ + public DatabaseAccountRegenerateKeyParameters withKeyKind(KeyKind keyKind) { + this.keyKind = keyKind; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (keyKind() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property keyKind in model DatabaseAccountRegenerateKeyParameters")); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountRegions.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountRegions.java new file mode 100644 index 0000000000000..d9350f1bd6e89 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountRegions.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of DatabaseAccountRegions. */ +public interface DatabaseAccountRegions { + /** + * Retrieves the metrics determined by the given filter for the given database account and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + PagedIterable listMetrics(String resourceGroupName, String accountName, String region, String filter); + + /** + * Retrieves the metrics determined by the given filter for the given database account and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + PagedIterable listMetrics( + String resourceGroupName, String accountName, String region, String filter, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountUpdateParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountUpdateParameters.java new file mode 100644 index 0000000000000..e80f1179531e4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountUpdateParameters.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Parameters for patching Azure Cosmos DB database account properties. */ +@JsonFlatten +@Fluent +public class DatabaseAccountUpdateParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseAccountUpdateParameters.class); + + /* + * Tags are a list of key-value pairs that describe the resource. These + * tags can be used in viewing and grouping this resource (across resource + * groups). A maximum of 15 tags can be provided for a resource. Each tag + * must have a key no greater than 128 characters and value no greater than + * 256 characters. For example, the default experience for a template type + * is set with "defaultExperience": "Cassandra". Current + * "defaultExperience" values also include "Table", "Graph", "DocumentDB", + * and "MongoDB". + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * The location of the resource group to which the resource belongs. + */ + @JsonProperty(value = "location") + private String location; + + /* + * Identity for the resource. + */ + @JsonProperty(value = "identity") + private ManagedServiceIdentity identity; + + /* + * The consistency policy for the Cosmos DB account. + */ + @JsonProperty(value = "properties.consistencyPolicy") + private ConsistencyPolicy consistencyPolicy; + + /* + * An array that contains the georeplication locations enabled for the + * Cosmos DB account. + */ + @JsonProperty(value = "properties.locations") + private List locations; + + /* + * List of IpRules. + */ + @JsonProperty(value = "properties.ipRules") + private List ipRules; + + /* + * Flag to indicate whether to enable/disable Virtual Network ACL rules. + */ + @JsonProperty(value = "properties.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 = "properties.enableAutomaticFailover") + private Boolean enableAutomaticFailover; + + /* + * List of Cosmos DB capabilities for the account + */ + @JsonProperty(value = "properties.capabilities") + private List capabilities; + + /* + * List of Virtual Network ACL rules configured for the Cosmos DB account. + */ + @JsonProperty(value = "properties.virtualNetworkRules") + private List virtualNetworkRules; + + /* + * Enables the account to write in multiple locations + */ + @JsonProperty(value = "properties.enableMultipleWriteLocations") + private Boolean enableMultipleWriteLocations; + + /* + * Enables the cassandra connector on the Cosmos DB C* account + */ + @JsonProperty(value = "properties.enableCassandraConnector") + private Boolean enableCassandraConnector; + + /* + * The cassandra connector offer type for the Cosmos DB database C* + * account. + */ + @JsonProperty(value = "properties.connectorOffer") + private ConnectorOffer connectorOffer; + + /* + * Disable write operations on metadata resources (databases, containers, + * throughput) via account keys + */ + @JsonProperty(value = "properties.disableKeyBasedMetadataWriteAccess") + private Boolean disableKeyBasedMetadataWriteAccess; + + /* + * The URI of the key vault + */ + @JsonProperty(value = "properties.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 = "properties.defaultIdentity") + private String defaultIdentity; + + /* + * Whether requests from Public Network are allowed + */ + @JsonProperty(value = "properties.publicNetworkAccess") + private PublicNetworkAccess publicNetworkAccess; + + /* + * Flag to indicate whether Free Tier is enabled. + */ + @JsonProperty(value = "properties.enableFreeTier") + private Boolean enableFreeTier; + + /* + * API specific properties. Currently, supported only for MongoDB API. + */ + @JsonProperty(value = "properties.apiProperties") + private ApiProperties apiProperties; + + /* + * Flag to indicate whether to enable storage analytics. + */ + @JsonProperty(value = "properties.enableAnalyticalStorage") + private Boolean enableAnalyticalStorage; + + /* + * Analytical storage specific properties. + */ + @JsonProperty(value = "properties.analyticalStorageConfiguration") + private AnalyticalStorageConfiguration analyticalStorageConfiguration; + + /* + * The object representing the policy for taking backups on an account. + */ + @JsonProperty(value = "properties.backupPolicy") + private BackupPolicy backupPolicy; + + /* + * The CORS policy for the Cosmos DB database account. + */ + @JsonProperty(value = "properties.cors") + private List cors; + + /* + * Indicates what services are allowed to bypass firewall checks. + */ + @JsonProperty(value = "properties.networkAclBypass") + private NetworkAclBypass networkAclBypass; + + /* + * An array that contains the Resource Ids for Network Acl Bypass for the + * Cosmos DB account. + */ + @JsonProperty(value = "properties.networkAclBypassResourceIds") + private List networkAclBypassResourceIds; + + /* + * Opt-out of local authentication and ensure only MSI and AAD can be used + * exclusively for authentication. + */ + @JsonProperty(value = "properties.disableLocalAuth") + private Boolean disableLocalAuth; + + /** + * 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 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 DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters 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 DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters 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 DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters 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 DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters 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 DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters 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 DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters 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 DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters 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 DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters 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 DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters 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 DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters 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 DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters 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 DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters 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 DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters 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 DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters 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 DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters 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 DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters 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 DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters 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 DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters 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 DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters 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 DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters 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 DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters 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 DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters 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 DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters withDisableLocalAuth(Boolean disableLocalAuth) { + this.disableLocalAuth = disableLocalAuth; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().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()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccounts.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccounts.java new file mode 100644 index 0000000000000..d7c1d93a09bd3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccounts.java @@ -0,0 +1,484 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of DatabaseAccounts. */ +public interface DatabaseAccounts { + /** + * Retrieves the properties of an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + DatabaseAccountGetResults getByResourceGroup(String resourceGroupName, String accountName); + + /** + * Retrieves the properties of an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String accountName, Context context); + + /** + * Deletes an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String accountName); + + /** + * Deletes an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String accountName, Context context); + + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a + * write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values + * must be unique for each of the regions in which the database account exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param failoverParameters The new failover policies for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void failoverPriorityChange(String resourceGroupName, String accountName, FailoverPolicies failoverParameters); + + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a + * write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values + * must be unique for each of the regions in which the database account exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param failoverParameters The new failover policies for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void failoverPriorityChange( + String resourceGroupName, String accountName, FailoverPolicies failoverParameters, Context context); + + /** + * Lists all the Azure Cosmos DB database accounts available under the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the database accounts and their properties. + */ + PagedIterable list(); + + /** + * Lists all the Azure Cosmos DB database accounts available under the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the database accounts and their properties. + */ + PagedIterable list(Context context); + + /** + * Lists all the Azure Cosmos DB database accounts available under the given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the database accounts and their properties. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all the Azure Cosmos DB database accounts available under the given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the database accounts and their properties. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists the access keys for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the access keys for the given database account. + */ + DatabaseAccountListKeysResult listKeys(String resourceGroupName, String accountName); + + /** + * Lists the access keys for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the access keys for the given database account. + */ + Response listKeysWithResponse( + String resourceGroupName, String accountName, Context context); + + /** + * Lists the connection strings for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connection strings for the given database account. + */ + DatabaseAccountListConnectionStringsResult listConnectionStrings(String resourceGroupName, String accountName); + + /** + * Lists the connection strings for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connection strings for the given database account. + */ + Response listConnectionStringsWithResponse( + String resourceGroupName, String accountName, Context context); + + /** + * Offline the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param regionParameterForOffline Cosmos DB region to offline for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void offlineRegion(String resourceGroupName, String accountName, RegionForOnlineOffline regionParameterForOffline); + + /** + * Offline the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param regionParameterForOffline Cosmos DB region to offline for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void offlineRegion( + String resourceGroupName, + String accountName, + RegionForOnlineOffline regionParameterForOffline, + Context context); + + /** + * Online the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param regionParameterForOnline Cosmos DB region to online for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void onlineRegion(String resourceGroupName, String accountName, RegionForOnlineOffline regionParameterForOnline); + + /** + * Online the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param regionParameterForOnline Cosmos DB region to online for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void onlineRegion( + String resourceGroupName, String accountName, RegionForOnlineOffline regionParameterForOnline, Context context); + + /** + * Lists the read-only access keys for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the read-only access keys for the given database account. + */ + DatabaseAccountListReadOnlyKeysResult getReadOnlyKeys(String resourceGroupName, String accountName); + + /** + * Lists the read-only access keys for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the read-only access keys for the given database account. + */ + Response getReadOnlyKeysWithResponse( + String resourceGroupName, String accountName, Context context); + + /** + * Lists the read-only access keys for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the read-only access keys for the given database account. + */ + DatabaseAccountListReadOnlyKeysResult listReadOnlyKeys(String resourceGroupName, String accountName); + + /** + * Lists the read-only access keys for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the read-only access keys for the given database account. + */ + Response listReadOnlyKeysWithResponse( + String resourceGroupName, String accountName, Context context); + + /** + * Regenerates an access key for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyToRegenerate The name of the key to regenerate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void regenerateKey( + String resourceGroupName, String accountName, DatabaseAccountRegenerateKeyParameters keyToRegenerate); + + /** + * Regenerates an access key for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyToRegenerate The name of the key to regenerate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void regenerateKey( + String resourceGroupName, + String accountName, + DatabaseAccountRegenerateKeyParameters keyToRegenerate, + Context context); + + /** + * Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase + * letters, numbers, and the '-' character, and must be between 3 and 50 characters. + * + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whether resource exists. + */ + boolean checkNameExists(String accountName); + + /** + * Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase + * letters, numbers, and the '-' character, and must be between 3 and 50 characters. + * + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response checkNameExistsWithResponse(String accountName, Context context); + + /** + * Retrieves the metrics determined by the given filter for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + PagedIterable listMetrics(String resourceGroupName, String accountName, String filter); + + /** + * Retrieves the metrics determined by the given filter for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + PagedIterable listMetrics(String resourceGroupName, String accountName, String filter, Context context); + + /** + * Retrieves the usages (most recent data) for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + PagedIterable listUsages(String resourceGroupName, String accountName); + + /** + * Retrieves the usages (most recent data) for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + PagedIterable listUsages(String resourceGroupName, String accountName, String filter, Context context); + + /** + * Retrieves metric definitions for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + PagedIterable listMetricDefinitions(String resourceGroupName, String accountName); + + /** + * Retrieves metric definitions for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, Context context); + + /** + * Retrieves the properties of an existing Azure Cosmos DB database account. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + DatabaseAccountGetResults getById(String id); + + /** + * Retrieves the properties of an existing Azure Cosmos DB database account. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes an existing Azure Cosmos DB database account. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes an existing Azure Cosmos DB database account. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new DatabaseAccountGetResults resource. + * + * @param name resource name. + * @return the first stage of the new DatabaseAccountGetResults definition. + */ + DatabaseAccountGetResults.DefinitionStages.Blank define(String name); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountsListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountsListResult.java new file mode 100644 index 0000000000000..eaf18046d8779 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountsListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountGetResultsInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the database accounts and their properties. */ +@Immutable +public final class DatabaseAccountsListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseAccountsListResult.class); + + /* + * List of database account and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of database account and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseRestoreResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseRestoreResource.java new file mode 100644 index 0000000000000..17bf2d3d28da2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseRestoreResource.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseRestoreResourceInner; +import java.util.List; + +/** An immutable client-side representation of DatabaseRestoreResource. */ +public interface DatabaseRestoreResource { + /** + * Gets the databaseName property: The name of the database available for restore. + * + * @return the databaseName value. + */ + String databaseName(); + + /** + * Gets the collectionNames property: The names of the collections available for restore. + * + * @return the collectionNames value. + */ + List collectionNames(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseRestoreResourceInner object. + * + * @return the inner object. + */ + DatabaseRestoreResourceInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Databases.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Databases.java new file mode 100644 index 0000000000000..8b1498eec6cba --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Databases.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Databases. */ +public interface Databases { + /** + * Retrieves the metrics determined by the given filter for the given database account and database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + PagedIterable listMetrics(String resourceGroupName, String accountName, String databaseRid, String filter); + + /** + * Retrieves the metrics determined by the given filter for the given database account and database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + PagedIterable listMetrics( + String resourceGroupName, String accountName, String databaseRid, String filter, Context context); + + /** + * Retrieves the usages (most recent data) for the given database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + PagedIterable listUsages(String resourceGroupName, String accountName, String databaseRid); + + /** + * Retrieves the usages (most recent data) for the given database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + PagedIterable listUsages( + String resourceGroupName, String accountName, String databaseRid, String filter, Context context); + + /** + * Retrieves metric definitions for the given database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, String databaseRid); + + /** + * Retrieves metric definitions for the given database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, String databaseRid, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DefaultConsistencyLevel.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DefaultConsistencyLevel.java new file mode 100644 index 0000000000000..5833121835c24 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DefaultConsistencyLevel.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for DefaultConsistencyLevel. */ +public enum DefaultConsistencyLevel { + /** Enum value Eventual. */ + EVENTUAL("Eventual"), + + /** Enum value Session. */ + SESSION("Session"), + + /** Enum value BoundedStaleness. */ + BOUNDED_STALENESS("BoundedStaleness"), + + /** Enum value Strong. */ + STRONG("Strong"), + + /** Enum value ConsistentPrefix. */ + CONSISTENT_PREFIX("ConsistentPrefix"); + + /** The actual serialized value for a DefaultConsistencyLevel instance. */ + private final String value; + + DefaultConsistencyLevel(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a DefaultConsistencyLevel instance. + * + * @param value the serialized value to parse. + * @return the parsed DefaultConsistencyLevel object, or null if unable to parse. + */ + @JsonCreator + public static DefaultConsistencyLevel fromString(String value) { + DefaultConsistencyLevel[] items = DefaultConsistencyLevel.values(); + for (DefaultConsistencyLevel item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ExcludedPath.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ExcludedPath.java new file mode 100644 index 0000000000000..d4747945ccf6b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ExcludedPath.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ExcludedPath model. */ +@Fluent +public final class ExcludedPath { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ExcludedPath.class); + + /* + * The path for which the indexing behavior applies to. Index paths + * typically start with root and end with wildcard (/path/*) + */ + @JsonProperty(value = "path") + private String path; + + /** + * Get the path property: The path for which the indexing behavior applies to. Index paths typically start with root + * and end with wildcard (/path/*). + * + * @return the path value. + */ + public String path() { + return this.path; + } + + /** + * Set the path property: The path for which the indexing behavior applies to. Index paths typically start with root + * and end with wildcard (/path/*). + * + * @param path the path value to set. + * @return the ExcludedPath object itself. + */ + public ExcludedPath withPath(String path) { + this.path = path; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ExtendedResourceProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ExtendedResourceProperties.java new file mode 100644 index 0000000000000..409395f8e7084 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ExtendedResourceProperties.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The system generated resource properties associated with SQL databases, SQL containers, Gremlin databases and Gremlin + * graphs. + */ +@Immutable +public class ExtendedResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ExtendedResourceProperties.class); + + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the rid property: A system generated property. A unique identifier. + * + * @return the rid value. + */ + public String rid() { + return this.rid; + } + + /** + * Get the ts property: A system generated property that denotes the last updated timestamp of the resource. + * + * @return the ts value. + */ + public Float ts() { + return this.ts; + } + + /** + * Get the etag property: A system generated property representing the resource etag required for optimistic + * concurrency control. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/FailoverPolicies.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/FailoverPolicies.java new file mode 100644 index 0000000000000..72622c65097cd --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/FailoverPolicies.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list of new failover policies for the failover priority change. */ +@Fluent +public final class FailoverPolicies { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FailoverPolicies.class); + + /* + * List of failover policies. + */ + @JsonProperty(value = "failoverPolicies", required = true) + private List failoverPolicies; + + /** + * Get the failoverPolicies property: List of failover policies. + * + * @return the failoverPolicies value. + */ + public List failoverPolicies() { + return this.failoverPolicies; + } + + /** + * Set the failoverPolicies property: List of failover policies. + * + * @param failoverPolicies the failoverPolicies value to set. + * @return the FailoverPolicies object itself. + */ + public FailoverPolicies withFailoverPolicies(List failoverPolicies) { + this.failoverPolicies = failoverPolicies; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (failoverPolicies() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property failoverPolicies in model FailoverPolicies")); + } else { + failoverPolicies().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/FailoverPolicy.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/FailoverPolicy.java new file mode 100644 index 0000000000000..14b13c012d9ee --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/FailoverPolicy.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The failover policy for a given region of a database account. */ +@Fluent +public final class FailoverPolicy { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FailoverPolicy.class); + + /* + * The unique identifier of the region in which the database account + * replicates to. Example: <accountName>-<locationName>. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The name of the region in which the database account exists. + */ + @JsonProperty(value = "locationName") + private String locationName; + + /* + * The failover priority of the region. A failover priority of 0 indicates + * a write region. The maximum value for a failover priority = (total + * number of regions - 1). Failover priority values must be unique for each + * of the regions in which the database account exists. + */ + @JsonProperty(value = "failoverPriority") + private Integer failoverPriority; + + /** + * Get the id property: The unique identifier of the region in which the database account replicates to. Example: + * &lt;accountName&gt;-&lt;locationName&gt;. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the locationName property: The name of the region in which the database account exists. + * + * @return the locationName value. + */ + public String locationName() { + return this.locationName; + } + + /** + * Set the locationName property: The name of the region in which the database account exists. + * + * @param locationName the locationName value to set. + * @return the FailoverPolicy object itself. + */ + public FailoverPolicy withLocationName(String locationName) { + this.locationName = locationName; + return this; + } + + /** + * Get the failoverPriority property: The failover priority of the region. A failover priority of 0 indicates a + * write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values + * must be unique for each of the regions in which the database account exists. + * + * @return the failoverPriority value. + */ + public Integer failoverPriority() { + return this.failoverPriority; + } + + /** + * Set the failoverPriority property: The failover priority of the region. A failover priority of 0 indicates a + * write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values + * must be unique for each of the regions in which the database account exists. + * + * @param failoverPriority the failoverPriority value to set. + * @return the FailoverPolicy object itself. + */ + public FailoverPolicy withFailoverPriority(Integer failoverPriority) { + this.failoverPriority = failoverPriority; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/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..5936af8823798 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseCreateUpdateParameters.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Parameters to create and update Cosmos DB Gremlin database. */ +@JsonFlatten +@Fluent +public class GremlinDatabaseCreateUpdateParameters extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GremlinDatabaseCreateUpdateParameters.class); + + /* + * The standard JSON format of a Gremlin database + */ + @JsonProperty(value = "properties.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 = "properties.options") + private CreateUpdateOptions options; + + /** + * Get the resource property: The standard JSON format of a Gremlin database. + * + * @return the resource value. + */ + public GremlinDatabaseResource resource() { + return this.resource; + } + + /** + * Set the resource property: The standard JSON format of a Gremlin database. + * + * @param resource the resource value to set. + * @return the GremlinDatabaseCreateUpdateParameters object itself. + */ + public GremlinDatabaseCreateUpdateParameters 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 GremlinDatabaseCreateUpdateParameters object itself. + */ + public GremlinDatabaseCreateUpdateParameters withOptions(CreateUpdateOptions options) { + this.options = options; + return this; + } + + /** {@inheritDoc} */ + @Override + public GremlinDatabaseCreateUpdateParameters withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public GremlinDatabaseCreateUpdateParameters withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (resource() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property resource in model GremlinDatabaseCreateUpdateParameters")); + } else { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseGetPropertiesOptions.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseGetPropertiesOptions.java new file mode 100644 index 0000000000000..b3994f15c3688 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseGetPropertiesOptions.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** The GremlinDatabaseGetPropertiesOptions model. */ +@Fluent +public final class GremlinDatabaseGetPropertiesOptions extends OptionsResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GremlinDatabaseGetPropertiesOptions.class); + + /** {@inheritDoc} */ + @Override + public GremlinDatabaseGetPropertiesOptions withThroughput(Integer throughput) { + super.withThroughput(throughput); + return this; + } + + /** {@inheritDoc} */ + @Override + public GremlinDatabaseGetPropertiesOptions withAutoscaleSettings(AutoscaleSettings autoscaleSettings) { + super.withAutoscaleSettings(autoscaleSettings); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseGetPropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseGetPropertiesResource.java new file mode 100644 index 0000000000000..1c7488b173aa3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseGetPropertiesResource.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The GremlinDatabaseGetPropertiesResource model. */ +@Fluent +public final class GremlinDatabaseGetPropertiesResource extends GremlinDatabaseResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GremlinDatabaseGetPropertiesResource.class); + + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the rid property: A system generated property. A unique identifier. + * + * @return the rid value. + */ + public String rid() { + return this.rid; + } + + /** + * Get the ts property: A system generated property that denotes the last updated timestamp of the resource. + * + * @return the ts value. + */ + public Float ts() { + return this.ts; + } + + /** + * Get the etag property: A system generated property representing the resource etag required for optimistic + * concurrency control. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** {@inheritDoc} */ + @Override + public GremlinDatabaseGetPropertiesResource withId(String id) { + super.withId(id); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseGetResults.java new file mode 100644 index 0000000000000..315c6eead0cb4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseGetResults.java @@ -0,0 +1,252 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.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 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..c98cd6bca1d55 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.GremlinDatabaseGetResultsInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the Gremlin databases and their properties. */ +@Immutable +public final class GremlinDatabaseListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GremlinDatabaseListResult.class); + + /* + * List of Gremlin databases and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of Gremlin databases and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseResource.java new file mode 100644 index 0000000000000..00f603653e03c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseResource.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB Gremlin database resource object. */ +@Fluent +public class GremlinDatabaseResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GremlinDatabaseResource.class); + + /* + * Name of the Cosmos DB Gremlin database + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * Get the id property: Name of the Cosmos DB Gremlin database. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Name of the Cosmos DB Gremlin database. + * + * @param id the id value to set. + * @return the GremlinDatabaseResource object itself. + */ + public GremlinDatabaseResource withId(String id) { + this.id = id; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model GremlinDatabaseResource")); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphCreateUpdateParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphCreateUpdateParameters.java new file mode 100644 index 0000000000000..f99d4b3e49d09 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphCreateUpdateParameters.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Parameters to create and update Cosmos DB Gremlin graph. */ +@JsonFlatten +@Fluent +public class GremlinGraphCreateUpdateParameters extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GremlinGraphCreateUpdateParameters.class); + + /* + * The standard JSON format of a Gremlin graph + */ + @JsonProperty(value = "properties.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 = "properties.options") + private CreateUpdateOptions options; + + /** + * Get the resource property: The standard JSON format of a Gremlin graph. + * + * @return the resource value. + */ + public GremlinGraphResource resource() { + return this.resource; + } + + /** + * Set the resource property: The standard JSON format of a Gremlin graph. + * + * @param resource the resource value to set. + * @return the GremlinGraphCreateUpdateParameters object itself. + */ + public GremlinGraphCreateUpdateParameters 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 GremlinGraphCreateUpdateParameters object itself. + */ + public GremlinGraphCreateUpdateParameters withOptions(CreateUpdateOptions options) { + this.options = options; + return this; + } + + /** {@inheritDoc} */ + @Override + public GremlinGraphCreateUpdateParameters withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public GremlinGraphCreateUpdateParameters withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (resource() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property resource in model GremlinGraphCreateUpdateParameters")); + } else { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphGetPropertiesOptions.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphGetPropertiesOptions.java new file mode 100644 index 0000000000000..5afc35c897655 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphGetPropertiesOptions.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** The GremlinGraphGetPropertiesOptions model. */ +@Fluent +public final class GremlinGraphGetPropertiesOptions extends OptionsResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GremlinGraphGetPropertiesOptions.class); + + /** {@inheritDoc} */ + @Override + public GremlinGraphGetPropertiesOptions withThroughput(Integer throughput) { + super.withThroughput(throughput); + return this; + } + + /** {@inheritDoc} */ + @Override + public GremlinGraphGetPropertiesOptions withAutoscaleSettings(AutoscaleSettings autoscaleSettings) { + super.withAutoscaleSettings(autoscaleSettings); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphGetPropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphGetPropertiesResource.java new file mode 100644 index 0000000000000..22226ddcc6681 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphGetPropertiesResource.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The GremlinGraphGetPropertiesResource model. */ +@Fluent +public final class GremlinGraphGetPropertiesResource extends GremlinGraphResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GremlinGraphGetPropertiesResource.class); + + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the rid property: A system generated property. A unique identifier. + * + * @return the rid value. + */ + public String rid() { + return this.rid; + } + + /** + * Get the ts property: A system generated property that denotes the last updated timestamp of the resource. + * + * @return the ts value. + */ + public Float ts() { + return this.ts; + } + + /** + * Get the etag property: A system generated property representing the resource etag required for optimistic + * concurrency control. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** {@inheritDoc} */ + @Override + public GremlinGraphGetPropertiesResource withId(String id) { + super.withId(id); + return this; + } + + /** {@inheritDoc} */ + @Override + public GremlinGraphGetPropertiesResource withIndexingPolicy(IndexingPolicy indexingPolicy) { + super.withIndexingPolicy(indexingPolicy); + return this; + } + + /** {@inheritDoc} */ + @Override + public GremlinGraphGetPropertiesResource withPartitionKey(ContainerPartitionKey partitionKey) { + super.withPartitionKey(partitionKey); + return this; + } + + /** {@inheritDoc} */ + @Override + public GremlinGraphGetPropertiesResource withDefaultTtl(Integer defaultTtl) { + super.withDefaultTtl(defaultTtl); + return this; + } + + /** {@inheritDoc} */ + @Override + public GremlinGraphGetPropertiesResource withUniqueKeyPolicy(UniqueKeyPolicy uniqueKeyPolicy) { + super.withUniqueKeyPolicy(uniqueKeyPolicy); + return this; + } + + /** {@inheritDoc} */ + @Override + public GremlinGraphGetPropertiesResource withConflictResolutionPolicy( + ConflictResolutionPolicy conflictResolutionPolicy) { + super.withConflictResolutionPolicy(conflictResolutionPolicy); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphGetResults.java new file mode 100644 index 0000000000000..d254bed1584c6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphGetResults.java @@ -0,0 +1,253 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.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 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); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphListResult.java new file mode 100644 index 0000000000000..90fc765ce1d6a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.GremlinGraphGetResultsInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the graphs and their properties. */ +@Immutable +public final class GremlinGraphListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GremlinGraphListResult.class); + + /* + * List of graphs and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of graphs and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphResource.java new file mode 100644 index 0000000000000..b10d826f714c7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphResource.java @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB Gremlin graph resource object. */ +@Fluent +public class GremlinGraphResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GremlinGraphResource.class); + + /* + * Name of the Cosmos DB Gremlin graph + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * The configuration of the indexing policy. By default, the indexing is + * automatic for all document paths within the graph + */ + @JsonProperty(value = "indexingPolicy") + private IndexingPolicy indexingPolicy; + + /* + * The configuration of the partition key to be used for partitioning data + * into multiple partitions + */ + @JsonProperty(value = "partitionKey") + private ContainerPartitionKey partitionKey; + + /* + * Default time to live + */ + @JsonProperty(value = "defaultTtl") + private Integer defaultTtl; + + /* + * The unique key policy configuration for specifying uniqueness + * constraints on documents in the collection in the Azure Cosmos DB + * service. + */ + @JsonProperty(value = "uniqueKeyPolicy") + private UniqueKeyPolicy uniqueKeyPolicy; + + /* + * The conflict resolution policy for the graph. + */ + @JsonProperty(value = "conflictResolutionPolicy") + private ConflictResolutionPolicy conflictResolutionPolicy; + + /** + * Get the id property: Name of the Cosmos DB Gremlin graph. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Name of the Cosmos DB Gremlin graph. + * + * @param id the id value to set. + * @return the GremlinGraphResource object itself. + */ + public GremlinGraphResource withId(String id) { + this.id = id; + return this; + } + + /** + * Get the indexingPolicy property: The configuration of the indexing policy. By default, the indexing is automatic + * for all document paths within the graph. + * + * @return the indexingPolicy value. + */ + public IndexingPolicy indexingPolicy() { + return this.indexingPolicy; + } + + /** + * Set the indexingPolicy property: The configuration of the indexing policy. By default, the indexing is automatic + * for all document paths within the graph. + * + * @param indexingPolicy the indexingPolicy value to set. + * @return the GremlinGraphResource object itself. + */ + public GremlinGraphResource withIndexingPolicy(IndexingPolicy indexingPolicy) { + this.indexingPolicy = indexingPolicy; + return this; + } + + /** + * Get the partitionKey property: The configuration of the partition key to be used for partitioning data into + * multiple partitions. + * + * @return the partitionKey value. + */ + public ContainerPartitionKey partitionKey() { + return this.partitionKey; + } + + /** + * Set the partitionKey property: The configuration of the partition key to be used for partitioning data into + * multiple partitions. + * + * @param partitionKey the partitionKey value to set. + * @return the GremlinGraphResource object itself. + */ + public GremlinGraphResource withPartitionKey(ContainerPartitionKey partitionKey) { + this.partitionKey = partitionKey; + return this; + } + + /** + * Get the defaultTtl property: Default time to live. + * + * @return the defaultTtl value. + */ + public Integer defaultTtl() { + return this.defaultTtl; + } + + /** + * Set the defaultTtl property: Default time to live. + * + * @param defaultTtl the defaultTtl value to set. + * @return the GremlinGraphResource object itself. + */ + public GremlinGraphResource withDefaultTtl(Integer defaultTtl) { + this.defaultTtl = defaultTtl; + return this; + } + + /** + * Get the uniqueKeyPolicy property: The unique key policy configuration for specifying uniqueness constraints on + * documents in the collection in the Azure Cosmos DB service. + * + * @return the uniqueKeyPolicy value. + */ + public UniqueKeyPolicy uniqueKeyPolicy() { + return this.uniqueKeyPolicy; + } + + /** + * Set the uniqueKeyPolicy property: The unique key policy configuration for specifying uniqueness constraints on + * documents in the collection in the Azure Cosmos DB service. + * + * @param uniqueKeyPolicy the uniqueKeyPolicy value to set. + * @return the GremlinGraphResource object itself. + */ + public GremlinGraphResource withUniqueKeyPolicy(UniqueKeyPolicy uniqueKeyPolicy) { + this.uniqueKeyPolicy = uniqueKeyPolicy; + return this; + } + + /** + * Get the conflictResolutionPolicy property: The conflict resolution policy for the graph. + * + * @return the conflictResolutionPolicy value. + */ + public ConflictResolutionPolicy conflictResolutionPolicy() { + return this.conflictResolutionPolicy; + } + + /** + * Set the conflictResolutionPolicy property: The conflict resolution policy for the graph. + * + * @param conflictResolutionPolicy the conflictResolutionPolicy value to set. + * @return the GremlinGraphResource object itself. + */ + public GremlinGraphResource withConflictResolutionPolicy(ConflictResolutionPolicy conflictResolutionPolicy) { + this.conflictResolutionPolicy = conflictResolutionPolicy; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model GremlinGraphResource")); + } + if (indexingPolicy() != null) { + indexingPolicy().validate(); + } + if (partitionKey() != null) { + partitionKey().validate(); + } + if (uniqueKeyPolicy() != null) { + uniqueKeyPolicy().validate(); + } + if (conflictResolutionPolicy() != null) { + conflictResolutionPolicy().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinResources.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinResources.java new file mode 100644 index 0000000000000..4f9bfa7e08a4b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinResources.java @@ -0,0 +1,549 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of GremlinResources. */ +public interface GremlinResources { + /** + * Lists the Gremlin databases under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the Gremlin databases and their properties. + */ + PagedIterable listGremlinDatabases(String resourceGroupName, String accountName); + + /** + * Lists the Gremlin databases under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the Gremlin databases and their properties. + */ + PagedIterable listGremlinDatabases( + String resourceGroupName, String accountName, Context context); + + /** + * Gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. + */ + GremlinDatabaseGetResults getGremlinDatabase(String resourceGroupName, String accountName, String databaseName); + + /** + * Gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. + */ + Response getGremlinDatabaseWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteGremlinDatabase(String resourceGroupName, String accountName, String databaseName); + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteGremlinDatabase(String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Gets the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account with the + * provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account with the + * provided name. + */ + ThroughputSettingsGetResults getGremlinDatabaseThroughput( + String resourceGroupName, String accountName, String databaseName); + + /** + * Gets the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account with the + * provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account with the + * provided name. + */ + Response getGremlinDatabaseThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin + * database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults updateGremlinDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin + * database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults updateGremlinDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * Migrate an Azure Cosmos DB Gremlin database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateGremlinDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName); + + /** + * Migrate an Azure Cosmos DB Gremlin database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateGremlinDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Migrate an Azure Cosmos DB Gremlin database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateGremlinDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName); + + /** + * Migrate an Azure Cosmos DB Gremlin database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateGremlinDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Lists the Gremlin graph under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the graphs and their properties. + */ + PagedIterable listGremlinGraphs( + String resourceGroupName, String accountName, String databaseName); + + /** + * Lists the Gremlin graph under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the graphs and their properties. + */ + PagedIterable listGremlinGraphs( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Gets the Gremlin graph under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin graph under an existing Azure Cosmos DB database account. + */ + GremlinGraphGetResults getGremlinGraph( + String resourceGroupName, String accountName, String databaseName, String graphName); + + /** + * Gets the Gremlin graph under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin graph under an existing Azure Cosmos DB database account. + */ + Response getGremlinGraphWithResponse( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context); + + /** + * Deletes an existing Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteGremlinGraph(String resourceGroupName, String accountName, String databaseName, String graphName); + + /** + * Deletes an existing Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteGremlinGraph( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context); + + /** + * Gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. + */ + ThroughputSettingsGetResults getGremlinGraphThroughput( + String resourceGroupName, String accountName, String databaseName, String graphName); + + /** + * Gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. + */ + Response getGremlinGraphThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context); + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin graph. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults updateGremlinGraphThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin graph. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults updateGremlinGraphThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * Migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateGremlinGraphToAutoscale( + String resourceGroupName, String accountName, String databaseName, String graphName); + + /** + * Migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateGremlinGraphToAutoscale( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context); + + /** + * Migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateGremlinGraphToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String graphName); + + /** + * Migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateGremlinGraphToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context); + + /** + * Gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. + */ + GremlinDatabaseGetResults getGremlinDatabaseById(String id); + + /** + * Gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. + */ + Response getGremlinDatabaseByIdWithResponse(String id, Context context); + + /** + * Gets the Gremlin graph under an existing Azure Cosmos DB database account. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin graph under an existing Azure Cosmos DB database account. + */ + GremlinGraphGetResults getGremlinGraphById(String id); + + /** + * Gets the Gremlin graph under an existing Azure Cosmos DB database account. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin graph under an existing Azure Cosmos DB database account. + */ + Response getGremlinGraphByIdWithResponse(String id, Context context); + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteGremlinDatabaseById(String id); + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteGremlinDatabaseByIdWithResponse(String id, Context context); + + /** + * Deletes an existing Azure Cosmos DB Gremlin graph. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteGremlinGraphById(String id); + + /** + * Deletes an existing Azure Cosmos DB Gremlin graph. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteGremlinGraphByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new GremlinDatabaseGetResults resource. + * + * @param name resource name. + * @return the first stage of the new GremlinDatabaseGetResults definition. + */ + GremlinDatabaseGetResults.DefinitionStages.Blank defineUpdateGremlinDatabase(String name); + + /** + * Begins definition for a new GremlinGraphGetResults resource. + * + * @param name resource name. + * @return the first stage of the new GremlinGraphGetResults definition. + */ + GremlinGraphGetResults.DefinitionStages.Blank defineUpdateGremlinGraph(String name); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/IncludedPath.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/IncludedPath.java new file mode 100644 index 0000000000000..0a1cef49d2714 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/IncludedPath.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The paths that are included in indexing. */ +@Fluent +public final class IncludedPath { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IncludedPath.class); + + /* + * The path for which the indexing behavior applies to. Index paths + * typically start with root and end with wildcard (/path/*) + */ + @JsonProperty(value = "path") + private String path; + + /* + * List of indexes for this path + */ + @JsonProperty(value = "indexes") + private List indexes; + + /** + * Get the path property: The path for which the indexing behavior applies to. Index paths typically start with root + * and end with wildcard (/path/*). + * + * @return the path value. + */ + public String path() { + return this.path; + } + + /** + * Set the path property: The path for which the indexing behavior applies to. Index paths typically start with root + * and end with wildcard (/path/*). + * + * @param path the path value to set. + * @return the IncludedPath object itself. + */ + public IncludedPath withPath(String path) { + this.path = path; + return this; + } + + /** + * Get the indexes property: List of indexes for this path. + * + * @return the indexes value. + */ + public List indexes() { + return this.indexes; + } + + /** + * Set the indexes property: List of indexes for this path. + * + * @param indexes the indexes value to set. + * @return the IncludedPath object itself. + */ + public IncludedPath withIndexes(List indexes) { + this.indexes = indexes; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (indexes() != null) { + indexes().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/IndexKind.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/IndexKind.java new file mode 100644 index 0000000000000..1afa6d536ed9b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/IndexKind.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for IndexKind. */ +public final class IndexKind extends ExpandableStringEnum { + /** Static value Hash for IndexKind. */ + public static final IndexKind HASH = fromString("Hash"); + + /** Static value Range for IndexKind. */ + public static final IndexKind RANGE = fromString("Range"); + + /** Static value Spatial for IndexKind. */ + public static final IndexKind SPATIAL = fromString("Spatial"); + + /** + * Creates or finds a IndexKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding IndexKind. + */ + @JsonCreator + public static IndexKind fromString(String name) { + return fromString(name, IndexKind.class); + } + + /** @return known IndexKind values. */ + public static Collection values() { + return values(IndexKind.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Indexes.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Indexes.java new file mode 100644 index 0000000000000..ab9487fb08798 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Indexes.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The indexes for the path. */ +@Fluent +public final class Indexes { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Indexes.class); + + /* + * The datatype for which the indexing behavior is applied to. + */ + @JsonProperty(value = "dataType") + private DataType dataType; + + /* + * The precision of the index. -1 is maximum precision. + */ + @JsonProperty(value = "precision") + private Integer precision; + + /* + * Indicates the type of index. + */ + @JsonProperty(value = "kind") + private IndexKind kind; + + /** + * Get the dataType property: The datatype for which the indexing behavior is applied to. + * + * @return the dataType value. + */ + public DataType dataType() { + return this.dataType; + } + + /** + * Set the dataType property: The datatype for which the indexing behavior is applied to. + * + * @param dataType the dataType value to set. + * @return the Indexes object itself. + */ + public Indexes withDataType(DataType dataType) { + this.dataType = dataType; + return this; + } + + /** + * Get the precision property: The precision of the index. -1 is maximum precision. + * + * @return the precision value. + */ + public Integer precision() { + return this.precision; + } + + /** + * Set the precision property: The precision of the index. -1 is maximum precision. + * + * @param precision the precision value to set. + * @return the Indexes object itself. + */ + public Indexes withPrecision(Integer precision) { + this.precision = precision; + return this; + } + + /** + * Get the kind property: Indicates the type of index. + * + * @return the kind value. + */ + public IndexKind kind() { + return this.kind; + } + + /** + * Set the kind property: Indicates the type of index. + * + * @param kind the kind value to set. + * @return the Indexes object itself. + */ + public Indexes withKind(IndexKind kind) { + this.kind = kind; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/IndexingMode.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/IndexingMode.java new file mode 100644 index 0000000000000..d44c1e8411b82 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/IndexingMode.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for IndexingMode. */ +public final class IndexingMode extends ExpandableStringEnum { + /** Static value consistent for IndexingMode. */ + public static final IndexingMode CONSISTENT = fromString("consistent"); + + /** Static value lazy for IndexingMode. */ + public static final IndexingMode LAZY = fromString("lazy"); + + /** Static value none for IndexingMode. */ + public static final IndexingMode NONE = fromString("none"); + + /** + * Creates or finds a IndexingMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding IndexingMode. + */ + @JsonCreator + public static IndexingMode fromString(String name) { + return fromString(name, IndexingMode.class); + } + + /** @return known IndexingMode values. */ + public static Collection values() { + return values(IndexingMode.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/IndexingPolicy.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/IndexingPolicy.java new file mode 100644 index 0000000000000..b624e9483ac87 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/IndexingPolicy.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Cosmos DB indexing policy. */ +@Fluent +public final class IndexingPolicy { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IndexingPolicy.class); + + /* + * Indicates if the indexing policy is automatic + */ + @JsonProperty(value = "automatic") + private Boolean automatic; + + /* + * Indicates the indexing mode. + */ + @JsonProperty(value = "indexingMode") + private IndexingMode indexingMode; + + /* + * List of paths to include in the indexing + */ + @JsonProperty(value = "includedPaths") + private List includedPaths; + + /* + * List of paths to exclude from indexing + */ + @JsonProperty(value = "excludedPaths") + private List excludedPaths; + + /* + * List of composite path list + */ + @JsonProperty(value = "compositeIndexes") + private List> compositeIndexes; + + /* + * List of spatial specifics + */ + @JsonProperty(value = "spatialIndexes") + private List spatialIndexes; + + /** + * Get the automatic property: Indicates if the indexing policy is automatic. + * + * @return the automatic value. + */ + public Boolean automatic() { + return this.automatic; + } + + /** + * Set the automatic property: Indicates if the indexing policy is automatic. + * + * @param automatic the automatic value to set. + * @return the IndexingPolicy object itself. + */ + public IndexingPolicy withAutomatic(Boolean automatic) { + this.automatic = automatic; + return this; + } + + /** + * Get the indexingMode property: Indicates the indexing mode. + * + * @return the indexingMode value. + */ + public IndexingMode indexingMode() { + return this.indexingMode; + } + + /** + * Set the indexingMode property: Indicates the indexing mode. + * + * @param indexingMode the indexingMode value to set. + * @return the IndexingPolicy object itself. + */ + public IndexingPolicy withIndexingMode(IndexingMode indexingMode) { + this.indexingMode = indexingMode; + return this; + } + + /** + * Get the includedPaths property: List of paths to include in the indexing. + * + * @return the includedPaths value. + */ + public List includedPaths() { + return this.includedPaths; + } + + /** + * Set the includedPaths property: List of paths to include in the indexing. + * + * @param includedPaths the includedPaths value to set. + * @return the IndexingPolicy object itself. + */ + public IndexingPolicy withIncludedPaths(List includedPaths) { + this.includedPaths = includedPaths; + return this; + } + + /** + * Get the excludedPaths property: List of paths to exclude from indexing. + * + * @return the excludedPaths value. + */ + public List excludedPaths() { + return this.excludedPaths; + } + + /** + * Set the excludedPaths property: List of paths to exclude from indexing. + * + * @param excludedPaths the excludedPaths value to set. + * @return the IndexingPolicy object itself. + */ + public IndexingPolicy withExcludedPaths(List excludedPaths) { + this.excludedPaths = excludedPaths; + return this; + } + + /** + * Get the compositeIndexes property: List of composite path list. + * + * @return the compositeIndexes value. + */ + public List> compositeIndexes() { + return this.compositeIndexes; + } + + /** + * Set the compositeIndexes property: List of composite path list. + * + * @param compositeIndexes the compositeIndexes value to set. + * @return the IndexingPolicy object itself. + */ + public IndexingPolicy withCompositeIndexes(List> compositeIndexes) { + this.compositeIndexes = compositeIndexes; + return this; + } + + /** + * Get the spatialIndexes property: List of spatial specifics. + * + * @return the spatialIndexes value. + */ + public List spatialIndexes() { + return this.spatialIndexes; + } + + /** + * Set the spatialIndexes property: List of spatial specifics. + * + * @param spatialIndexes the spatialIndexes value to set. + * @return the IndexingPolicy object itself. + */ + public IndexingPolicy withSpatialIndexes(List spatialIndexes) { + this.spatialIndexes = spatialIndexes; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (includedPaths() != null) { + includedPaths().forEach(e -> e.validate()); + } + if (excludedPaths() != null) { + excludedPaths().forEach(e -> e.validate()); + } + if (compositeIndexes() != null) { + compositeIndexes().forEach(e -> e.forEach(e1 -> e1.validate())); + } + if (spatialIndexes() != null) { + spatialIndexes().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/IpAddressOrRange.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/IpAddressOrRange.java new file mode 100644 index 0000000000000..a198c40250068 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/IpAddressOrRange.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** IpAddressOrRange object. */ +@Fluent +public final class IpAddressOrRange { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IpAddressOrRange.class); + + /* + * A single IPv4 address or a single IPv4 address range in CIDR format. + * Provided IPs must be well-formatted and cannot be contained in one of + * the following ranges: 10.0.0.0/8, 100.64.0.0/10, 172.16.0.0/12, + * 192.168.0.0/16, since these are not enforceable by the IP address + * filter. Example of valid inputs: “23.40.210.245” or “23.40.210.0/8”. + */ + @JsonProperty(value = "ipAddressOrRange") + private String ipAddressOrRange; + + /** + * Get the ipAddressOrRange property: A single IPv4 address or a single IPv4 address range in CIDR format. Provided + * IPs must be well-formatted and cannot be contained in one of the following ranges: 10.0.0.0/8, 100.64.0.0/10, + * 172.16.0.0/12, 192.168.0.0/16, since these are not enforceable by the IP address filter. Example of valid inputs: + * “23.40.210.245” or “23.40.210.0/8”. + * + * @return the ipAddressOrRange value. + */ + public String ipAddressOrRange() { + return this.ipAddressOrRange; + } + + /** + * Set the ipAddressOrRange property: A single IPv4 address or a single IPv4 address range in CIDR format. Provided + * IPs must be well-formatted and cannot be contained in one of the following ranges: 10.0.0.0/8, 100.64.0.0/10, + * 172.16.0.0/12, 192.168.0.0/16, since these are not enforceable by the IP address filter. Example of valid inputs: + * “23.40.210.245” or “23.40.210.0/8”. + * + * @param ipAddressOrRange the ipAddressOrRange value to set. + * @return the IpAddressOrRange object itself. + */ + public IpAddressOrRange withIpAddressOrRange(String ipAddressOrRange) { + this.ipAddressOrRange = ipAddressOrRange; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/KeyKind.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/KeyKind.java new file mode 100644 index 0000000000000..a87dfaf433756 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/KeyKind.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for KeyKind. */ +public final class KeyKind extends ExpandableStringEnum { + /** Static value primary for KeyKind. */ + public static final KeyKind PRIMARY = fromString("primary"); + + /** Static value secondary for KeyKind. */ + public static final KeyKind SECONDARY = fromString("secondary"); + + /** Static value primaryReadonly for KeyKind. */ + public static final KeyKind PRIMARY_READONLY = fromString("primaryReadonly"); + + /** Static value secondaryReadonly for KeyKind. */ + public static final KeyKind SECONDARY_READONLY = fromString("secondaryReadonly"); + + /** + * Creates or finds a KeyKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding KeyKind. + */ + @JsonCreator + public static KeyKind fromString(String name) { + return fromString(name, KeyKind.class); + } + + /** @return known KeyKind values. */ + public static Collection values() { + return values(KeyKind.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Location.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Location.java new file mode 100644 index 0000000000000..03c9c6ee9a99a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Location.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A region in which the Azure Cosmos DB database account is deployed. */ +@Fluent +public final class Location { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Location.class); + + /* + * The unique identifier of the region within the database account. + * Example: <accountName>-<locationName>. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The name of the region. + */ + @JsonProperty(value = "locationName") + private String locationName; + + /* + * The connection endpoint for the specific region. Example: + * https://<accountName>-<locationName>.documents.azure.com:443/ + */ + @JsonProperty(value = "documentEndpoint", access = JsonProperty.Access.WRITE_ONLY) + private String documentEndpoint; + + /* + * The status of the Cosmos DB account at the time the operation was + * called. The status can be one of following. 'Creating' – the Cosmos DB + * account is being created. When an account is in Creating state, only + * properties that are specified as input for the Create Cosmos DB account + * operation are returned. 'Succeeded' – the Cosmos DB account is active + * for use. 'Updating' – the Cosmos DB account is being updated. 'Deleting' + * – the Cosmos DB account is being deleted. 'Failed' – the Cosmos DB + * account failed creation. 'DeletionFailed' – the Cosmos DB account + * deletion failed. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The failover priority of the region. A failover priority of 0 indicates + * a write region. The maximum value for a failover priority = (total + * number of regions - 1). Failover priority values must be unique for each + * of the regions in which the database account exists. + */ + @JsonProperty(value = "failoverPriority") + private Integer failoverPriority; + + /* + * Flag to indicate whether or not this region is an AvailabilityZone + * region + */ + @JsonProperty(value = "isZoneRedundant") + private Boolean isZoneRedundant; + + /** + * Get the id property: The unique identifier of the region within the database account. Example: + * &lt;accountName&gt;-&lt;locationName&gt;. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the locationName property: The name of the region. + * + * @return the locationName value. + */ + public String locationName() { + return this.locationName; + } + + /** + * Set the locationName property: The name of the region. + * + * @param locationName the locationName value to set. + * @return the Location object itself. + */ + public Location withLocationName(String locationName) { + this.locationName = locationName; + return this; + } + + /** + * Get the documentEndpoint property: The connection endpoint for the specific region. Example: + * https://&lt;accountName&gt;-&lt;locationName&gt;.documents.azure.com:443/. + * + * @return the documentEndpoint value. + */ + public String documentEndpoint() { + return this.documentEndpoint; + } + + /** + * Get the provisioningState property: The status of the Cosmos DB account at the time the operation was called. The + * status can be one of following. 'Creating' – the Cosmos DB account is being created. When an account is in + * Creating state, only properties that are specified as input for the Create Cosmos DB account operation are + * returned. 'Succeeded' – the Cosmos DB account is active for use. 'Updating' – the Cosmos DB account is being + * updated. 'Deleting' – the Cosmos DB account is being deleted. 'Failed' – the Cosmos DB account failed creation. + * 'DeletionFailed' – the Cosmos DB account deletion failed. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the failoverPriority property: The failover priority of the region. A failover priority of 0 indicates a + * write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values + * must be unique for each of the regions in which the database account exists. + * + * @return the failoverPriority value. + */ + public Integer failoverPriority() { + return this.failoverPriority; + } + + /** + * Set the failoverPriority property: The failover priority of the region. A failover priority of 0 indicates a + * write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values + * must be unique for each of the regions in which the database account exists. + * + * @param failoverPriority the failoverPriority value to set. + * @return the Location object itself. + */ + public Location withFailoverPriority(Integer failoverPriority) { + this.failoverPriority = failoverPriority; + return this; + } + + /** + * Get the isZoneRedundant property: Flag to indicate whether or not this region is an AvailabilityZone region. + * + * @return the isZoneRedundant value. + */ + public Boolean isZoneRedundant() { + return this.isZoneRedundant; + } + + /** + * Set the isZoneRedundant property: Flag to indicate whether or not this region is an AvailabilityZone region. + * + * @param isZoneRedundant the isZoneRedundant value to set. + * @return the Location object itself. + */ + public Location withIsZoneRedundant(Boolean isZoneRedundant) { + this.isZoneRedundant = isZoneRedundant; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ManagedServiceIdentity.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ManagedServiceIdentity.java new file mode 100644 index 0000000000000..0b50ab420d018 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ManagedServiceIdentity.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Identity for the resource. */ +@Fluent +public class ManagedServiceIdentity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedServiceIdentity.class); + + /* + * The principal id of the system assigned identity. This property will + * only be provided for a system assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * The tenant id of the system assigned identity. This property will only + * be provided for a system assigned identity. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /* + * The type of identity used for the resource. The type + * 'SystemAssigned,UserAssigned' includes both an implicitly created + * identity and a set of user assigned identities. The type 'None' will + * remove any identities from the service. + */ + @JsonProperty(value = "type") + private ResourceIdentityType type; + + /* + * The list of user identities associated with resource. The user identity + * dictionary key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + */ + @JsonProperty(value = "userAssignedIdentities") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map userAssignedIdentities; + + /** + * Get the principalId property: The principal id of the system assigned identity. This property will only be + * provided for a system assigned identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant id of the system assigned identity. This property will only be provided for + * a system assigned identity. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the type property: The type of identity used for the resource. The type 'SystemAssigned,UserAssigned' + * includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove + * any identities from the service. + * + * @return the type value. + */ + public ResourceIdentityType type() { + return this.type; + } + + /** + * Set the type property: The type of identity used for the resource. The type 'SystemAssigned,UserAssigned' + * includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove + * any identities from the service. + * + * @param type the type value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withType(ResourceIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the userAssignedIdentities property: The list of user identities associated with resource. The user identity + * dictionary key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The list of user identities associated with resource. The user identity + * dictionary key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withUserAssignedIdentities( + Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (userAssignedIdentities() != null) { + userAssignedIdentities() + .values() + .forEach( + e -> { + if (e != null) { + e.validate(); + } + }); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ManagedServiceIdentityUserAssignedIdentities.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ManagedServiceIdentityUserAssignedIdentities.java new file mode 100644 index 0000000000000..2ce1e876565be --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ManagedServiceIdentityUserAssignedIdentities.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ManagedServiceIdentityUserAssignedIdentities model. */ +@Immutable +public final class ManagedServiceIdentityUserAssignedIdentities { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(ManagedServiceIdentityUserAssignedIdentities.class); + + /* + * The principal id of user assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * The client id of user assigned identity. + */ + @JsonProperty(value = "clientId", access = JsonProperty.Access.WRITE_ONLY) + private String clientId; + + /** + * Get the principalId property: The principal id of user assigned identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the clientId property: The client id of user assigned identity. + * + * @return the clientId value. + */ + public String clientId() { + return this.clientId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Metric.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Metric.java new file mode 100644 index 0000000000000..8720c9fe2f2b8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Metric.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of Metric. */ +public interface Metric { + /** + * Gets the startTime property: The start time for the metric (ISO-8601 format). + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the endTime property: The end time for the metric (ISO-8601 format). + * + * @return the endTime value. + */ + OffsetDateTime endTime(); + + /** + * Gets the timeGrain property: The time grain to be used to summarize the metric values. + * + * @return the timeGrain value. + */ + String timeGrain(); + + /** + * Gets the unit property: The unit of the metric. + * + * @return the unit value. + */ + UnitType unit(); + + /** + * Gets the name property: The name information for the metric. + * + * @return the name value. + */ + MetricName name(); + + /** + * Gets the metricValues property: The metric values for the specified time window and timestep. + * + * @return the metricValues value. + */ + List metricValues(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.MetricInner object. + * + * @return the inner object. + */ + MetricInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricAvailability.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricAvailability.java new file mode 100644 index 0000000000000..457e3d6ac36e4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricAvailability.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The availability of the metric. */ +@Immutable +public final class MetricAvailability { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricAvailability.class); + + /* + * The time grain to be used to summarize the metric values. + */ + @JsonProperty(value = "timeGrain", access = JsonProperty.Access.WRITE_ONLY) + private String timeGrain; + + /* + * The retention for the metric values. + */ + @JsonProperty(value = "retention", access = JsonProperty.Access.WRITE_ONLY) + private String retention; + + /** + * Get the timeGrain property: The time grain to be used to summarize the metric values. + * + * @return the timeGrain value. + */ + public String timeGrain() { + return this.timeGrain; + } + + /** + * Get the retention property: The retention for the metric values. + * + * @return the retention value. + */ + public String retention() { + return this.retention; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricDefinition.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricDefinition.java new file mode 100644 index 0000000000000..4ca7c84770599 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricDefinition.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricDefinitionInner; +import java.util.List; + +/** An immutable client-side representation of MetricDefinition. */ +public interface MetricDefinition { + /** + * Gets the metricAvailabilities property: The list of metric availabilities for the account. + * + * @return the metricAvailabilities value. + */ + List metricAvailabilities(); + + /** + * Gets the primaryAggregationType property: The primary aggregation type of the metric. + * + * @return the primaryAggregationType value. + */ + PrimaryAggregationType primaryAggregationType(); + + /** + * Gets the unit property: The unit of the metric. + * + * @return the unit value. + */ + UnitType unit(); + + /** + * Gets the resourceUri property: The resource uri of the database. + * + * @return the resourceUri value. + */ + String resourceUri(); + + /** + * Gets the name property: The name information for the metric. + * + * @return the name value. + */ + MetricName name(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.MetricDefinitionInner object. + * + * @return the inner object. + */ + MetricDefinitionInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricDefinitionsListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricDefinitionsListResult.java new file mode 100644 index 0000000000000..493f009fb5ce4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricDefinitionsListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricDefinitionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list metric definitions request. */ +@Immutable +public final class MetricDefinitionsListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricDefinitionsListResult.class); + + /* + * The list of metric definitions for the account. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: The list of metric definitions for the account. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricListResult.java new file mode 100644 index 0000000000000..6162dabcc0995 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list metrics request. */ +@Immutable +public final class MetricListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricListResult.class); + + /* + * The list of metrics for the account. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: The list of metrics for the account. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricName.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricName.java new file mode 100644 index 0000000000000..42a6ff98e7086 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricName.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A metric name. */ +@Immutable +public final class MetricName { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricName.class); + + /* + * The name of the metric. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private String value; + + /* + * The friendly name of the metric. + */ + @JsonProperty(value = "localizedValue", access = JsonProperty.Access.WRITE_ONLY) + private String localizedValue; + + /** + * Get the value property: The name of the metric. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Get the localizedValue property: The friendly name of the metric. + * + * @return the localizedValue value. + */ + public String localizedValue() { + return this.localizedValue; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricValue.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricValue.java new file mode 100644 index 0000000000000..dc6da4d548e3f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricValue.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Represents metrics values. */ +@Immutable +public class MetricValue { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricValue.class); + + /* + * The number of values for the metric. + */ + @JsonProperty(value = "_count", access = JsonProperty.Access.WRITE_ONLY) + private Integer count; + + /* + * The average value of the metric. + */ + @JsonProperty(value = "average", access = JsonProperty.Access.WRITE_ONLY) + private Double average; + + /* + * The max value of the metric. + */ + @JsonProperty(value = "maximum", access = JsonProperty.Access.WRITE_ONLY) + private Double maximum; + + /* + * The min value of the metric. + */ + @JsonProperty(value = "minimum", access = JsonProperty.Access.WRITE_ONLY) + private Double minimum; + + /* + * The metric timestamp (ISO-8601 format). + */ + @JsonProperty(value = "timestamp", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime timestamp; + + /* + * The total value of the metric. + */ + @JsonProperty(value = "total", access = JsonProperty.Access.WRITE_ONLY) + private Double total; + + /** + * Get the count property: The number of values for the metric. + * + * @return the count value. + */ + public Integer count() { + return this.count; + } + + /** + * Get the average property: The average value of the metric. + * + * @return the average value. + */ + public Double average() { + return this.average; + } + + /** + * Get the maximum property: The max value of the metric. + * + * @return the maximum value. + */ + public Double maximum() { + return this.maximum; + } + + /** + * Get the minimum property: The min value of the metric. + * + * @return the minimum value. + */ + public Double minimum() { + return this.minimum; + } + + /** + * Get the timestamp property: The metric timestamp (ISO-8601 format). + * + * @return the timestamp value. + */ + public OffsetDateTime timestamp() { + return this.timestamp; + } + + /** + * Get the total property: The total value of the metric. + * + * @return the total value. + */ + public Double total() { + return this.total; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionCreateUpdateParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionCreateUpdateParameters.java new file mode 100644 index 0000000000000..be5ea6f5aa41d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionCreateUpdateParameters.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Parameters to create and update Cosmos DB MongoDB collection. */ +@JsonFlatten +@Fluent +public class MongoDBCollectionCreateUpdateParameters extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MongoDBCollectionCreateUpdateParameters.class); + + /* + * The standard JSON format of a MongoDB collection + */ + @JsonProperty(value = "properties.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 = "properties.options") + private CreateUpdateOptions options; + + /** + * Get the resource property: The standard JSON format of a MongoDB collection. + * + * @return the resource value. + */ + public MongoDBCollectionResource resource() { + return this.resource; + } + + /** + * Set the resource property: The standard JSON format of a MongoDB collection. + * + * @param resource the resource value to set. + * @return the MongoDBCollectionCreateUpdateParameters object itself. + */ + public MongoDBCollectionCreateUpdateParameters 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 MongoDBCollectionCreateUpdateParameters object itself. + */ + public MongoDBCollectionCreateUpdateParameters withOptions(CreateUpdateOptions options) { + this.options = options; + return this; + } + + /** {@inheritDoc} */ + @Override + public MongoDBCollectionCreateUpdateParameters withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public MongoDBCollectionCreateUpdateParameters withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (resource() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property resource in model MongoDBCollectionCreateUpdateParameters")); + } else { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionGetPropertiesOptions.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionGetPropertiesOptions.java new file mode 100644 index 0000000000000..49cdc089d444a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionGetPropertiesOptions.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** The MongoDBCollectionGetPropertiesOptions model. */ +@Fluent +public final class MongoDBCollectionGetPropertiesOptions extends OptionsResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MongoDBCollectionGetPropertiesOptions.class); + + /** {@inheritDoc} */ + @Override + public MongoDBCollectionGetPropertiesOptions withThroughput(Integer throughput) { + super.withThroughput(throughput); + return this; + } + + /** {@inheritDoc} */ + @Override + public MongoDBCollectionGetPropertiesOptions withAutoscaleSettings(AutoscaleSettings autoscaleSettings) { + super.withAutoscaleSettings(autoscaleSettings); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionGetPropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionGetPropertiesResource.java new file mode 100644 index 0000000000000..3b3c5f16272e7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionGetPropertiesResource.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** The MongoDBCollectionGetPropertiesResource model. */ +@Fluent +public final class MongoDBCollectionGetPropertiesResource extends MongoDBCollectionResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MongoDBCollectionGetPropertiesResource.class); + + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the rid property: A system generated property. A unique identifier. + * + * @return the rid value. + */ + public String rid() { + return this.rid; + } + + /** + * Get the ts property: A system generated property that denotes the last updated timestamp of the resource. + * + * @return the ts value. + */ + public Float ts() { + return this.ts; + } + + /** + * Get the etag property: A system generated property representing the resource etag required for optimistic + * concurrency control. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** {@inheritDoc} */ + @Override + public MongoDBCollectionGetPropertiesResource withId(String id) { + super.withId(id); + return this; + } + + /** {@inheritDoc} */ + @Override + public MongoDBCollectionGetPropertiesResource withShardKey(Map shardKey) { + super.withShardKey(shardKey); + return this; + } + + /** {@inheritDoc} */ + @Override + public MongoDBCollectionGetPropertiesResource withIndexes(List indexes) { + super.withIndexes(indexes); + return this; + } + + /** {@inheritDoc} */ + @Override + public MongoDBCollectionGetPropertiesResource withAnalyticalStorageTtl(Integer analyticalStorageTtl) { + super.withAnalyticalStorageTtl(analyticalStorageTtl); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionGetResults.java new file mode 100644 index 0000000000000..4a11aa3491ad0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionGetResults.java @@ -0,0 +1,253 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.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 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); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionListResult.java new file mode 100644 index 0000000000000..1b52e1731f627 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MongoDBCollectionGetResultsInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the MongoDB collections and their properties. */ +@Immutable +public final class MongoDBCollectionListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MongoDBCollectionListResult.class); + + /* + * List of MongoDB collections and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of MongoDB collections and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionResource.java new file mode 100644 index 0000000000000..93caa7c899e88 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionResource.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Cosmos DB MongoDB collection resource object. */ +@Fluent +public class MongoDBCollectionResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MongoDBCollectionResource.class); + + /* + * Name of the Cosmos DB MongoDB collection + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * A key-value pair of shard keys to be applied for the request. + */ + @JsonProperty(value = "shardKey") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map shardKey; + + /* + * List of index keys + */ + @JsonProperty(value = "indexes") + private List indexes; + + /* + * Analytical TTL. + */ + @JsonProperty(value = "analyticalStorageTtl") + private Integer analyticalStorageTtl; + + /** + * Get the id property: Name of the Cosmos DB MongoDB collection. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Name of the Cosmos DB MongoDB collection. + * + * @param id the id value to set. + * @return the MongoDBCollectionResource object itself. + */ + public MongoDBCollectionResource withId(String id) { + this.id = id; + return this; + } + + /** + * Get the shardKey property: A key-value pair of shard keys to be applied for the request. + * + * @return the shardKey value. + */ + public Map shardKey() { + return this.shardKey; + } + + /** + * Set the shardKey property: A key-value pair of shard keys to be applied for the request. + * + * @param shardKey the shardKey value to set. + * @return the MongoDBCollectionResource object itself. + */ + public MongoDBCollectionResource withShardKey(Map shardKey) { + this.shardKey = shardKey; + return this; + } + + /** + * Get the indexes property: List of index keys. + * + * @return the indexes value. + */ + public List indexes() { + return this.indexes; + } + + /** + * Set the indexes property: List of index keys. + * + * @param indexes the indexes value to set. + * @return the MongoDBCollectionResource object itself. + */ + public MongoDBCollectionResource withIndexes(List indexes) { + this.indexes = indexes; + return this; + } + + /** + * Get the analyticalStorageTtl property: Analytical TTL. + * + * @return the analyticalStorageTtl value. + */ + public Integer analyticalStorageTtl() { + return this.analyticalStorageTtl; + } + + /** + * Set the analyticalStorageTtl property: Analytical TTL. + * + * @param analyticalStorageTtl the analyticalStorageTtl value to set. + * @return the MongoDBCollectionResource object itself. + */ + public MongoDBCollectionResource withAnalyticalStorageTtl(Integer analyticalStorageTtl) { + this.analyticalStorageTtl = analyticalStorageTtl; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model MongoDBCollectionResource")); + } + if (indexes() != null) { + indexes().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseCreateUpdateParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseCreateUpdateParameters.java new file mode 100644 index 0000000000000..797e41a572b27 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseCreateUpdateParameters.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Parameters to create and update Cosmos DB MongoDB database. */ +@JsonFlatten +@Fluent +public class MongoDBDatabaseCreateUpdateParameters extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MongoDBDatabaseCreateUpdateParameters.class); + + /* + * The standard JSON format of a MongoDB database + */ + @JsonProperty(value = "properties.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 = "properties.options") + private CreateUpdateOptions options; + + /** + * Get the resource property: The standard JSON format of a MongoDB database. + * + * @return the resource value. + */ + public MongoDBDatabaseResource resource() { + return this.resource; + } + + /** + * Set the resource property: The standard JSON format of a MongoDB database. + * + * @param resource the resource value to set. + * @return the MongoDBDatabaseCreateUpdateParameters object itself. + */ + public MongoDBDatabaseCreateUpdateParameters 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 MongoDBDatabaseCreateUpdateParameters object itself. + */ + public MongoDBDatabaseCreateUpdateParameters withOptions(CreateUpdateOptions options) { + this.options = options; + return this; + } + + /** {@inheritDoc} */ + @Override + public MongoDBDatabaseCreateUpdateParameters withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public MongoDBDatabaseCreateUpdateParameters withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (resource() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property resource in model MongoDBDatabaseCreateUpdateParameters")); + } else { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseGetPropertiesOptions.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseGetPropertiesOptions.java new file mode 100644 index 0000000000000..459bf7a066047 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseGetPropertiesOptions.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** The MongoDBDatabaseGetPropertiesOptions model. */ +@Fluent +public final class MongoDBDatabaseGetPropertiesOptions extends OptionsResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MongoDBDatabaseGetPropertiesOptions.class); + + /** {@inheritDoc} */ + @Override + public MongoDBDatabaseGetPropertiesOptions withThroughput(Integer throughput) { + super.withThroughput(throughput); + return this; + } + + /** {@inheritDoc} */ + @Override + public MongoDBDatabaseGetPropertiesOptions withAutoscaleSettings(AutoscaleSettings autoscaleSettings) { + super.withAutoscaleSettings(autoscaleSettings); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseGetPropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseGetPropertiesResource.java new file mode 100644 index 0000000000000..425d0de616926 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseGetPropertiesResource.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The MongoDBDatabaseGetPropertiesResource model. */ +@Fluent +public final class MongoDBDatabaseGetPropertiesResource extends MongoDBDatabaseResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MongoDBDatabaseGetPropertiesResource.class); + + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the rid property: A system generated property. A unique identifier. + * + * @return the rid value. + */ + public String rid() { + return this.rid; + } + + /** + * Get the ts property: A system generated property that denotes the last updated timestamp of the resource. + * + * @return the ts value. + */ + public Float ts() { + return this.ts; + } + + /** + * Get the etag property: A system generated property representing the resource etag required for optimistic + * concurrency control. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** {@inheritDoc} */ + @Override + public MongoDBDatabaseGetPropertiesResource withId(String id) { + super.withId(id); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseGetResults.java new file mode 100644 index 0000000000000..3ed74959f6545 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseGetResults.java @@ -0,0 +1,252 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.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 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..55a27bf9be6ca --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MongoDBDatabaseGetResultsInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the MongoDB databases and their properties. */ +@Immutable +public final class MongoDBDatabaseListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MongoDBDatabaseListResult.class); + + /* + * List of MongoDB databases and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of MongoDB databases and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseResource.java new file mode 100644 index 0000000000000..69c046ac6fc2d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseResource.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB MongoDB database resource object. */ +@Fluent +public class MongoDBDatabaseResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MongoDBDatabaseResource.class); + + /* + * Name of the Cosmos DB MongoDB database + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * Get the id property: Name of the Cosmos DB MongoDB database. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Name of the Cosmos DB MongoDB database. + * + * @param id the id value to set. + * @return the MongoDBDatabaseResource object itself. + */ + public MongoDBDatabaseResource withId(String id) { + this.id = id; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model MongoDBDatabaseResource")); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBResources.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBResources.java new file mode 100644 index 0000000000000..b207dec59558d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBResources.java @@ -0,0 +1,556 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of MongoDBResources. */ +public interface MongoDBResources { + /** + * Lists the MongoDB databases under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the MongoDB databases and their properties. + */ + PagedIterable listMongoDBDatabases(String resourceGroupName, String accountName); + + /** + * Lists the MongoDB databases under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the MongoDB databases and their properties. + */ + PagedIterable listMongoDBDatabases( + String resourceGroupName, String accountName, Context context); + + /** + * Gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. + */ + MongoDBDatabaseGetResults getMongoDBDatabase(String resourceGroupName, String accountName, String databaseName); + + /** + * Gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. + */ + Response getMongoDBDatabaseWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteMongoDBDatabase(String resourceGroupName, String accountName, String databaseName); + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteMongoDBDatabase(String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Gets the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account with the + * provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account with the + * provided name. + */ + ThroughputSettingsGetResults getMongoDBDatabaseThroughput( + String resourceGroupName, String accountName, String databaseName); + + /** + * Gets the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account with the + * provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account with the + * provided name. + */ + Response getMongoDBDatabaseThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Update RUs per second of the an Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults updateMongoDBDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Update RUs per second of the an Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults updateMongoDBDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * Migrate an Azure Cosmos DB MongoDB database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateMongoDBDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName); + + /** + * Migrate an Azure Cosmos DB MongoDB database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateMongoDBDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Migrate an Azure Cosmos DB MongoDB database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateMongoDBDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName); + + /** + * Migrate an Azure Cosmos DB MongoDB database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateMongoDBDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Lists the MongoDB collection under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the MongoDB collections and their properties. + */ + PagedIterable listMongoDBCollections( + String resourceGroupName, String accountName, String databaseName); + + /** + * Lists the MongoDB collection under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the MongoDB collections and their properties. + */ + PagedIterable listMongoDBCollections( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Gets the MongoDB collection under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the MongoDB collection under an existing Azure Cosmos DB database account. + */ + MongoDBCollectionGetResults getMongoDBCollection( + String resourceGroupName, String accountName, String databaseName, String collectionName); + + /** + * Gets the MongoDB collection under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the MongoDB collection under an existing Azure Cosmos DB database account. + */ + Response getMongoDBCollectionWithResponse( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context); + + /** + * Deletes an existing Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteMongoDBCollection( + String resourceGroupName, String accountName, String databaseName, String collectionName); + + /** + * Deletes an existing Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteMongoDBCollection( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context); + + /** + * Gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the + * provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the + * provided name. + */ + ThroughputSettingsGetResults getMongoDBCollectionThroughput( + String resourceGroupName, String accountName, String databaseName, String collectionName); + + /** + * Gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the + * provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the + * provided name. + */ + Response getMongoDBCollectionThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context); + + /** + * Update the RUs per second of an Azure Cosmos DB MongoDB collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults updateMongoDBCollectionThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Update the RUs per second of an Azure Cosmos DB MongoDB collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults updateMongoDBCollectionThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * Migrate an Azure Cosmos DB MongoDB collection from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateMongoDBCollectionToAutoscale( + String resourceGroupName, String accountName, String databaseName, String collectionName); + + /** + * Migrate an Azure Cosmos DB MongoDB collection from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateMongoDBCollectionToAutoscale( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context); + + /** + * Migrate an Azure Cosmos DB MongoDB collection from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateMongoDBCollectionToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String collectionName); + + /** + * Migrate an Azure Cosmos DB MongoDB collection from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateMongoDBCollectionToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context); + + /** + * Gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. + */ + MongoDBDatabaseGetResults getMongoDBDatabaseById(String id); + + /** + * Gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. + */ + Response getMongoDBDatabaseByIdWithResponse(String id, Context context); + + /** + * Gets the MongoDB collection under an existing Azure Cosmos DB database account. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the MongoDB collection under an existing Azure Cosmos DB database account. + */ + MongoDBCollectionGetResults getMongoDBCollectionById(String id); + + /** + * Gets the MongoDB collection under an existing Azure Cosmos DB database account. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the MongoDB collection under an existing Azure Cosmos DB database account. + */ + Response getMongoDBCollectionByIdWithResponse(String id, Context context); + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteMongoDBDatabaseById(String id); + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteMongoDBDatabaseByIdWithResponse(String id, Context context); + + /** + * Deletes an existing Azure Cosmos DB MongoDB Collection. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteMongoDBCollectionById(String id); + + /** + * Deletes an existing Azure Cosmos DB MongoDB Collection. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteMongoDBCollectionByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new MongoDBDatabaseGetResults resource. + * + * @param name resource name. + * @return the first stage of the new MongoDBDatabaseGetResults definition. + */ + MongoDBDatabaseGetResults.DefinitionStages.Blank defineUpdateMongoDBDatabase(String name); + + /** + * Begins definition for a new MongoDBCollectionGetResults resource. + * + * @param name resource name. + * @return the first stage of the new MongoDBCollectionGetResults definition. + */ + MongoDBCollectionGetResults.DefinitionStages.Blank defineUpdateMongoDBCollection(String name); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoIndex.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoIndex.java new file mode 100644 index 0000000000000..db749ce168cc2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoIndex.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB MongoDB collection index key. */ +@Fluent +public final class MongoIndex { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MongoIndex.class); + + /* + * Cosmos DB MongoDB collection index keys + */ + @JsonProperty(value = "key") + private MongoIndexKeys key; + + /* + * Cosmos DB MongoDB collection index key options + */ + @JsonProperty(value = "options") + private MongoIndexOptions options; + + /** + * Get the key property: Cosmos DB MongoDB collection index keys. + * + * @return the key value. + */ + public MongoIndexKeys key() { + return this.key; + } + + /** + * Set the key property: Cosmos DB MongoDB collection index keys. + * + * @param key the key value to set. + * @return the MongoIndex object itself. + */ + public MongoIndex withKey(MongoIndexKeys key) { + this.key = key; + return this; + } + + /** + * Get the options property: Cosmos DB MongoDB collection index key options. + * + * @return the options value. + */ + public MongoIndexOptions options() { + return this.options; + } + + /** + * Set the options property: Cosmos DB MongoDB collection index key options. + * + * @param options the options value to set. + * @return the MongoIndex object itself. + */ + public MongoIndex withOptions(MongoIndexOptions options) { + this.options = options; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (key() != null) { + key().validate(); + } + if (options() != null) { + options().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoIndexKeys.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoIndexKeys.java new file mode 100644 index 0000000000000..396dee7fa7f91 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoIndexKeys.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Cosmos DB MongoDB collection resource object. */ +@Fluent +public final class MongoIndexKeys { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MongoIndexKeys.class); + + /* + * List of keys for each MongoDB collection in the Azure Cosmos DB service + */ + @JsonProperty(value = "keys") + private List keys; + + /** + * Get the keys property: List of keys for each MongoDB collection in the Azure Cosmos DB service. + * + * @return the keys value. + */ + public List keys() { + return this.keys; + } + + /** + * Set the keys property: List of keys for each MongoDB collection in the Azure Cosmos DB service. + * + * @param keys the keys value to set. + * @return the MongoIndexKeys object itself. + */ + public MongoIndexKeys withKeys(List keys) { + this.keys = keys; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoIndexOptions.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoIndexOptions.java new file mode 100644 index 0000000000000..fe58ceeba6c96 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoIndexOptions.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB MongoDB collection index options. */ +@Fluent +public final class MongoIndexOptions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MongoIndexOptions.class); + + /* + * Expire after seconds + */ + @JsonProperty(value = "expireAfterSeconds") + private Integer expireAfterSeconds; + + /* + * Is unique or not + */ + @JsonProperty(value = "unique") + private Boolean unique; + + /** + * Get the expireAfterSeconds property: Expire after seconds. + * + * @return the expireAfterSeconds value. + */ + public Integer expireAfterSeconds() { + return this.expireAfterSeconds; + } + + /** + * Set the expireAfterSeconds property: Expire after seconds. + * + * @param expireAfterSeconds the expireAfterSeconds value to set. + * @return the MongoIndexOptions object itself. + */ + public MongoIndexOptions withExpireAfterSeconds(Integer expireAfterSeconds) { + this.expireAfterSeconds = expireAfterSeconds; + return this; + } + + /** + * Get the unique property: Is unique or not. + * + * @return the unique value. + */ + public Boolean unique() { + return this.unique; + } + + /** + * Set the unique property: Is unique or not. + * + * @param unique the unique value to set. + * @return the MongoIndexOptions object itself. + */ + public MongoIndexOptions withUnique(Boolean unique) { + this.unique = unique; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NetworkAclBypass.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NetworkAclBypass.java new file mode 100644 index 0000000000000..e015eba4e8378 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NetworkAclBypass.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for NetworkAclBypass. */ +public enum NetworkAclBypass { + /** Enum value None. */ + NONE("None"), + + /** Enum value AzureServices. */ + AZURE_SERVICES("AzureServices"); + + /** The actual serialized value for a NetworkAclBypass instance. */ + private final String value; + + NetworkAclBypass(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a NetworkAclBypass instance. + * + * @param value the serialized value to parse. + * @return the parsed NetworkAclBypass object, or null if unable to parse. + */ + @JsonCreator + public static NetworkAclBypass fromString(String value) { + NetworkAclBypass[] items = NetworkAclBypass.values(); + for (NetworkAclBypass item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspace.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspace.java new file mode 100644 index 0000000000000..cbbaa291d552b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspace.java @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.NotebookWorkspaceInner; + +/** An immutable client-side representation of NotebookWorkspace. */ +public interface NotebookWorkspace { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the notebookServerEndpoint property: Specifies the endpoint of Notebook server. + * + * @return the notebookServerEndpoint value. + */ + String notebookServerEndpoint(); + + /** + * Gets the status property: Status of the notebook workspace. Possible values are: Creating, Online, Deleting, + * Failed, Updating. + * + * @return the status value. + */ + String status(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.NotebookWorkspaceInner object. + * + * @return the inner object. + */ + NotebookWorkspaceInner innerModel(); + + /** The entirety of the NotebookWorkspace definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The NotebookWorkspace definition stages. */ + interface DefinitionStages { + /** The first stage of the NotebookWorkspace definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the NotebookWorkspace definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, accountName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @return the next definition stage. + */ + WithCreate withExistingDatabaseAccount(String resourceGroupName, String accountName); + } + /** + * The stage of the NotebookWorkspace definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate { + /** + * Executes the create request. + * + * @return the created resource. + */ + NotebookWorkspace create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + NotebookWorkspace create(Context context); + } + } + /** + * Begins update for the NotebookWorkspace resource. + * + * @return the stage of resource update. + */ + NotebookWorkspace.Update update(); + + /** The template for NotebookWorkspace update. */ + interface Update { + /** + * Executes the update request. + * + * @return the updated resource. + */ + NotebookWorkspace apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + NotebookWorkspace apply(Context context); + } + /** The NotebookWorkspace update stages. */ + interface UpdateStages { + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + NotebookWorkspace refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + NotebookWorkspace refresh(Context context); + + /** + * Retrieves the connection info for the notebook workspace. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connection info for the given notebook workspace. + */ + NotebookWorkspaceConnectionInfoResult listConnectionInfo(); + + /** + * Retrieves the connection info for the notebook workspace. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connection info for the given notebook workspace. + */ + Response listConnectionInfoWithResponse(Context context); + + /** + * Regenerates the auth token for the notebook workspace. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void regenerateAuthToken(); + + /** + * Regenerates the auth token for the notebook workspace. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void regenerateAuthToken(Context context); + + /** + * Starts the notebook workspace. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void start(); + + /** + * Starts the notebook workspace. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void start(Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspaceConnectionInfoResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspaceConnectionInfoResult.java new file mode 100644 index 0000000000000..397d8142fc661 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspaceConnectionInfoResult.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.NotebookWorkspaceConnectionInfoResultInner; + +/** An immutable client-side representation of NotebookWorkspaceConnectionInfoResult. */ +public interface NotebookWorkspaceConnectionInfoResult { + /** + * Gets the authToken property: Specifies auth token used for connecting to Notebook server (uses token-based auth). + * + * @return the authToken value. + */ + String authToken(); + + /** + * Gets the notebookServerEndpoint property: Specifies the endpoint of Notebook server. + * + * @return the notebookServerEndpoint value. + */ + String notebookServerEndpoint(); + + /** + * Gets the inner + * com.azure.resourcemanager.cosmos.generated.fluent.models.NotebookWorkspaceConnectionInfoResultInner object. + * + * @return the inner object. + */ + NotebookWorkspaceConnectionInfoResultInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspaceCreateUpdateParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspaceCreateUpdateParameters.java new file mode 100644 index 0000000000000..039ebf8d94924 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspaceCreateUpdateParameters.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** Parameters to create a notebook workspace resource. */ +@Immutable +public final class NotebookWorkspaceCreateUpdateParameters extends ArmProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NotebookWorkspaceCreateUpdateParameters.class); + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspaceListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspaceListResult.java new file mode 100644 index 0000000000000..29d99c23ce2e6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspaceListResult.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.NotebookWorkspaceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of notebook workspace resources. */ +@Fluent +public final class NotebookWorkspaceListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NotebookWorkspaceListResult.class); + + /* + * Array of notebook workspace resources + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: Array of notebook workspace resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of notebook workspace resources. + * + * @param value the value value to set. + * @return the NotebookWorkspaceListResult object itself. + */ + public NotebookWorkspaceListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspaceName.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspaceName.java new file mode 100644 index 0000000000000..75b45a100985a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspaceName.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for NotebookWorkspaceName. */ +public final class NotebookWorkspaceName extends ExpandableStringEnum { + /** Static value default for NotebookWorkspaceName. */ + public static final NotebookWorkspaceName DEFAULT = fromString("default"); + + /** + * Creates or finds a NotebookWorkspaceName from its string representation. + * + * @param name a name to look for. + * @return the corresponding NotebookWorkspaceName. + */ + @JsonCreator + public static NotebookWorkspaceName fromString(String name) { + return fromString(name, NotebookWorkspaceName.class); + } + + /** @return known NotebookWorkspaceName values. */ + public static Collection values() { + return values(NotebookWorkspaceName.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspaces.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspaces.java new file mode 100644 index 0000000000000..995e59c01e8a6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspaces.java @@ -0,0 +1,225 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of NotebookWorkspaces. */ +public interface NotebookWorkspaces { + /** + * Gets the notebook workspace resources of an existing Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notebook workspace resources of an existing Cosmos DB account. + */ + PagedIterable listByDatabaseAccount(String resourceGroupName, String accountName); + + /** + * Gets the notebook workspace resources of an existing Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notebook workspace resources of an existing Cosmos DB account. + */ + PagedIterable listByDatabaseAccount( + String resourceGroupName, String accountName, Context context); + + /** + * Gets the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notebook workspace for a Cosmos DB account. + */ + NotebookWorkspace get(String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName); + + /** + * Gets the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notebook workspace for a Cosmos DB account. + */ + Response getWithResponse( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context); + + /** + * Deletes the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName); + + /** + * Deletes the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context); + + /** + * Retrieves the connection info for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connection info for the given notebook workspace. + */ + NotebookWorkspaceConnectionInfoResult listConnectionInfo( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName); + + /** + * Retrieves the connection info for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connection info for the given notebook workspace. + */ + Response listConnectionInfoWithResponse( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context); + + /** + * Regenerates the auth token for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void regenerateAuthToken(String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName); + + /** + * Regenerates the auth token for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void regenerateAuthToken( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context); + + /** + * Starts the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void start(String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName); + + /** + * Starts the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void start( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context); + + /** + * Gets the notebook workspace for a Cosmos DB account. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notebook workspace for a Cosmos DB account. + */ + NotebookWorkspace getById(String id); + + /** + * Gets the notebook workspace for a Cosmos DB account. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notebook workspace for a Cosmos DB account. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the notebook workspace for a Cosmos DB account. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes the notebook workspace for a Cosmos DB account. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new NotebookWorkspace resource. + * + * @param name resource name. + * @return the first stage of the new NotebookWorkspace definition. + */ + NotebookWorkspace.DefinitionStages.Blank define(NotebookWorkspaceName name); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Operation.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Operation.java new file mode 100644 index 0000000000000..76002cb51dcf0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Operation.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.OperationInner; + +/** An immutable client-side representation of Operation. */ +public interface Operation { + /** + * Gets the name property: Operation name: {provider}/{resource}/{operation}. + * + * @return the name value. + */ + String name(); + + /** + * Gets the display property: The object that represents the operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/OperationDisplay.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/OperationDisplay.java new file mode 100644 index 0000000000000..c3ed67a976cb1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/OperationDisplay.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The object that represents the operation. */ +@Fluent +public final class OperationDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationDisplay.class); + + /* + * Service provider: Microsoft.ResourceProvider + */ + @JsonProperty(value = "Provider") + private String provider; + + /* + * Resource on which the operation is performed: Profile, endpoint, etc. + */ + @JsonProperty(value = "Resource") + private String resource; + + /* + * Operation type: Read, write, delete, etc. + */ + @JsonProperty(value = "Operation") + private String operation; + + /* + * Description of operation + */ + @JsonProperty(value = "Description") + private String description; + + /** + * Get the provider property: Service provider: Microsoft.ResourceProvider. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider property: Service provider: Microsoft.ResourceProvider. + * + * @param provider the provider value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the resource property: Resource on which the operation is performed: Profile, endpoint, etc. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource property: Resource on which the operation is performed: Profile, endpoint, etc. + * + * @param resource the resource value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get the operation property: Operation type: Read, write, delete, etc. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation property: Operation type: Read, write, delete, etc. + * + * @param operation the operation value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the description property: Description of operation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of operation. + * + * @param description the description value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withDescription(String description) { + this.description = description; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/OperationListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/OperationListResult.java new file mode 100644 index 0000000000000..34bdae9c9074e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/OperationListResult.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Result of the request to list Resource Provider operations. It contains a list of operations and a URL link to get + * the next set of results. + */ +@Fluent +public final class OperationListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationListResult.class); + + /* + * List of operations supported by the Resource Provider. + */ + @JsonProperty(value = "value") + private List value; + + /* + * URL to get the next set of operation list results if there are any. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: List of operations supported by the Resource Provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of operations supported by the Resource Provider. + * + * @param value the value value to set. + * @return the OperationListResult object itself. + */ + public OperationListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results if there are any. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: URL to get the next set of operation list results if there are any. + * + * @param nextLink the nextLink value to set. + * @return the OperationListResult object itself. + */ + public OperationListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/OperationType.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/OperationType.java new file mode 100644 index 0000000000000..93e513cc0c512 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/OperationType.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for OperationType. */ +public final class OperationType extends ExpandableStringEnum { + /** Static value Create for OperationType. */ + public static final OperationType CREATE = fromString("Create"); + + /** Static value Replace for OperationType. */ + public static final OperationType REPLACE = fromString("Replace"); + + /** Static value Delete for OperationType. */ + public static final OperationType DELETE = fromString("Delete"); + + /** Static value SystemOperation for OperationType. */ + public static final OperationType SYSTEM_OPERATION = fromString("SystemOperation"); + + /** + * Creates or finds a OperationType from its string representation. + * + * @param name a name to look for. + * @return the corresponding OperationType. + */ + @JsonCreator + public static OperationType fromString(String name) { + return fromString(name, OperationType.class); + } + + /** @return known OperationType values. */ + public static Collection values() { + return values(OperationType.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Operations.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Operations.java new file mode 100644 index 0000000000000..f35de9660ff88 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Operations.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Lists all of the available Cosmos DB Resource Provider operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Resource Provider operations. + */ + PagedIterable list(); + + /** + * Lists all of the available Cosmos DB Resource Provider operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Resource Provider operations. + */ + PagedIterable list(Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/OptionsResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/OptionsResource.java new file mode 100644 index 0000000000000..34e378a40ab08 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/OptionsResource.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB options resource object. */ +@Fluent +public class OptionsResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OptionsResource.class); + + /* + * Value of the Cosmos DB resource throughput or autoscaleSettings. Use the + * ThroughputSetting resource when retrieving offer details. + */ + @JsonProperty(value = "throughput") + private Integer throughput; + + /* + * Specifies the Autoscale settings. + */ + @JsonProperty(value = "autoscaleSettings") + private AutoscaleSettings autoscaleSettings; + + /** + * Get the throughput property: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the + * ThroughputSetting resource when retrieving offer details. + * + * @return the throughput value. + */ + public Integer throughput() { + return this.throughput; + } + + /** + * Set the throughput property: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the + * ThroughputSetting resource when retrieving offer details. + * + * @param throughput the throughput value to set. + * @return the OptionsResource object itself. + */ + public OptionsResource withThroughput(Integer throughput) { + this.throughput = throughput; + return this; + } + + /** + * Get the autoscaleSettings property: Specifies the Autoscale settings. + * + * @return the autoscaleSettings value. + */ + public AutoscaleSettings autoscaleSettings() { + return this.autoscaleSettings; + } + + /** + * Set the autoscaleSettings property: Specifies the Autoscale settings. + * + * @param autoscaleSettings the autoscaleSettings value to set. + * @return the OptionsResource object itself. + */ + public OptionsResource withAutoscaleSettings(AutoscaleSettings autoscaleSettings) { + this.autoscaleSettings = autoscaleSettings; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (autoscaleSettings() != null) { + autoscaleSettings().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionKeyRangeIdRegions.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionKeyRangeIdRegions.java new file mode 100644 index 0000000000000..7bcd132393a50 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionKeyRangeIdRegions.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of PartitionKeyRangeIdRegions. */ +public interface PartitionKeyRangeIdRegions { + /** + * Retrieves the metrics determined by the given filter for the given partition key range id and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter); + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter, + Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionKeyRangeIds.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionKeyRangeIds.java new file mode 100644 index 0000000000000..33de15685ad58 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionKeyRangeIds.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of PartitionKeyRangeIds. */ +public interface PartitionKeyRangeIds { + /** + * Retrieves the metrics determined by the given filter for the given partition key range id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter); + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter, + Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionKind.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionKind.java new file mode 100644 index 0000000000000..ab15e9f9df0f9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionKind.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PartitionKind. */ +public final class PartitionKind extends ExpandableStringEnum { + /** Static value Hash for PartitionKind. */ + public static final PartitionKind HASH = fromString("Hash"); + + /** Static value Range for PartitionKind. */ + public static final PartitionKind RANGE = fromString("Range"); + + /** Static value MultiHash for PartitionKind. */ + public static final PartitionKind MULTI_HASH = fromString("MultiHash"); + + /** + * Creates or finds a PartitionKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding PartitionKind. + */ + @JsonCreator + public static PartitionKind fromString(String name) { + return fromString(name, PartitionKind.class); + } + + /** @return known PartitionKind values. */ + public static Collection values() { + return values(PartitionKind.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionMetric.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionMetric.java new file mode 100644 index 0000000000000..b044ed0c8b8f4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionMetric.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionMetricInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of PartitionMetric. */ +public interface PartitionMetric { + /** + * Gets the startTime property: The start time for the metric (ISO-8601 format). + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the endTime property: The end time for the metric (ISO-8601 format). + * + * @return the endTime value. + */ + OffsetDateTime endTime(); + + /** + * Gets the timeGrain property: The time grain to be used to summarize the metric values. + * + * @return the timeGrain value. + */ + String timeGrain(); + + /** + * Gets the unit property: The unit of the metric. + * + * @return the unit value. + */ + UnitType unit(); + + /** + * Gets the name property: The name information for the metric. + * + * @return the name value. + */ + MetricName name(); + + /** + * Gets the metricValues property: The metric values for the specified time window and timestep. + * + * @return the metricValues value. + */ + List metricValues(); + + /** + * Gets the partitionId property: The partition id (GUID identifier) of the metric values. + * + * @return the partitionId value. + */ + String partitionId(); + + /** + * Gets the partitionKeyRangeId property: The partition key range id (integer identifier) of the metric values. + * + * @return the partitionKeyRangeId value. + */ + String partitionKeyRangeId(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionMetricInner object. + * + * @return the inner object. + */ + PartitionMetricInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionMetricListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionMetricListResult.java new file mode 100644 index 0000000000000..a10afb5a5578e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionMetricListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionMetricInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list partition metrics request. */ +@Immutable +public final class PartitionMetricListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PartitionMetricListResult.class); + + /* + * The list of partition-level metrics for the account. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: The list of partition-level metrics for the account. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionUsage.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionUsage.java new file mode 100644 index 0000000000000..de30efd7d99e2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionUsage.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionUsageInner; + +/** An immutable client-side representation of PartitionUsage. */ +public interface PartitionUsage { + /** + * Gets the unit property: The unit of the metric. + * + * @return the unit value. + */ + UnitType unit(); + + /** + * Gets the name property: The name information for the metric. + * + * @return the name value. + */ + MetricName name(); + + /** + * Gets the quotaPeriod property: The quota period used to summarize the usage values. + * + * @return the quotaPeriod value. + */ + String quotaPeriod(); + + /** + * Gets the limit property: Maximum value for this metric. + * + * @return the limit value. + */ + Long limit(); + + /** + * Gets the currentValue property: Current value for this metric. + * + * @return the currentValue value. + */ + Long currentValue(); + + /** + * Gets the partitionId property: The partition id (GUID identifier) of the usages. + * + * @return the partitionId value. + */ + String partitionId(); + + /** + * Gets the partitionKeyRangeId property: The partition key range id (integer identifier) of the usages. + * + * @return the partitionKeyRangeId value. + */ + String partitionKeyRangeId(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionUsageInner object. + * + * @return the inner object. + */ + PartitionUsageInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionUsagesResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionUsagesResult.java new file mode 100644 index 0000000000000..9ca35dd838e9e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionUsagesResult.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionUsageInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list partition level usage request. */ +@Immutable +public final class PartitionUsagesResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PartitionUsagesResult.class); + + /* + * The list of partition-level usages for the database. A usage is a point + * in time metric + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: The list of partition-level usages for the database. A usage is a point in time metric. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PercentileMetric.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PercentileMetric.java new file mode 100644 index 0000000000000..16fa1416ea65a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PercentileMetric.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.PercentileMetricInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of PercentileMetric. */ +public interface PercentileMetric { + /** + * Gets the startTime property: The start time for the metric (ISO-8601 format). + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the endTime property: The end time for the metric (ISO-8601 format). + * + * @return the endTime value. + */ + OffsetDateTime endTime(); + + /** + * Gets the timeGrain property: The time grain to be used to summarize the metric values. + * + * @return the timeGrain value. + */ + String timeGrain(); + + /** + * Gets the unit property: The unit of the metric. + * + * @return the unit value. + */ + UnitType unit(); + + /** + * Gets the name property: The name information for the metric. + * + * @return the name value. + */ + MetricName name(); + + /** + * Gets the metricValues property: The percentile metric values for the specified time window and timestep. + * + * @return the metricValues value. + */ + List metricValues(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.PercentileMetricInner object. + * + * @return the inner object. + */ + PercentileMetricInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PercentileMetricListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PercentileMetricListResult.java new file mode 100644 index 0000000000000..ba0f84ce100fa --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PercentileMetricListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PercentileMetricInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list percentile metrics request. */ +@Immutable +public final class PercentileMetricListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PercentileMetricListResult.class); + + /* + * The list of percentile metrics for the account. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: The list of percentile metrics for the account. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PercentileMetricValue.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PercentileMetricValue.java new file mode 100644 index 0000000000000..43bee343c577b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PercentileMetricValue.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents percentile metrics values. */ +@Immutable +public final class PercentileMetricValue extends MetricValue { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PercentileMetricValue.class); + + /* + * The 10th percentile value for the metric. + */ + @JsonProperty(value = "P10", access = JsonProperty.Access.WRITE_ONLY) + private Double p10; + + /* + * The 25th percentile value for the metric. + */ + @JsonProperty(value = "P25", access = JsonProperty.Access.WRITE_ONLY) + private Double p25; + + /* + * The 50th percentile value for the metric. + */ + @JsonProperty(value = "P50", access = JsonProperty.Access.WRITE_ONLY) + private Double p50; + + /* + * The 75th percentile value for the metric. + */ + @JsonProperty(value = "P75", access = JsonProperty.Access.WRITE_ONLY) + private Double p75; + + /* + * The 90th percentile value for the metric. + */ + @JsonProperty(value = "P90", access = JsonProperty.Access.WRITE_ONLY) + private Double p90; + + /* + * The 95th percentile value for the metric. + */ + @JsonProperty(value = "P95", access = JsonProperty.Access.WRITE_ONLY) + private Double p95; + + /* + * The 99th percentile value for the metric. + */ + @JsonProperty(value = "P99", access = JsonProperty.Access.WRITE_ONLY) + private Double p99; + + /** + * Get the p10 property: The 10th percentile value for the metric. + * + * @return the p10 value. + */ + public Double p10() { + return this.p10; + } + + /** + * Get the p25 property: The 25th percentile value for the metric. + * + * @return the p25 value. + */ + public Double p25() { + return this.p25; + } + + /** + * Get the p50 property: The 50th percentile value for the metric. + * + * @return the p50 value. + */ + public Double p50() { + return this.p50; + } + + /** + * Get the p75 property: The 75th percentile value for the metric. + * + * @return the p75 value. + */ + public Double p75() { + return this.p75; + } + + /** + * Get the p90 property: The 90th percentile value for the metric. + * + * @return the p90 value. + */ + public Double p90() { + return this.p90; + } + + /** + * Get the p95 property: The 95th percentile value for the metric. + * + * @return the p95 value. + */ + public Double p95() { + return this.p95; + } + + /** + * Get the p99 property: The 99th percentile value for the metric. + * + * @return the p99 value. + */ + public Double p99() { + return this.p99; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PercentileSourceTargets.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PercentileSourceTargets.java new file mode 100644 index 0000000000000..5759b85645203 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PercentileSourceTargets.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of PercentileSourceTargets. */ +public interface PercentileSourceTargets { + /** + * Retrieves the metrics determined by the given filter for the given account, source and target region. This url is + * only for PBS and Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param sourceRegion Source region from which data is written. Cosmos DB region, with spaces between words and + * each word capitalized. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each + * word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + PagedIterable listMetrics( + String resourceGroupName, String accountName, String sourceRegion, String targetRegion, String filter); + + /** + * Retrieves the metrics determined by the given filter for the given account, source and target region. This url is + * only for PBS and Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param sourceRegion Source region from which data is written. Cosmos DB region, with spaces between words and + * each word capitalized. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each + * word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String sourceRegion, + String targetRegion, + String filter, + Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PercentileTargets.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PercentileTargets.java new file mode 100644 index 0000000000000..014015c40c714 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PercentileTargets.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of PercentileTargets. */ +public interface PercentileTargets { + /** + * Retrieves the metrics determined by the given filter for the given account target region. This url is only for + * PBS and Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each + * word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + PagedIterable listMetrics( + String resourceGroupName, String accountName, String targetRegion, String filter); + + /** + * Retrieves the metrics determined by the given filter for the given account target region. This url is only for + * PBS and Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each + * word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + PagedIterable listMetrics( + String resourceGroupName, String accountName, String targetRegion, String filter, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Percentiles.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Percentiles.java new file mode 100644 index 0000000000000..f2ab6378cd9dd --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Percentiles.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Percentiles. */ +public interface Percentiles { + /** + * Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and + * Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + PagedIterable listMetrics(String resourceGroupName, String accountName, String filter); + + /** + * Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and + * Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + PagedIterable listMetrics( + String resourceGroupName, String accountName, String filter, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PeriodicModeBackupPolicy.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PeriodicModeBackupPolicy.java new file mode 100644 index 0000000000000..f4ee5ef401ac4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PeriodicModeBackupPolicy.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The object representing periodic mode backup policy. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Periodic") +@Fluent +public final class PeriodicModeBackupPolicy extends BackupPolicy { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PeriodicModeBackupPolicy.class); + + /* + * Configuration values for periodic mode backup + */ + @JsonProperty(value = "periodicModeProperties") + private PeriodicModeProperties periodicModeProperties; + + /** + * Get the periodicModeProperties property: Configuration values for periodic mode backup. + * + * @return the periodicModeProperties value. + */ + public PeriodicModeProperties periodicModeProperties() { + return this.periodicModeProperties; + } + + /** + * Set the periodicModeProperties property: Configuration values for periodic mode backup. + * + * @param periodicModeProperties the periodicModeProperties value to set. + * @return the PeriodicModeBackupPolicy object itself. + */ + public PeriodicModeBackupPolicy withPeriodicModeProperties(PeriodicModeProperties periodicModeProperties) { + this.periodicModeProperties = periodicModeProperties; + return this; + } + + /** {@inheritDoc} */ + @Override + public PeriodicModeBackupPolicy withMigrationState(BackupPolicyMigrationState migrationState) { + super.withMigrationState(migrationState); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (periodicModeProperties() != null) { + periodicModeProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PeriodicModeProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PeriodicModeProperties.java new file mode 100644 index 0000000000000..c1f2699ddb020 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PeriodicModeProperties.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.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Configuration values for periodic mode backup. */ +@Fluent +public final class PeriodicModeProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PeriodicModeProperties.class); + + /* + * An integer representing the interval in minutes between two backups + */ + @JsonProperty(value = "backupIntervalInMinutes") + private Integer backupIntervalInMinutes; + + /* + * An integer representing the time (in hours) that each backup is retained + */ + @JsonProperty(value = "backupRetentionIntervalInHours") + private Integer backupRetentionIntervalInHours; + + /** + * 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Permission.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Permission.java new file mode 100644 index 0000000000000..e9da4d5f661e8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Permission.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The set of data plane operations permitted through this Role Definition. */ +@Fluent +public final class Permission { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Permission.class); + + /* + * An array of data actions that are allowed. + */ + @JsonProperty(value = "dataActions") + private List dataActions; + + /* + * An array of data actions that are denied. + */ + @JsonProperty(value = "notDataActions") + private List notDataActions; + + /** + * Get the dataActions property: An array of data actions that are allowed. + * + * @return the dataActions value. + */ + public List dataActions() { + return this.dataActions; + } + + /** + * Set the dataActions property: An array of data actions that are allowed. + * + * @param dataActions the dataActions value to set. + * @return the Permission object itself. + */ + public Permission withDataActions(List dataActions) { + this.dataActions = dataActions; + return this; + } + + /** + * Get the notDataActions property: An array of data actions that are denied. + * + * @return the notDataActions value. + */ + public List notDataActions() { + return this.notDataActions; + } + + /** + * Set the notDataActions property: An array of data actions that are denied. + * + * @param notDataActions the notDataActions value to set. + * @return the Permission object itself. + */ + public Permission withNotDataActions(List notDataActions) { + this.notDataActions = notDataActions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrimaryAggregationType.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrimaryAggregationType.java new file mode 100644 index 0000000000000..2520f1d5a3798 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrimaryAggregationType.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PrimaryAggregationType. */ +public final class PrimaryAggregationType extends ExpandableStringEnum { + /** Static value None for PrimaryAggregationType. */ + public static final PrimaryAggregationType NONE = fromString("None"); + + /** Static value Average for PrimaryAggregationType. */ + public static final PrimaryAggregationType AVERAGE = fromString("Average"); + + /** Static value Total for PrimaryAggregationType. */ + public static final PrimaryAggregationType TOTAL = fromString("Total"); + + /** Static value Minimum for PrimaryAggregationType. */ + public static final PrimaryAggregationType MINIMUM = fromString("Minimum"); + + /** Static value Maximum for PrimaryAggregationType. */ + public static final PrimaryAggregationType MAXIMUM = fromString("Maximum"); + + /** Static value Last for PrimaryAggregationType. */ + public static final PrimaryAggregationType LAST = fromString("Last"); + + /** + * Creates or finds a PrimaryAggregationType from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrimaryAggregationType. + */ + @JsonCreator + public static PrimaryAggregationType fromString(String name) { + return fromString(name, PrimaryAggregationType.class); + } + + /** @return known PrimaryAggregationType values. */ + public static Collection values() { + return values(PrimaryAggregationType.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateEndpointConnection.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateEndpointConnection.java new file mode 100644 index 0000000000000..cde2d709ef7b1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateEndpointConnection.java @@ -0,0 +1,244 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PrivateEndpointConnectionInner; + +/** An immutable client-side representation of PrivateEndpointConnection. */ +public interface PrivateEndpointConnection { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @return the privateEndpoint value. + */ + PrivateEndpointProperty privateEndpoint(); + + /** + * Gets the privateLinkServiceConnectionState property: Connection State of the Private Endpoint Connection. + * + * @return the privateLinkServiceConnectionState value. + */ + PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState(); + + /** + * Gets the groupId property: Group id of the private endpoint. + * + * @return the groupId value. + */ + String groupId(); + + /** + * Gets the provisioningState property: Provisioning state of the private endpoint. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.PrivateEndpointConnectionInner object. + * + * @return the inner object. + */ + PrivateEndpointConnectionInner innerModel(); + + /** The entirety of the PrivateEndpointConnection definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The PrivateEndpointConnection definition stages. */ + interface DefinitionStages { + /** The first stage of the PrivateEndpointConnection definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the PrivateEndpointConnection definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, accountName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @return the next definition stage. + */ + WithCreate withExistingDatabaseAccount(String resourceGroupName, String accountName); + } + /** + * The stage of the PrivateEndpointConnection definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithPrivateEndpoint, + DefinitionStages.WithPrivateLinkServiceConnectionState, + DefinitionStages.WithGroupId, + DefinitionStages.WithProvisioningState { + /** + * Executes the create request. + * + * @return the created resource. + */ + PrivateEndpointConnection create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + PrivateEndpointConnection create(Context context); + } + /** The stage of the PrivateEndpointConnection definition allowing to specify privateEndpoint. */ + interface WithPrivateEndpoint { + /** + * Specifies the privateEndpoint property: Private endpoint which the connection belongs to.. + * + * @param privateEndpoint Private endpoint which the connection belongs to. + * @return the next definition stage. + */ + WithCreate withPrivateEndpoint(PrivateEndpointProperty privateEndpoint); + } + /** + * The stage of the PrivateEndpointConnection definition allowing to specify privateLinkServiceConnectionState. + */ + interface WithPrivateLinkServiceConnectionState { + /** + * Specifies the privateLinkServiceConnectionState property: Connection State of the Private Endpoint + * Connection.. + * + * @param privateLinkServiceConnectionState Connection State of the Private Endpoint Connection. + * @return the next definition stage. + */ + WithCreate withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState); + } + /** The stage of the PrivateEndpointConnection definition allowing to specify groupId. */ + interface WithGroupId { + /** + * Specifies the groupId property: Group id of the private endpoint.. + * + * @param groupId Group id of the private endpoint. + * @return the next definition stage. + */ + WithCreate withGroupId(String groupId); + } + /** The stage of the PrivateEndpointConnection definition allowing to specify provisioningState. */ + interface WithProvisioningState { + /** + * Specifies the provisioningState property: Provisioning state of the private endpoint.. + * + * @param provisioningState Provisioning state of the private endpoint. + * @return the next definition stage. + */ + WithCreate withProvisioningState(String provisioningState); + } + } + /** + * Begins update for the PrivateEndpointConnection resource. + * + * @return the stage of resource update. + */ + PrivateEndpointConnection.Update update(); + + /** The template for PrivateEndpointConnection update. */ + interface Update + extends UpdateStages.WithPrivateEndpoint, + UpdateStages.WithPrivateLinkServiceConnectionState, + UpdateStages.WithGroupId, + UpdateStages.WithProvisioningState { + /** + * Executes the update request. + * + * @return the updated resource. + */ + PrivateEndpointConnection apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + PrivateEndpointConnection apply(Context context); + } + /** The PrivateEndpointConnection update stages. */ + interface UpdateStages { + /** The stage of the PrivateEndpointConnection update allowing to specify privateEndpoint. */ + interface WithPrivateEndpoint { + /** + * Specifies the privateEndpoint property: Private endpoint which the connection belongs to.. + * + * @param privateEndpoint Private endpoint which the connection belongs to. + * @return the next definition stage. + */ + Update withPrivateEndpoint(PrivateEndpointProperty privateEndpoint); + } + /** The stage of the PrivateEndpointConnection update allowing to specify privateLinkServiceConnectionState. */ + interface WithPrivateLinkServiceConnectionState { + /** + * Specifies the privateLinkServiceConnectionState property: Connection State of the Private Endpoint + * Connection.. + * + * @param privateLinkServiceConnectionState Connection State of the Private Endpoint Connection. + * @return the next definition stage. + */ + Update withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState); + } + /** The stage of the PrivateEndpointConnection update allowing to specify groupId. */ + interface WithGroupId { + /** + * Specifies the groupId property: Group id of the private endpoint.. + * + * @param groupId Group id of the private endpoint. + * @return the next definition stage. + */ + Update withGroupId(String groupId); + } + /** The stage of the PrivateEndpointConnection update allowing to specify provisioningState. */ + interface WithProvisioningState { + /** + * Specifies the provisioningState property: Provisioning state of the private endpoint.. + * + * @param provisioningState Provisioning state of the private endpoint. + * @return the next definition stage. + */ + Update withProvisioningState(String provisioningState); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + PrivateEndpointConnection refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + PrivateEndpointConnection refresh(Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateEndpointConnectionListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateEndpointConnectionListResult.java new file mode 100644 index 0000000000000..05a9f0e09a630 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateEndpointConnectionListResult.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PrivateEndpointConnectionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of private endpoint connections. */ +@Fluent +public final class PrivateEndpointConnectionListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionListResult.class); + + /* + * Array of private endpoint connections + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: Array of private endpoint connections. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of private endpoint connections. + * + * @param value the value value to set. + * @return the PrivateEndpointConnectionListResult object itself. + */ + public PrivateEndpointConnectionListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateEndpointConnections.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateEndpointConnections.java new file mode 100644 index 0000000000000..ca1c174c85caa --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateEndpointConnections.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of PrivateEndpointConnections. */ +public interface PrivateEndpointConnections { + /** + * List all private endpoint connections on a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private endpoint connections. + */ + PagedIterable listByDatabaseAccount(String resourceGroupName, String accountName); + + /** + * List all private endpoint connections on a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private endpoint connections. + */ + PagedIterable listByDatabaseAccount( + String resourceGroupName, String accountName, Context context); + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + PrivateEndpointConnection get(String resourceGroupName, String accountName, String privateEndpointConnectionName); + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + Response getWithResponse( + String resourceGroupName, String accountName, String privateEndpointConnectionName, Context context); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String accountName, String privateEndpointConnectionName); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String accountName, String privateEndpointConnectionName, Context context); + + /** + * Gets a private endpoint connection. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + PrivateEndpointConnection getById(String id); + + /** + * Gets a private endpoint connection. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new PrivateEndpointConnection resource. + * + * @param name resource name. + * @return the first stage of the new PrivateEndpointConnection definition. + */ + PrivateEndpointConnection.DefinitionStages.Blank define(String name); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateEndpointProperty.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateEndpointProperty.java new file mode 100644 index 0000000000000..7cdc91ea126b3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateEndpointProperty.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Private endpoint which the connection belongs to. */ +@Fluent +public final class PrivateEndpointProperty { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpointProperty.class); + + /* + * Resource id of the private endpoint. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Get the id property: Resource id of the private endpoint. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Resource id of the private endpoint. + * + * @param id the id value to set. + * @return the PrivateEndpointProperty object itself. + */ + public PrivateEndpointProperty withId(String id) { + this.id = id; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateLinkResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateLinkResource.java new file mode 100644 index 0000000000000..0cd8da5dfa317 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateLinkResource.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.PrivateLinkResourceInner; +import java.util.List; + +/** An immutable client-side representation of PrivateLinkResource. */ +public interface PrivateLinkResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the groupId property: The private link resource group id. + * + * @return the groupId value. + */ + String groupId(); + + /** + * Gets the requiredMembers property: The private link resource required member names. + * + * @return the requiredMembers value. + */ + List requiredMembers(); + + /** + * Gets the requiredZoneNames property: The private link resource required zone names. + * + * @return the requiredZoneNames value. + */ + List requiredZoneNames(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.PrivateLinkResourceInner object. + * + * @return the inner object. + */ + PrivateLinkResourceInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateLinkResourceListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateLinkResourceListResult.java new file mode 100644 index 0000000000000..4aaf6e3f327db --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateLinkResourceListResult.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PrivateLinkResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of private link resources. */ +@Fluent +public final class PrivateLinkResourceListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkResourceListResult.class); + + /* + * Array of private link resources + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: Array of private link resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of private link resources. + * + * @param value the value value to set. + * @return the PrivateLinkResourceListResult object itself. + */ + public PrivateLinkResourceListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateLinkResources.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateLinkResources.java new file mode 100644 index 0000000000000..adccda1837700 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateLinkResources.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of PrivateLinkResources. */ +public interface PrivateLinkResources { + /** + * Gets the private link resources that need to be created for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Cosmos DB account. + */ + PagedIterable listByDatabaseAccount(String resourceGroupName, String accountName); + + /** + * Gets the private link resources that need to be created for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Cosmos DB account. + */ + PagedIterable listByDatabaseAccount( + String resourceGroupName, String accountName, Context context); + + /** + * Gets the private link resources that need to be created for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param groupName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Cosmos DB account. + */ + PrivateLinkResource get(String resourceGroupName, String accountName, String groupName); + + /** + * Gets the private link resources that need to be created for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param groupName The name of the private link resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Cosmos DB account. + */ + Response getWithResponse( + String resourceGroupName, String accountName, String groupName, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateLinkServiceConnectionStateProperty.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateLinkServiceConnectionStateProperty.java new file mode 100644 index 0000000000000..b3d8f861943e8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateLinkServiceConnectionStateProperty.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Connection State of the Private Endpoint Connection. */ +@Fluent +public final class PrivateLinkServiceConnectionStateProperty { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkServiceConnectionStateProperty.class); + + /* + * The private link service connection status. + */ + @JsonProperty(value = "status") + private String status; + + /* + * The private link service connection description. + */ + @JsonProperty(value = "description") + private String description; + + /* + * Any action that is required beyond basic workflow (approve/ reject/ + * disconnect) + */ + @JsonProperty(value = "actionsRequired", access = JsonProperty.Access.WRITE_ONLY) + private String actionsRequired; + + /** + * Get the status property: The private link service connection status. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Set the status property: The private link service connection status. + * + * @param status the status value to set. + * @return the PrivateLinkServiceConnectionStateProperty object itself. + */ + public PrivateLinkServiceConnectionStateProperty withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the description property: The private link service connection description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The private link service connection description. + * + * @param description the description value to set. + * @return the PrivateLinkServiceConnectionStateProperty object itself. + */ + public PrivateLinkServiceConnectionStateProperty withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the actionsRequired property: Any action that is required beyond basic workflow (approve/ reject/ + * disconnect). + * + * @return the actionsRequired value. + */ + public String actionsRequired() { + return this.actionsRequired; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PublicNetworkAccess.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PublicNetworkAccess.java new file mode 100644 index 0000000000000..d78b0f3debc73 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PublicNetworkAccess.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PublicNetworkAccess. */ +public final class PublicNetworkAccess extends ExpandableStringEnum { + /** Static value Enabled for PublicNetworkAccess. */ + public static final PublicNetworkAccess ENABLED = fromString("Enabled"); + + /** Static value Disabled for PublicNetworkAccess. */ + public static final PublicNetworkAccess DISABLED = fromString("Disabled"); + + /** + * Creates or finds a PublicNetworkAccess from its string representation. + * + * @param name a name to look for. + * @return the corresponding PublicNetworkAccess. + */ + @JsonCreator + public static PublicNetworkAccess fromString(String name) { + return fromString(name, PublicNetworkAccess.class); + } + + /** @return known PublicNetworkAccess values. */ + public static Collection values() { + return values(PublicNetworkAccess.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RegionForOnlineOffline.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RegionForOnlineOffline.java new file mode 100644 index 0000000000000..9e1316e4e9842 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RegionForOnlineOffline.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB region to online or offline. */ +@Fluent +public final class RegionForOnlineOffline { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RegionForOnlineOffline.class); + + /* + * Cosmos DB region, with spaces between words and each word capitalized. + */ + @JsonProperty(value = "region", required = true) + private String region; + + /** + * Get the region property: Cosmos DB region, with spaces between words and each word capitalized. + * + * @return the region value. + */ + public String region() { + return this.region; + } + + /** + * Set the region property: Cosmos DB region, with spaces between words and each word capitalized. + * + * @param region the region value to set. + * @return the RegionForOnlineOffline object itself. + */ + public RegionForOnlineOffline withRegion(String region) { + this.region = region; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (region() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property region in model RegionForOnlineOffline")); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ResourceIdentityType.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ResourceIdentityType.java new file mode 100644 index 0000000000000..0e59098f26fdc --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ResourceIdentityType.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for ResourceIdentityType. */ +public enum ResourceIdentityType { + /** Enum value SystemAssigned. */ + SYSTEM_ASSIGNED("SystemAssigned"), + + /** Enum value UserAssigned. */ + USER_ASSIGNED("UserAssigned"), + + /** Enum value SystemAssigned,UserAssigned. */ + SYSTEM_ASSIGNED_USER_ASSIGNED("SystemAssigned,UserAssigned"), + + /** Enum value None. */ + NONE("None"); + + /** The actual serialized value for a ResourceIdentityType instance. */ + private final String value; + + ResourceIdentityType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ResourceIdentityType instance. + * + * @param value the serialized value to parse. + * @return the parsed ResourceIdentityType object, or null if unable to parse. + */ + @JsonCreator + public static ResourceIdentityType fromString(String value) { + ResourceIdentityType[] items = ResourceIdentityType.values(); + for (ResourceIdentityType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableDatabaseAccountGetResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableDatabaseAccountGetResult.java new file mode 100644 index 0000000000000..5584ffa5389b1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableDatabaseAccountGetResult.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableDatabaseAccountGetResultInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of RestorableDatabaseAccountGetResult. */ +public interface RestorableDatabaseAccountGetResult { + /** + * Gets the id property: The unique resource identifier of the ARM resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the ARM resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of Azure resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The location of the resource group to which the resource belongs. + * + * @return the location value. + */ + String location(); + + /** + * Gets the accountName property: The name of the global database account. + * + * @return the accountName value. + */ + String accountName(); + + /** + * Gets the creationTime property: The creation time of the restorable database account (ISO-8601 format). + * + * @return the creationTime value. + */ + OffsetDateTime creationTime(); + + /** + * Gets the deletionTime property: The time at which the restorable database account has been deleted (ISO-8601 + * format). + * + * @return the deletionTime value. + */ + OffsetDateTime deletionTime(); + + /** + * Gets the apiType property: The API type of the restorable database account. + * + * @return the apiType value. + */ + ApiType apiType(); + + /** + * Gets the restorableLocations property: List of regions where the of the database account can be restored from. + * + * @return the restorableLocations value. + */ + List restorableLocations(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableDatabaseAccountGetResultInner + * object. + * + * @return the inner object. + */ + RestorableDatabaseAccountGetResultInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableDatabaseAccounts.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableDatabaseAccounts.java new file mode 100644 index 0000000000000..f8e9264876b1e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableDatabaseAccounts.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of RestorableDatabaseAccounts. */ +public interface RestorableDatabaseAccounts { + /** + * Lists all the restorable Azure Cosmos DB database accounts available under the subscription and in a region. This + * call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the restorable database accounts and their properties. + */ + PagedIterable listByLocation(String location); + + /** + * Lists all the restorable Azure Cosmos DB database accounts available under the subscription and in a region. This + * call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the restorable database accounts and their properties. + */ + PagedIterable listByLocation(String location, Context context); + + /** + * Lists all the restorable Azure Cosmos DB database accounts available under the subscription. This call requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the restorable database accounts and their properties. + */ + PagedIterable list(); + + /** + * Lists all the restorable Azure Cosmos DB database accounts available under the subscription. This call requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the restorable database accounts and their properties. + */ + PagedIterable list(Context context); + + /** + * Retrieves the properties of an existing Azure Cosmos DB restorable database account. This call requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read/*' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Azure Cosmos DB restorable database account. + */ + RestorableDatabaseAccountGetResult getByLocation(String location, String instanceId); + + /** + * Retrieves the properties of an existing Azure Cosmos DB restorable database account. This call requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read/*' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Azure Cosmos DB restorable database account. + */ + Response getByLocationWithResponse( + String location, String instanceId, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableDatabaseAccountsListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableDatabaseAccountsListResult.java new file mode 100644 index 0000000000000..ac662009c229d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableDatabaseAccountsListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableDatabaseAccountGetResultInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the restorable database accounts and their properties. */ +@Immutable +public final class RestorableDatabaseAccountsListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableDatabaseAccountsListResult.class); + + /* + * List of restorable database accounts and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of restorable database accounts and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableLocationResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableLocationResource.java new file mode 100644 index 0000000000000..91fcc757c7e52 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableLocationResource.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Properties of the regional restorable account. */ +@Immutable +public final class RestorableLocationResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableLocationResource.class); + + /* + * The location of the regional restorable account. + */ + @JsonProperty(value = "locationName", access = JsonProperty.Access.WRITE_ONLY) + private String locationName; + + /* + * The instance id of the regional restorable account. + */ + @JsonProperty(value = "regionalDatabaseAccountInstanceId", access = JsonProperty.Access.WRITE_ONLY) + private String regionalDatabaseAccountInstanceId; + + /* + * The creation time of the regional restorable database account (ISO-8601 + * format). + */ + @JsonProperty(value = "creationTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime creationTime; + + /* + * The time at which the regional restorable database account has been + * deleted (ISO-8601 format). + */ + @JsonProperty(value = "deletionTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime deletionTime; + + /** + * Get the locationName property: The location of the regional restorable account. + * + * @return the locationName value. + */ + public String locationName() { + return this.locationName; + } + + /** + * Get the regionalDatabaseAccountInstanceId property: The instance id of the regional restorable account. + * + * @return the regionalDatabaseAccountInstanceId value. + */ + public String regionalDatabaseAccountInstanceId() { + return this.regionalDatabaseAccountInstanceId; + } + + /** + * Get the creationTime property: The creation time of the regional restorable database account (ISO-8601 format). + * + * @return the creationTime value. + */ + public OffsetDateTime creationTime() { + return this.creationTime; + } + + /** + * Get the deletionTime property: The time at which the regional restorable database account has been deleted + * (ISO-8601 format). + * + * @return the deletionTime value. + */ + public OffsetDateTime deletionTime() { + return this.deletionTime; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbCollectionGetResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbCollectionGetResult.java new file mode 100644 index 0000000000000..62529fb0ffc77 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbCollectionGetResult.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableMongodbCollectionGetResultInner; + +/** An immutable client-side representation of RestorableMongodbCollectionGetResult. */ +public interface RestorableMongodbCollectionGetResult { + /** + * Gets the id property: The unique resource Identifier of the ARM resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the ARM resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of Azure resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the resource property: The resource of an Azure Cosmos DB MongoDB collection event. + * + * @return the resource value. + */ + RestorableMongodbCollectionPropertiesResource resource(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableMongodbCollectionGetResultInner + * object. + * + * @return the inner object. + */ + RestorableMongodbCollectionGetResultInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbCollectionPropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbCollectionPropertiesResource.java new file mode 100644 index 0000000000000..82bb1565b613e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbCollectionPropertiesResource.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The resource of an Azure Cosmos DB MongoDB collection event. */ +@Immutable +public final class RestorableMongodbCollectionPropertiesResource { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(RestorableMongodbCollectionPropertiesResource.class); + + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * The operation type of this collection event. + */ + @JsonProperty(value = "operationType", access = JsonProperty.Access.WRITE_ONLY) + private OperationType operationType; + + /* + * The time when this collection event happened. + */ + @JsonProperty(value = "eventTimestamp", access = JsonProperty.Access.WRITE_ONLY) + private String eventTimestamp; + + /* + * The name of this MongoDB collection. + */ + @JsonProperty(value = "ownerId", access = JsonProperty.Access.WRITE_ONLY) + private String ownerId; + + /* + * The resource ID of this MongoDB collection. + */ + @JsonProperty(value = "ownerResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String ownerResourceId; + + /** + * Get the rid property: A system generated property. A unique identifier. + * + * @return the rid value. + */ + public String rid() { + return this.rid; + } + + /** + * Get the operationType property: The operation type of this collection event. + * + * @return the operationType value. + */ + public OperationType operationType() { + return this.operationType; + } + + /** + * Get the eventTimestamp property: The time when this collection event happened. + * + * @return the eventTimestamp value. + */ + public String eventTimestamp() { + return this.eventTimestamp; + } + + /** + * Get the ownerId property: The name of this MongoDB collection. + * + * @return the ownerId value. + */ + public String ownerId() { + return this.ownerId; + } + + /** + * Get the ownerResourceId property: The resource ID of this MongoDB collection. + * + * @return the ownerResourceId value. + */ + public String ownerResourceId() { + return this.ownerResourceId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbCollections.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbCollections.java new file mode 100644 index 0000000000000..b86a7d621abf6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbCollections.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of RestorableMongodbCollections. */ +public interface RestorableMongodbCollections { + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB collections under a specific + * database. This helps in scenario where container was accidentally deleted. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the MongoDB collection events and their properties. + */ + PagedIterable list(String location, String instanceId); + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB collections under a specific + * database. This helps in scenario where container was accidentally deleted. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restorableMongodbDatabaseRid The resource ID of the MongoDB database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the MongoDB collection events and their properties. + */ + PagedIterable list( + String location, String instanceId, String restorableMongodbDatabaseRid, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbCollectionsListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbCollectionsListResult.java new file mode 100644 index 0000000000000..a75e7b7bca272 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbCollectionsListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableMongodbCollectionGetResultInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the MongoDB collection events and their properties. */ +@Immutable +public final class RestorableMongodbCollectionsListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableMongodbCollectionsListResult.class); + + /* + * List of MongoDB collection events and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of MongoDB collection events and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbDatabaseGetResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbDatabaseGetResult.java new file mode 100644 index 0000000000000..f0e1414c9e7c7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbDatabaseGetResult.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableMongodbDatabaseGetResultInner; + +/** An immutable client-side representation of RestorableMongodbDatabaseGetResult. */ +public interface RestorableMongodbDatabaseGetResult { + /** + * Gets the id property: The unique resource Identifier of the ARM resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the ARM resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of Azure resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the resource property: The resource of an Azure Cosmos DB MongoDB database event. + * + * @return the resource value. + */ + RestorableMongodbDatabasePropertiesResource resource(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableMongodbDatabaseGetResultInner + * object. + * + * @return the inner object. + */ + RestorableMongodbDatabaseGetResultInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbDatabasePropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbDatabasePropertiesResource.java new file mode 100644 index 0000000000000..4473433b12aba --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbDatabasePropertiesResource.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The resource of an Azure Cosmos DB MongoDB database event. */ +@Immutable +public final class RestorableMongodbDatabasePropertiesResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableMongodbDatabasePropertiesResource.class); + + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * The operation type of this database event. + */ + @JsonProperty(value = "operationType", access = JsonProperty.Access.WRITE_ONLY) + private OperationType operationType; + + /* + * The time when this database event happened. + */ + @JsonProperty(value = "eventTimestamp", access = JsonProperty.Access.WRITE_ONLY) + private String eventTimestamp; + + /* + * The name of this MongoDB database. + */ + @JsonProperty(value = "ownerId", access = JsonProperty.Access.WRITE_ONLY) + private String ownerId; + + /* + * The resource ID of this MongoDB database. + */ + @JsonProperty(value = "ownerResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String ownerResourceId; + + /** + * Get the rid property: A system generated property. A unique identifier. + * + * @return the rid value. + */ + public String rid() { + return this.rid; + } + + /** + * Get the operationType property: The operation type of this database event. + * + * @return the operationType value. + */ + public OperationType operationType() { + return this.operationType; + } + + /** + * Get the eventTimestamp property: The time when this database event happened. + * + * @return the eventTimestamp value. + */ + public String eventTimestamp() { + return this.eventTimestamp; + } + + /** + * Get the ownerId property: The name of this MongoDB database. + * + * @return the ownerId value. + */ + public String ownerId() { + return this.ownerId; + } + + /** + * Get the ownerResourceId property: The resource ID of this MongoDB database. + * + * @return the ownerResourceId value. + */ + public String ownerResourceId() { + return this.ownerResourceId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbDatabases.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbDatabases.java new file mode 100644 index 0000000000000..8cb1028983541 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbDatabases.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of RestorableMongodbDatabases. */ +public interface RestorableMongodbDatabases { + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB databases under the restorable + * account. This helps in scenario where database was accidentally deleted to get the deletion time. This API + * requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the MongoDB database events and their properties. + */ + PagedIterable list(String location, String instanceId); + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB databases under the restorable + * account. This helps in scenario where database was accidentally deleted to get the deletion time. This API + * requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the MongoDB database events and their properties. + */ + PagedIterable list(String location, String instanceId, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbDatabasesListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbDatabasesListResult.java new file mode 100644 index 0000000000000..4b585e3d98b3b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbDatabasesListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableMongodbDatabaseGetResultInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the MongoDB database events and their properties. */ +@Immutable +public final class RestorableMongodbDatabasesListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableMongodbDatabasesListResult.class); + + /* + * List of MongoDB database events and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of MongoDB database events and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbResources.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbResources.java new file mode 100644 index 0000000000000..db96743936264 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbResources.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of RestorableMongodbResources. */ +public interface RestorableMongodbResources { + /** + * Return a list of database and collection combo that exist on the account at the given timestamp and location. + * This helps in scenarios to validate what resources exist at given timestamp and location. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the restorable MongoDB resources. + */ + PagedIterable list(String location, String instanceId); + + /** + * Return a list of database and collection combo that exist on the account at the given timestamp and location. + * This helps in scenarios to validate what resources exist at given timestamp and location. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restoreLocation The location where the restorable resources are located. + * @param restoreTimestampInUtc The timestamp when the restorable resources existed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the restorable MongoDB resources. + */ + PagedIterable list( + String location, String instanceId, String restoreLocation, String restoreTimestampInUtc, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbResourcesListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbResourcesListResult.java new file mode 100644 index 0000000000000..37d7ec074752f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbResourcesListResult.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseRestoreResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the restorable MongoDB resources. */ +@Immutable +public final class RestorableMongodbResourcesListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableMongodbResourcesListResult.class); + + /* + * List of restorable MongoDB resources, including the database and + * collection names. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of restorable MongoDB resources, including the database and collection names. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainerGetResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainerGetResult.java new file mode 100644 index 0000000000000..f491902574b3c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainerGetResult.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableSqlContainerGetResultInner; + +/** An immutable client-side representation of RestorableSqlContainerGetResult. */ +public interface RestorableSqlContainerGetResult { + /** + * Gets the id property: The unique resource Identifier of the ARM resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the ARM resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of Azure resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the resource property: The resource of an Azure Cosmos DB SQL container event. + * + * @return the resource value. + */ + RestorableSqlContainerPropertiesResource resource(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableSqlContainerGetResultInner + * object. + * + * @return the inner object. + */ + RestorableSqlContainerGetResultInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainerPropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainerPropertiesResource.java new file mode 100644 index 0000000000000..95f3c202a81a1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainerPropertiesResource.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The resource of an Azure Cosmos DB SQL container event. */ +@Fluent +public final class RestorableSqlContainerPropertiesResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableSqlContainerPropertiesResource.class); + + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * The operation type of this container event. + */ + @JsonProperty(value = "operationType", access = JsonProperty.Access.WRITE_ONLY) + private OperationType operationType; + + /* + * The when this container event happened. + */ + @JsonProperty(value = "eventTimestamp", access = JsonProperty.Access.WRITE_ONLY) + private String eventTimestamp; + + /* + * The name of this SQL container. + */ + @JsonProperty(value = "ownerId", access = JsonProperty.Access.WRITE_ONLY) + private String ownerId; + + /* + * The resource ID of this SQL container. + */ + @JsonProperty(value = "ownerResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String ownerResourceId; + + /* + * Cosmos DB SQL container resource object + */ + @JsonProperty(value = "container") + private RestorableSqlContainerPropertiesResourceContainer container; + + /** + * Get the rid property: A system generated property. A unique identifier. + * + * @return the rid value. + */ + public String rid() { + return this.rid; + } + + /** + * Get the operationType property: The operation type of this container event. + * + * @return the operationType value. + */ + public OperationType operationType() { + return this.operationType; + } + + /** + * Get the eventTimestamp property: The when this container event happened. + * + * @return the eventTimestamp value. + */ + public String eventTimestamp() { + return this.eventTimestamp; + } + + /** + * Get the ownerId property: The name of this SQL container. + * + * @return the ownerId value. + */ + public String ownerId() { + return this.ownerId; + } + + /** + * Get the ownerResourceId property: The resource ID of this SQL container. + * + * @return the ownerResourceId value. + */ + public String ownerResourceId() { + return this.ownerResourceId; + } + + /** + * Get the container property: Cosmos DB SQL container resource object. + * + * @return the container value. + */ + public RestorableSqlContainerPropertiesResourceContainer container() { + return this.container; + } + + /** + * Set the container property: Cosmos DB SQL container resource object. + * + * @param container the container value to set. + * @return the RestorableSqlContainerPropertiesResource object itself. + */ + public RestorableSqlContainerPropertiesResource withContainer( + RestorableSqlContainerPropertiesResourceContainer container) { + this.container = container; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (container() != null) { + container().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainerPropertiesResourceContainer.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainerPropertiesResourceContainer.java new file mode 100644 index 0000000000000..3d849dfdd0316 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainerPropertiesResourceContainer.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB SQL container resource object. */ +@Fluent +public final class RestorableSqlContainerPropertiesResourceContainer extends SqlContainerResource { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(RestorableSqlContainerPropertiesResourceContainer.class); + + /* + * A system generated property that specifies the addressable path of the + * container resource. + */ + @JsonProperty(value = "_self", access = JsonProperty.Access.WRITE_ONLY) + private String self; + + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the self property: A system generated property that specifies the addressable path of the container resource. + * + * @return the self value. + */ + public String self() { + return this.self; + } + + /** + * Get the rid property: A system generated property. A unique identifier. + * + * @return the rid value. + */ + public String rid() { + return this.rid; + } + + /** + * Get the ts property: A system generated property that denotes the last updated timestamp of the resource. + * + * @return the ts value. + */ + public Float ts() { + return this.ts; + } + + /** + * Get the etag property: A system generated property representing the resource etag required for optimistic + * concurrency control. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** {@inheritDoc} */ + @Override + public RestorableSqlContainerPropertiesResourceContainer withId(String id) { + super.withId(id); + return this; + } + + /** {@inheritDoc} */ + @Override + public RestorableSqlContainerPropertiesResourceContainer withIndexingPolicy(IndexingPolicy indexingPolicy) { + super.withIndexingPolicy(indexingPolicy); + return this; + } + + /** {@inheritDoc} */ + @Override + public RestorableSqlContainerPropertiesResourceContainer withPartitionKey(ContainerPartitionKey partitionKey) { + super.withPartitionKey(partitionKey); + return this; + } + + /** {@inheritDoc} */ + @Override + public RestorableSqlContainerPropertiesResourceContainer withDefaultTtl(Integer defaultTtl) { + super.withDefaultTtl(defaultTtl); + return this; + } + + /** {@inheritDoc} */ + @Override + public RestorableSqlContainerPropertiesResourceContainer withUniqueKeyPolicy(UniqueKeyPolicy uniqueKeyPolicy) { + super.withUniqueKeyPolicy(uniqueKeyPolicy); + return this; + } + + /** {@inheritDoc} */ + @Override + public RestorableSqlContainerPropertiesResourceContainer withConflictResolutionPolicy( + ConflictResolutionPolicy conflictResolutionPolicy) { + super.withConflictResolutionPolicy(conflictResolutionPolicy); + return this; + } + + /** {@inheritDoc} */ + @Override + public RestorableSqlContainerPropertiesResourceContainer withAnalyticalStorageTtl(Long analyticalStorageTtl) { + super.withAnalyticalStorageTtl(analyticalStorageTtl); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainers.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainers.java new file mode 100644 index 0000000000000..24ce75dbf0bc8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainers.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of RestorableSqlContainers. */ +public interface RestorableSqlContainers { + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB SQL containers under a specific database. + * This helps in scenario where container was accidentally deleted. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the SQL container events and their properties. + */ + PagedIterable list(String location, String instanceId); + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB SQL containers under a specific database. + * This helps in scenario where container was accidentally deleted. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restorableSqlDatabaseRid The resource ID of the SQL database. + * @param startTime The snapshot create timestamp after which snapshots need to be listed. + * @param endTime The snapshot create timestamp before which snapshots need to be listed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the SQL container events and their properties. + */ + PagedIterable list( + String location, + String instanceId, + String restorableSqlDatabaseRid, + String startTime, + String endTime, + Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainersListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainersListResult.java new file mode 100644 index 0000000000000..e2b2cdcc3e2e8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainersListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableSqlContainerGetResultInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the SQL container events and their properties. */ +@Immutable +public final class RestorableSqlContainersListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableSqlContainersListResult.class); + + /* + * List of SQL container events and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of SQL container events and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabaseGetResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabaseGetResult.java new file mode 100644 index 0000000000000..424dda4dc4692 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabaseGetResult.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableSqlDatabaseGetResultInner; + +/** An immutable client-side representation of RestorableSqlDatabaseGetResult. */ +public interface RestorableSqlDatabaseGetResult { + /** + * Gets the id property: The unique resource Identifier of the ARM resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the ARM resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of Azure resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the resource property: The resource of an Azure Cosmos DB SQL database event. + * + * @return the resource value. + */ + RestorableSqlDatabasePropertiesResource resource(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableSqlDatabaseGetResultInner + * object. + * + * @return the inner object. + */ + RestorableSqlDatabaseGetResultInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabasePropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabasePropertiesResource.java new file mode 100644 index 0000000000000..4943cbc8d5b04 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabasePropertiesResource.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The resource of an Azure Cosmos DB SQL database event. */ +@Fluent +public final class RestorableSqlDatabasePropertiesResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableSqlDatabasePropertiesResource.class); + + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * The operation type of this database event. + */ + @JsonProperty(value = "operationType", access = JsonProperty.Access.WRITE_ONLY) + private OperationType operationType; + + /* + * The time when this database event happened. + */ + @JsonProperty(value = "eventTimestamp", access = JsonProperty.Access.WRITE_ONLY) + private String eventTimestamp; + + /* + * The name of the SQL database. + */ + @JsonProperty(value = "ownerId", access = JsonProperty.Access.WRITE_ONLY) + private String ownerId; + + /* + * The resource ID of the SQL database. + */ + @JsonProperty(value = "ownerResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String ownerResourceId; + + /* + * Cosmos DB SQL database resource object + */ + @JsonProperty(value = "database") + private RestorableSqlDatabasePropertiesResourceDatabase database; + + /** + * Get the rid property: A system generated property. A unique identifier. + * + * @return the rid value. + */ + public String rid() { + return this.rid; + } + + /** + * Get the operationType property: The operation type of this database event. + * + * @return the operationType value. + */ + public OperationType operationType() { + return this.operationType; + } + + /** + * Get the eventTimestamp property: The time when this database event happened. + * + * @return the eventTimestamp value. + */ + public String eventTimestamp() { + return this.eventTimestamp; + } + + /** + * Get the ownerId property: The name of the SQL database. + * + * @return the ownerId value. + */ + public String ownerId() { + return this.ownerId; + } + + /** + * Get the ownerResourceId property: The resource ID of the SQL database. + * + * @return the ownerResourceId value. + */ + public String ownerResourceId() { + return this.ownerResourceId; + } + + /** + * Get the database property: Cosmos DB SQL database resource object. + * + * @return the database value. + */ + public RestorableSqlDatabasePropertiesResourceDatabase database() { + return this.database; + } + + /** + * Set the database property: Cosmos DB SQL database resource object. + * + * @param database the database value to set. + * @return the RestorableSqlDatabasePropertiesResource object itself. + */ + public RestorableSqlDatabasePropertiesResource withDatabase( + RestorableSqlDatabasePropertiesResourceDatabase database) { + this.database = database; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (database() != null) { + database().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabasePropertiesResourceDatabase.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabasePropertiesResourceDatabase.java new file mode 100644 index 0000000000000..909c29566d5c7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabasePropertiesResourceDatabase.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB SQL database resource object. */ +@Fluent +public final class RestorableSqlDatabasePropertiesResourceDatabase extends SqlDatabaseResource { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(RestorableSqlDatabasePropertiesResourceDatabase.class); + + /* + * A system generated property that specified the addressable path of the + * collections resource. + */ + @JsonProperty(value = "_colls", access = JsonProperty.Access.WRITE_ONLY) + private String colls; + + /* + * A system generated property that specifies the addressable path of the + * users resource. + */ + @JsonProperty(value = "_users", access = JsonProperty.Access.WRITE_ONLY) + private String users; + + /* + * A system generated property that specifies the addressable path of the + * database resource. + */ + @JsonProperty(value = "_self", access = JsonProperty.Access.WRITE_ONLY) + private String self; + + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the colls property: A system generated property that specified the addressable path of the collections + * resource. + * + * @return the colls value. + */ + public String colls() { + return this.colls; + } + + /** + * Get the users property: A system generated property that specifies the addressable path of the users resource. + * + * @return the users value. + */ + public String users() { + return this.users; + } + + /** + * Get the self property: A system generated property that specifies the addressable path of the database resource. + * + * @return the self value. + */ + public String self() { + return this.self; + } + + /** + * Get the rid property: A system generated property. A unique identifier. + * + * @return the rid value. + */ + public String rid() { + return this.rid; + } + + /** + * Get the ts property: A system generated property that denotes the last updated timestamp of the resource. + * + * @return the ts value. + */ + public Float ts() { + return this.ts; + } + + /** + * Get the etag property: A system generated property representing the resource etag required for optimistic + * concurrency control. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** {@inheritDoc} */ + @Override + public RestorableSqlDatabasePropertiesResourceDatabase withId(String id) { + super.withId(id); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabases.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabases.java new file mode 100644 index 0000000000000..864fbc18415ee --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabases.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of RestorableSqlDatabases. */ +public interface RestorableSqlDatabases { + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB SQL databases under the restorable account. + * This helps in scenario where database was accidentally deleted to get the deletion time. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the SQL database events and their properties. + */ + PagedIterable list(String location, String instanceId); + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB SQL databases under the restorable account. + * This helps in scenario where database was accidentally deleted to get the deletion time. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the SQL database events and their properties. + */ + PagedIterable list(String location, String instanceId, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabasesListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabasesListResult.java new file mode 100644 index 0000000000000..1f8c2ff613422 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabasesListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableSqlDatabaseGetResultInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the SQL database events and their properties. */ +@Immutable +public final class RestorableSqlDatabasesListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableSqlDatabasesListResult.class); + + /* + * List of SQL database events and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of SQL database events and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlResources.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlResources.java new file mode 100644 index 0000000000000..ccb4c3d34b5af --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlResources.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of RestorableSqlResources. */ +public interface RestorableSqlResources { + /** + * Return a list of database and container combo that exist on the account at the given timestamp and location. This + * helps in scenarios to validate what resources exist at given timestamp and location. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the restorable SQL resources. + */ + PagedIterable list(String location, String instanceId); + + /** + * Return a list of database and container combo that exist on the account at the given timestamp and location. This + * helps in scenarios to validate what resources exist at given timestamp and location. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restoreLocation The location where the restorable resources are located. + * @param restoreTimestampInUtc The timestamp when the restorable resources existed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the restorable SQL resources. + */ + PagedIterable list( + String location, String instanceId, String restoreLocation, String restoreTimestampInUtc, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlResourcesListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlResourcesListResult.java new file mode 100644 index 0000000000000..c37b8dbdf7944 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlResourcesListResult.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseRestoreResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the restorable SQL resources. */ +@Immutable +public final class RestorableSqlResourcesListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableSqlResourcesListResult.class); + + /* + * List of restorable SQL resources, including the database and collection + * names. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of restorable SQL resources, including the database and collection names. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestoreMode.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestoreMode.java new file mode 100644 index 0000000000000..011403d52a00d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestoreMode.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for RestoreMode. */ +public final class RestoreMode extends ExpandableStringEnum { + /** Static value PointInTime for RestoreMode. */ + public static final RestoreMode POINT_IN_TIME = fromString("PointInTime"); + + /** + * Creates or finds a RestoreMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding RestoreMode. + */ + @JsonCreator + public static RestoreMode fromString(String name) { + return fromString(name, RestoreMode.class); + } + + /** @return known RestoreMode values. */ + public static Collection values() { + return values(RestoreMode.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestoreParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestoreParameters.java new file mode 100644 index 0000000000000..664ade4161b90 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestoreParameters.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseRestoreResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Parameters to indicate the information about the restore. */ +@Fluent +public final class RestoreParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestoreParameters.class); + + /* + * Describes the mode of the restore. + */ + @JsonProperty(value = "restoreMode") + private RestoreMode restoreMode; + + /* + * The id of the restorable database account from which the restore has to + * be initiated. For example: + * /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName} + */ + @JsonProperty(value = "restoreSource") + private String restoreSource; + + /* + * Time to which the account has to be restored (ISO-8601 format). + */ + @JsonProperty(value = "restoreTimestampInUtc") + private OffsetDateTime restoreTimestampInUtc; + + /* + * List of specific databases available for restore. + */ + @JsonProperty(value = "databasesToRestore") + private List databasesToRestore; + + /** + * Get the restoreMode property: Describes the mode of the restore. + * + * @return the restoreMode value. + */ + public RestoreMode restoreMode() { + return this.restoreMode; + } + + /** + * Set the restoreMode property: Describes the mode of the restore. + * + * @param restoreMode the restoreMode value to set. + * @return the RestoreParameters object itself. + */ + public RestoreParameters withRestoreMode(RestoreMode restoreMode) { + this.restoreMode = restoreMode; + return this; + } + + /** + * Get the restoreSource property: The id of the restorable database account from which the restore has to be + * initiated. For example: + * /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName}. + * + * @return the restoreSource value. + */ + public String restoreSource() { + return this.restoreSource; + } + + /** + * Set the restoreSource property: The id of the restorable database account from which the restore has to be + * initiated. For example: + * /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName}. + * + * @param restoreSource the restoreSource value to set. + * @return the RestoreParameters object itself. + */ + public RestoreParameters withRestoreSource(String restoreSource) { + this.restoreSource = restoreSource; + return this; + } + + /** + * Get the restoreTimestampInUtc property: Time to which the account has to be restored (ISO-8601 format). + * + * @return the restoreTimestampInUtc value. + */ + public OffsetDateTime restoreTimestampInUtc() { + return this.restoreTimestampInUtc; + } + + /** + * Set the restoreTimestampInUtc property: Time to which the account has to be restored (ISO-8601 format). + * + * @param restoreTimestampInUtc the restoreTimestampInUtc value to set. + * @return the RestoreParameters object itself. + */ + public RestoreParameters withRestoreTimestampInUtc(OffsetDateTime restoreTimestampInUtc) { + this.restoreTimestampInUtc = restoreTimestampInUtc; + return this; + } + + /** + * Get the databasesToRestore property: List of specific databases available for restore. + * + * @return the databasesToRestore value. + */ + public List databasesToRestore() { + return this.databasesToRestore; + } + + /** + * Set the databasesToRestore property: List of specific databases available for restore. + * + * @param databasesToRestore the databasesToRestore value to set. + * @return the RestoreParameters object itself. + */ + public RestoreParameters withDatabasesToRestore(List databasesToRestore) { + this.databasesToRestore = databasesToRestore; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (databasesToRestore() != null) { + databasesToRestore().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RoleDefinitionType.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RoleDefinitionType.java new file mode 100644 index 0000000000000..6ccf0190121cb --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RoleDefinitionType.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for RoleDefinitionType. */ +public enum RoleDefinitionType { + /** Enum value BuiltInRole. */ + BUILT_IN_ROLE("BuiltInRole"), + + /** Enum value CustomRole. */ + CUSTOM_ROLE("CustomRole"); + + /** The actual serialized value for a RoleDefinitionType instance. */ + private final String value; + + RoleDefinitionType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a RoleDefinitionType instance. + * + * @param value the serialized value to parse. + * @return the parsed RoleDefinitionType object, or null if unable to parse. + */ + @JsonCreator + public static RoleDefinitionType fromString(String value) { + RoleDefinitionType[] items = RoleDefinitionType.values(); + for (RoleDefinitionType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServerVersion.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServerVersion.java new file mode 100644 index 0000000000000..0376f92582a09 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServerVersion.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ServerVersion. */ +public final class ServerVersion extends ExpandableStringEnum { + /** Static value 3.2 for ServerVersion. */ + public static final ServerVersion THREE_TWO = fromString("3.2"); + + /** Static value 3.6 for ServerVersion. */ + public static final ServerVersion THREE_SIX = fromString("3.6"); + + /** Static value 4.0 for ServerVersion. */ + public static final ServerVersion FOUR_ZERO = fromString("4.0"); + + /** + * Creates or finds a ServerVersion from its string representation. + * + * @param name a name to look for. + * @return the corresponding ServerVersion. + */ + @JsonCreator + public static ServerVersion fromString(String name) { + return fromString(name, ServerVersion.class); + } + + /** @return known ServerVersion values. */ + public static Collection values() { + return values(ServerVersion.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SpatialSpec.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SpatialSpec.java new file mode 100644 index 0000000000000..bb1cfd229b656 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SpatialSpec.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The SpatialSpec model. */ +@Fluent +public final class SpatialSpec { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SpatialSpec.class); + + /* + * The path for which the indexing behavior applies to. Index paths + * typically start with root and end with wildcard (/path/*) + */ + @JsonProperty(value = "path") + private String path; + + /* + * List of path's spatial type + */ + @JsonProperty(value = "types") + private List types; + + /** + * Get the path property: The path for which the indexing behavior applies to. Index paths typically start with root + * and end with wildcard (/path/*). + * + * @return the path value. + */ + public String path() { + return this.path; + } + + /** + * Set the path property: The path for which the indexing behavior applies to. Index paths typically start with root + * and end with wildcard (/path/*). + * + * @param path the path value to set. + * @return the SpatialSpec object itself. + */ + public SpatialSpec withPath(String path) { + this.path = path; + return this; + } + + /** + * Get the types property: List of path's spatial type. + * + * @return the types value. + */ + public List types() { + return this.types; + } + + /** + * Set the types property: List of path's spatial type. + * + * @param types the types value to set. + * @return the SpatialSpec object itself. + */ + public SpatialSpec withTypes(List types) { + this.types = types; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SpatialType.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SpatialType.java new file mode 100644 index 0000000000000..89cf5f5018fc3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SpatialType.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SpatialType. */ +public final class SpatialType extends ExpandableStringEnum { + /** Static value Point for SpatialType. */ + public static final SpatialType POINT = fromString("Point"); + + /** Static value LineString for SpatialType. */ + public static final SpatialType LINE_STRING = fromString("LineString"); + + /** Static value Polygon for SpatialType. */ + public static final SpatialType POLYGON = fromString("Polygon"); + + /** Static value MultiPolygon for SpatialType. */ + public static final SpatialType MULTI_POLYGON = fromString("MultiPolygon"); + + /** + * Creates or finds a SpatialType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SpatialType. + */ + @JsonCreator + public static SpatialType fromString(String name) { + return fromString(name, SpatialType.class); + } + + /** @return known SpatialType values. */ + public static Collection values() { + return values(SpatialType.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerCreateUpdateParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerCreateUpdateParameters.java new file mode 100644 index 0000000000000..ced39c5b8004e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerCreateUpdateParameters.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Parameters to create and update Cosmos DB container. */ +@JsonFlatten +@Fluent +public class SqlContainerCreateUpdateParameters extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlContainerCreateUpdateParameters.class); + + /* + * The standard JSON format of a container + */ + @JsonProperty(value = "properties.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 = "properties.options") + private CreateUpdateOptions options; + + /** + * Get the resource property: The standard JSON format of a container. + * + * @return the resource value. + */ + public SqlContainerResource resource() { + return this.resource; + } + + /** + * Set the resource property: The standard JSON format of a container. + * + * @param resource the resource value to set. + * @return the SqlContainerCreateUpdateParameters object itself. + */ + public SqlContainerCreateUpdateParameters 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 SqlContainerCreateUpdateParameters object itself. + */ + public SqlContainerCreateUpdateParameters withOptions(CreateUpdateOptions options) { + this.options = options; + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlContainerCreateUpdateParameters withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlContainerCreateUpdateParameters withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (resource() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property resource in model SqlContainerCreateUpdateParameters")); + } else { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerGetPropertiesOptions.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerGetPropertiesOptions.java new file mode 100644 index 0000000000000..0ea1a5ceffafd --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerGetPropertiesOptions.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** The SqlContainerGetPropertiesOptions model. */ +@Fluent +public final class SqlContainerGetPropertiesOptions extends OptionsResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlContainerGetPropertiesOptions.class); + + /** {@inheritDoc} */ + @Override + public SqlContainerGetPropertiesOptions withThroughput(Integer throughput) { + super.withThroughput(throughput); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlContainerGetPropertiesOptions withAutoscaleSettings(AutoscaleSettings autoscaleSettings) { + super.withAutoscaleSettings(autoscaleSettings); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerGetPropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerGetPropertiesResource.java new file mode 100644 index 0000000000000..8b4aa7dd18169 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerGetPropertiesResource.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The SqlContainerGetPropertiesResource model. */ +@Fluent +public final class SqlContainerGetPropertiesResource extends SqlContainerResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlContainerGetPropertiesResource.class); + + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the rid property: A system generated property. A unique identifier. + * + * @return the rid value. + */ + public String rid() { + return this.rid; + } + + /** + * Get the ts property: A system generated property that denotes the last updated timestamp of the resource. + * + * @return the ts value. + */ + public Float ts() { + return this.ts; + } + + /** + * Get the etag property: A system generated property representing the resource etag required for optimistic + * concurrency control. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** {@inheritDoc} */ + @Override + public SqlContainerGetPropertiesResource withId(String id) { + super.withId(id); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlContainerGetPropertiesResource withIndexingPolicy(IndexingPolicy indexingPolicy) { + super.withIndexingPolicy(indexingPolicy); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlContainerGetPropertiesResource withPartitionKey(ContainerPartitionKey partitionKey) { + super.withPartitionKey(partitionKey); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlContainerGetPropertiesResource withDefaultTtl(Integer defaultTtl) { + super.withDefaultTtl(defaultTtl); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlContainerGetPropertiesResource withUniqueKeyPolicy(UniqueKeyPolicy uniqueKeyPolicy) { + super.withUniqueKeyPolicy(uniqueKeyPolicy); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlContainerGetPropertiesResource withConflictResolutionPolicy( + ConflictResolutionPolicy conflictResolutionPolicy) { + super.withConflictResolutionPolicy(conflictResolutionPolicy); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlContainerGetPropertiesResource withAnalyticalStorageTtl(Long analyticalStorageTtl) { + super.withAnalyticalStorageTtl(analyticalStorageTtl); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerGetResults.java new file mode 100644 index 0000000000000..0efef4f86a461 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerGetResults.java @@ -0,0 +1,276 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.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 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..f8d612e8d32de --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlContainerGetResultsInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the containers and their properties. */ +@Immutable +public final class SqlContainerListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlContainerListResult.class); + + /* + * List of containers and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of containers and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerResource.java new file mode 100644 index 0000000000000..6773dd72cefee --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerResource.java @@ -0,0 +1,233 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB SQL container resource object. */ +@Fluent +public class SqlContainerResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlContainerResource.class); + + /* + * Name of the Cosmos DB SQL container + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * The configuration of the indexing policy. By default, the indexing is + * automatic for all document paths within the container + */ + @JsonProperty(value = "indexingPolicy") + private IndexingPolicy indexingPolicy; + + /* + * The configuration of the partition key to be used for partitioning data + * into multiple partitions + */ + @JsonProperty(value = "partitionKey") + private ContainerPartitionKey partitionKey; + + /* + * Default time to live + */ + @JsonProperty(value = "defaultTtl") + private Integer defaultTtl; + + /* + * The unique key policy configuration for specifying uniqueness + * constraints on documents in the collection in the Azure Cosmos DB + * service. + */ + @JsonProperty(value = "uniqueKeyPolicy") + private UniqueKeyPolicy uniqueKeyPolicy; + + /* + * The conflict resolution policy for the container. + */ + @JsonProperty(value = "conflictResolutionPolicy") + private ConflictResolutionPolicy conflictResolutionPolicy; + + /* + * Analytical TTL. + */ + @JsonProperty(value = "analyticalStorageTtl") + private Long analyticalStorageTtl; + + /** + * Get the id property: Name of the Cosmos DB SQL container. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Name of the Cosmos DB SQL container. + * + * @param id the id value to set. + * @return the SqlContainerResource object itself. + */ + public SqlContainerResource withId(String id) { + this.id = id; + return this; + } + + /** + * Get the indexingPolicy property: The configuration of the indexing policy. By default, the indexing is automatic + * for all document paths within the container. + * + * @return the indexingPolicy value. + */ + public IndexingPolicy indexingPolicy() { + return this.indexingPolicy; + } + + /** + * Set the indexingPolicy property: The configuration of the indexing policy. By default, the indexing is automatic + * for all document paths within the container. + * + * @param indexingPolicy the indexingPolicy value to set. + * @return the SqlContainerResource object itself. + */ + public SqlContainerResource withIndexingPolicy(IndexingPolicy indexingPolicy) { + this.indexingPolicy = indexingPolicy; + return this; + } + + /** + * Get the partitionKey property: The configuration of the partition key to be used for partitioning data into + * multiple partitions. + * + * @return the partitionKey value. + */ + public ContainerPartitionKey partitionKey() { + return this.partitionKey; + } + + /** + * Set the partitionKey property: The configuration of the partition key to be used for partitioning data into + * multiple partitions. + * + * @param partitionKey the partitionKey value to set. + * @return the SqlContainerResource object itself. + */ + public SqlContainerResource withPartitionKey(ContainerPartitionKey partitionKey) { + this.partitionKey = partitionKey; + return this; + } + + /** + * Get the defaultTtl property: Default time to live. + * + * @return the defaultTtl value. + */ + public Integer defaultTtl() { + return this.defaultTtl; + } + + /** + * Set the defaultTtl property: Default time to live. + * + * @param defaultTtl the defaultTtl value to set. + * @return the SqlContainerResource object itself. + */ + public SqlContainerResource withDefaultTtl(Integer defaultTtl) { + this.defaultTtl = defaultTtl; + return this; + } + + /** + * Get the uniqueKeyPolicy property: The unique key policy configuration for specifying uniqueness constraints on + * documents in the collection in the Azure Cosmos DB service. + * + * @return the uniqueKeyPolicy value. + */ + public UniqueKeyPolicy uniqueKeyPolicy() { + return this.uniqueKeyPolicy; + } + + /** + * Set the uniqueKeyPolicy property: The unique key policy configuration for specifying uniqueness constraints on + * documents in the collection in the Azure Cosmos DB service. + * + * @param uniqueKeyPolicy the uniqueKeyPolicy value to set. + * @return the SqlContainerResource object itself. + */ + public SqlContainerResource withUniqueKeyPolicy(UniqueKeyPolicy uniqueKeyPolicy) { + this.uniqueKeyPolicy = uniqueKeyPolicy; + return this; + } + + /** + * Get the conflictResolutionPolicy property: The conflict resolution policy for the container. + * + * @return the conflictResolutionPolicy value. + */ + public ConflictResolutionPolicy conflictResolutionPolicy() { + return this.conflictResolutionPolicy; + } + + /** + * Set the conflictResolutionPolicy property: The conflict resolution policy for the container. + * + * @param conflictResolutionPolicy the conflictResolutionPolicy value to set. + * @return the SqlContainerResource object itself. + */ + public SqlContainerResource withConflictResolutionPolicy(ConflictResolutionPolicy conflictResolutionPolicy) { + this.conflictResolutionPolicy = conflictResolutionPolicy; + return this; + } + + /** + * Get the analyticalStorageTtl property: Analytical TTL. + * + * @return the analyticalStorageTtl value. + */ + public Long analyticalStorageTtl() { + return this.analyticalStorageTtl; + } + + /** + * Set the analyticalStorageTtl property: Analytical TTL. + * + * @param analyticalStorageTtl the analyticalStorageTtl value to set. + * @return the SqlContainerResource object itself. + */ + public SqlContainerResource withAnalyticalStorageTtl(Long analyticalStorageTtl) { + this.analyticalStorageTtl = analyticalStorageTtl; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model SqlContainerResource")); + } + if (indexingPolicy() != null) { + indexingPolicy().validate(); + } + if (partitionKey() != null) { + partitionKey().validate(); + } + if (uniqueKeyPolicy() != null) { + uniqueKeyPolicy().validate(); + } + if (conflictResolutionPolicy() != null) { + conflictResolutionPolicy().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseCreateUpdateParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseCreateUpdateParameters.java new file mode 100644 index 0000000000000..d5e733829cd84 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseCreateUpdateParameters.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Parameters to create and update Cosmos DB SQL database. */ +@JsonFlatten +@Fluent +public class SqlDatabaseCreateUpdateParameters extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlDatabaseCreateUpdateParameters.class); + + /* + * The standard JSON format of a SQL database + */ + @JsonProperty(value = "properties.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 = "properties.options") + private CreateUpdateOptions options; + + /** + * Get the resource property: The standard JSON format of a SQL database. + * + * @return the resource value. + */ + public SqlDatabaseResource resource() { + return this.resource; + } + + /** + * Set the resource property: The standard JSON format of a SQL database. + * + * @param resource the resource value to set. + * @return the SqlDatabaseCreateUpdateParameters object itself. + */ + public SqlDatabaseCreateUpdateParameters 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 SqlDatabaseCreateUpdateParameters object itself. + */ + public SqlDatabaseCreateUpdateParameters withOptions(CreateUpdateOptions options) { + this.options = options; + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlDatabaseCreateUpdateParameters withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlDatabaseCreateUpdateParameters withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (resource() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property resource in model SqlDatabaseCreateUpdateParameters")); + } else { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseGetPropertiesOptions.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseGetPropertiesOptions.java new file mode 100644 index 0000000000000..7e890f0515fde --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseGetPropertiesOptions.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** The SqlDatabaseGetPropertiesOptions model. */ +@Fluent +public final class SqlDatabaseGetPropertiesOptions extends OptionsResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlDatabaseGetPropertiesOptions.class); + + /** {@inheritDoc} */ + @Override + public SqlDatabaseGetPropertiesOptions withThroughput(Integer throughput) { + super.withThroughput(throughput); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlDatabaseGetPropertiesOptions withAutoscaleSettings(AutoscaleSettings autoscaleSettings) { + super.withAutoscaleSettings(autoscaleSettings); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseGetPropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseGetPropertiesResource.java new file mode 100644 index 0000000000000..407f620fcceb0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseGetPropertiesResource.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The SqlDatabaseGetPropertiesResource model. */ +@Fluent +public final class SqlDatabaseGetPropertiesResource extends SqlDatabaseResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlDatabaseGetPropertiesResource.class); + + /* + * A system generated property that specified the addressable path of the + * collections resource. + */ + @JsonProperty(value = "_colls") + private String colls; + + /* + * A system generated property that specifies the addressable path of the + * users resource. + */ + @JsonProperty(value = "_users") + private String users; + + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the colls property: A system generated property that specified the addressable path of the collections + * resource. + * + * @return the colls value. + */ + public String colls() { + return this.colls; + } + + /** + * Set the colls property: A system generated property that specified the addressable path of the collections + * resource. + * + * @param colls the colls value to set. + * @return the SqlDatabaseGetPropertiesResource object itself. + */ + public SqlDatabaseGetPropertiesResource withColls(String colls) { + this.colls = colls; + return this; + } + + /** + * Get the users property: A system generated property that specifies the addressable path of the users resource. + * + * @return the users value. + */ + public String users() { + return this.users; + } + + /** + * Set the users property: A system generated property that specifies the addressable path of the users resource. + * + * @param users the users value to set. + * @return the SqlDatabaseGetPropertiesResource object itself. + */ + public SqlDatabaseGetPropertiesResource withUsers(String users) { + this.users = users; + return this; + } + + /** + * Get the rid property: A system generated property. A unique identifier. + * + * @return the rid value. + */ + public String rid() { + return this.rid; + } + + /** + * Get the ts property: A system generated property that denotes the last updated timestamp of the resource. + * + * @return the ts value. + */ + public Float ts() { + return this.ts; + } + + /** + * Get the etag property: A system generated property representing the resource etag required for optimistic + * concurrency control. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** {@inheritDoc} */ + @Override + public SqlDatabaseGetPropertiesResource withId(String id) { + super.withId(id); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseGetResults.java new file mode 100644 index 0000000000000..51e838bbddb43 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseGetResults.java @@ -0,0 +1,252 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.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 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..1c23a3e95608d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlDatabaseGetResultsInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the SQL databases and their properties. */ +@Immutable +public final class SqlDatabaseListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlDatabaseListResult.class); + + /* + * List of SQL databases and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of SQL databases and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseResource.java new file mode 100644 index 0000000000000..9f4a67e381a09 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseResource.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB SQL database resource object. */ +@Fluent +public class SqlDatabaseResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlDatabaseResource.class); + + /* + * Name of the Cosmos DB SQL database + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * Get the id property: Name of the Cosmos DB SQL database. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Name of the Cosmos DB SQL database. + * + * @param id the id value to set. + * @return the SqlDatabaseResource object itself. + */ + public SqlDatabaseResource withId(String id) { + this.id = id; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model SqlDatabaseResource")); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlResources.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlResources.java new file mode 100644 index 0000000000000..1046b131439af --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlResources.java @@ -0,0 +1,1342 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of SqlResources. */ +public interface SqlResources { + /** + * Lists the SQL databases under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the SQL databases and their properties. + */ + PagedIterable listSqlDatabases(String resourceGroupName, String accountName); + + /** + * Lists the SQL databases under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the SQL databases and their properties. + */ + PagedIterable listSqlDatabases( + String resourceGroupName, String accountName, Context context); + + /** + * Gets the SQL database under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL database under an existing Azure Cosmos DB database account with the provided name. + */ + SqlDatabaseGetResults getSqlDatabase(String resourceGroupName, String accountName, String databaseName); + + /** + * Gets the SQL database under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL database under an existing Azure Cosmos DB database account with the provided name. + */ + Response getSqlDatabaseWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlDatabase(String resourceGroupName, String accountName, String databaseName); + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlDatabase(String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Gets the RUs per second of the SQL database under an existing Azure Cosmos DB database account with the provided + * name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the SQL database under an existing Azure Cosmos DB database account with the + * provided name. + */ + ThroughputSettingsGetResults getSqlDatabaseThroughput( + String resourceGroupName, String accountName, String databaseName); + + /** + * Gets the RUs per second of the SQL database under an existing Azure Cosmos DB database account with the provided + * name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the SQL database under an existing Azure Cosmos DB database account with the + * provided name. + */ + Response getSqlDatabaseThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Update RUs per second of an Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults updateSqlDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Update RUs per second of an Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults updateSqlDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * Migrate an Azure Cosmos DB SQL database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateSqlDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName); + + /** + * Migrate an Azure Cosmos DB SQL database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateSqlDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Migrate an Azure Cosmos DB SQL database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateSqlDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName); + + /** + * Migrate an Azure Cosmos DB SQL database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateSqlDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Lists the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the containers and their properties. + */ + PagedIterable listSqlContainers( + String resourceGroupName, String accountName, String databaseName); + + /** + * Lists the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the containers and their properties. + */ + PagedIterable listSqlContainers( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Gets the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL container under an existing Azure Cosmos DB database account. + */ + SqlContainerGetResults getSqlContainer( + String resourceGroupName, String accountName, String databaseName, String containerName); + + /** + * Gets the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL container under an existing Azure Cosmos DB database account. + */ + Response getSqlContainerWithResponse( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlContainer(String resourceGroupName, String accountName, String databaseName, String containerName); + + /** + * Deletes an existing Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlContainer( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context); + + /** + * Gets the RUs per second of the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the SQL container under an existing Azure Cosmos DB database account. + */ + ThroughputSettingsGetResults getSqlContainerThroughput( + String resourceGroupName, String accountName, String databaseName, String containerName); + + /** + * Gets the RUs per second of the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the SQL container under an existing Azure Cosmos DB database account. + */ + Response getSqlContainerThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context); + + /** + * Update RUs per second of an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL container. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults updateSqlContainerThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Update RUs per second of an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL container. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults updateSqlContainerThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * Migrate an Azure Cosmos DB SQL container from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateSqlContainerToAutoscale( + String resourceGroupName, String accountName, String databaseName, String containerName); + + /** + * Migrate an Azure Cosmos DB SQL container from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateSqlContainerToAutoscale( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context); + + /** + * Migrate an Azure Cosmos DB SQL container from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateSqlContainerToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String containerName); + + /** + * Migrate an Azure Cosmos DB SQL container from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateSqlContainerToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context); + + /** + * Lists the SQL storedProcedure under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the storedProcedures and their properties. + */ + PagedIterable listSqlStoredProcedures( + String resourceGroupName, String accountName, String databaseName, String containerName); + + /** + * Lists the SQL storedProcedure under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the storedProcedures and their properties. + */ + PagedIterable listSqlStoredProcedures( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context); + + /** + * Gets the SQL storedProcedure under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL storedProcedure under an existing Azure Cosmos DB database account. + */ + SqlStoredProcedureGetResults getSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName); + + /** + * Gets the SQL storedProcedure under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL storedProcedure under an existing Azure Cosmos DB database account. + */ + Response getSqlStoredProcedureWithResponse( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName); + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + Context context); + + /** + * Lists the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the userDefinedFunctions and their properties. + */ + PagedIterable listSqlUserDefinedFunctions( + String resourceGroupName, String accountName, String databaseName, String containerName); + + /** + * Lists the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the userDefinedFunctions and their properties. + */ + PagedIterable listSqlUserDefinedFunctions( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context); + + /** + * Gets the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + */ + SqlUserDefinedFunctionGetResults getSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName); + + /** + * Gets the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + */ + Response getSqlUserDefinedFunctionWithResponse( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName); + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + Context context); + + /** + * Lists the SQL trigger under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the triggers and their properties. + */ + PagedIterable listSqlTriggers( + String resourceGroupName, String accountName, String databaseName, String containerName); + + /** + * Lists the SQL trigger under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the triggers and their properties. + */ + PagedIterable listSqlTriggers( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context); + + /** + * Gets the SQL trigger under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL trigger under an existing Azure Cosmos DB database account. + */ + SqlTriggerGetResults getSqlTrigger( + String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName); + + /** + * Gets the SQL trigger under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL trigger under an existing Azure Cosmos DB database account. + */ + Response getSqlTriggerWithResponse( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlTrigger( + String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName); + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlTrigger( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + Context context); + + /** + * Retrieves the properties of an existing Azure Cosmos DB SQL Role Definition with the given Id. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + SqlRoleDefinitionGetResults getSqlRoleDefinition( + String roleDefinitionId, String resourceGroupName, String accountName); + + /** + * Retrieves the properties of an existing Azure Cosmos DB SQL Role Definition with the given Id. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + Response getSqlRoleDefinitionWithResponse( + String roleDefinitionId, String resourceGroupName, String accountName, Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlRoleDefinition(String roleDefinitionId, String resourceGroupName, String accountName); + + /** + * Deletes an existing Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlRoleDefinition( + String roleDefinitionId, String resourceGroupName, String accountName, Context context); + + /** + * Retrieves the list of all Azure Cosmos DB SQL Role Definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the relevant Role Definitions. + */ + PagedIterable listSqlRoleDefinitions(String resourceGroupName, String accountName); + + /** + * Retrieves the list of all Azure Cosmos DB SQL Role Definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the relevant Role Definitions. + */ + PagedIterable listSqlRoleDefinitions( + String resourceGroupName, String accountName, Context context); + + /** + * Retrieves the properties of an existing Azure Cosmos DB SQL Role Assignment with the given Id. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + SqlRoleAssignmentGetResults getSqlRoleAssignment( + String roleAssignmentId, String resourceGroupName, String accountName); + + /** + * Retrieves the properties of an existing Azure Cosmos DB SQL Role Assignment with the given Id. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + Response getSqlRoleAssignmentWithResponse( + String roleAssignmentId, String resourceGroupName, String accountName, Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlRoleAssignment(String roleAssignmentId, String resourceGroupName, String accountName); + + /** + * Deletes an existing Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlRoleAssignment( + String roleAssignmentId, String resourceGroupName, String accountName, Context context); + + /** + * Retrieves the list of all Azure Cosmos DB SQL Role Assignments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the relevant Role Assignments. + */ + PagedIterable listSqlRoleAssignments(String resourceGroupName, String accountName); + + /** + * Retrieves the list of all Azure Cosmos DB SQL Role Assignments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the relevant Role Assignments. + */ + PagedIterable listSqlRoleAssignments( + String resourceGroupName, String accountName, Context context); + + /** + * Retrieves continuous backup information for a container resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param location The name of the continuous backup restore location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup information of a resource. + */ + BackupInformation retrieveContinuousBackupInformation( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ContinuousBackupRestoreLocation location); + + /** + * Retrieves continuous backup information for a container resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param location The name of the continuous backup restore location. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup information of a resource. + */ + BackupInformation retrieveContinuousBackupInformation( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ContinuousBackupRestoreLocation location, + Context context); + + /** + * Gets the SQL database under an existing Azure Cosmos DB database account with the provided name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL database under an existing Azure Cosmos DB database account with the provided name. + */ + SqlDatabaseGetResults getSqlDatabaseById(String id); + + /** + * Gets the SQL database under an existing Azure Cosmos DB database account with the provided name. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL database under an existing Azure Cosmos DB database account with the provided name. + */ + Response getSqlDatabaseByIdWithResponse(String id, Context context); + + /** + * Gets the SQL container under an existing Azure Cosmos DB database account. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL container under an existing Azure Cosmos DB database account. + */ + SqlContainerGetResults getSqlContainerById(String id); + + /** + * Gets the SQL container under an existing Azure Cosmos DB database account. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL container under an existing Azure Cosmos DB database account. + */ + Response getSqlContainerByIdWithResponse(String id, Context context); + + /** + * Gets the SQL storedProcedure under an existing Azure Cosmos DB database account. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL storedProcedure under an existing Azure Cosmos DB database account. + */ + SqlStoredProcedureGetResults getSqlStoredProcedureById(String id); + + /** + * Gets the SQL storedProcedure under an existing Azure Cosmos DB database account. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL storedProcedure under an existing Azure Cosmos DB database account. + */ + Response getSqlStoredProcedureByIdWithResponse(String id, Context context); + + /** + * Gets the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + */ + SqlUserDefinedFunctionGetResults getSqlUserDefinedFunctionById(String id); + + /** + * Gets the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + */ + Response getSqlUserDefinedFunctionByIdWithResponse(String id, Context context); + + /** + * Gets the SQL trigger under an existing Azure Cosmos DB database account. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL trigger under an existing Azure Cosmos DB database account. + */ + SqlTriggerGetResults getSqlTriggerById(String id); + + /** + * Gets the SQL trigger under an existing Azure Cosmos DB database account. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL trigger under an existing Azure Cosmos DB database account. + */ + Response getSqlTriggerByIdWithResponse(String id, Context context); + + /** + * Retrieves the properties of an existing Azure Cosmos DB SQL Role Definition with the given Id. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + SqlRoleDefinitionGetResults getSqlRoleDefinitionById(String id); + + /** + * Retrieves the properties of an existing Azure Cosmos DB SQL Role Definition with the given Id. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + Response getSqlRoleDefinitionByIdWithResponse(String id, Context context); + + /** + * Retrieves the properties of an existing Azure Cosmos DB SQL Role Assignment with the given Id. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + SqlRoleAssignmentGetResults getSqlRoleAssignmentById(String id); + + /** + * Retrieves the properties of an existing Azure Cosmos DB SQL Role Assignment with the given Id. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + Response getSqlRoleAssignmentByIdWithResponse(String id, Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlDatabaseById(String id); + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlDatabaseByIdWithResponse(String id, Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL container. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlContainerById(String id); + + /** + * Deletes an existing Azure Cosmos DB SQL container. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlContainerByIdWithResponse(String id, Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlStoredProcedureById(String id); + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlStoredProcedureByIdWithResponse(String id, Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlUserDefinedFunctionById(String id); + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlUserDefinedFunctionByIdWithResponse(String id, Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlTriggerById(String id); + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlTriggerByIdWithResponse(String id, Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL Role Definition. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlRoleDefinitionById(String id); + + /** + * Deletes an existing Azure Cosmos DB SQL Role Definition. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlRoleDefinitionByIdWithResponse(String id, Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL Role Assignment. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlRoleAssignmentById(String id); + + /** + * Deletes an existing Azure Cosmos DB SQL Role Assignment. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlRoleAssignmentByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new SqlDatabaseGetResults resource. + * + * @param name resource name. + * @return the first stage of the new SqlDatabaseGetResults definition. + */ + SqlDatabaseGetResults.DefinitionStages.Blank defineUpdateSqlDatabase(String name); + + /** + * Begins definition for a new SqlContainerGetResults resource. + * + * @param name resource name. + * @return the first stage of the new SqlContainerGetResults definition. + */ + SqlContainerGetResults.DefinitionStages.Blank defineUpdateSqlContainer(String name); + + /** + * Begins definition for a new SqlStoredProcedureGetResults resource. + * + * @param name resource name. + * @return the first stage of the new SqlStoredProcedureGetResults definition. + */ + SqlStoredProcedureGetResults.DefinitionStages.Blank defineUpdateSqlStoredProcedure(String name); + + /** + * Begins definition for a new SqlUserDefinedFunctionGetResults resource. + * + * @param name resource name. + * @return the first stage of the new SqlUserDefinedFunctionGetResults definition. + */ + SqlUserDefinedFunctionGetResults.DefinitionStages.Blank defineUpdateSqlUserDefinedFunction(String name); + + /** + * Begins definition for a new SqlTriggerGetResults resource. + * + * @param name resource name. + * @return the first stage of the new SqlTriggerGetResults definition. + */ + SqlTriggerGetResults.DefinitionStages.Blank defineUpdateSqlTrigger(String name); + + /** + * Begins definition for a new SqlRoleDefinitionGetResults resource. + * + * @param name resource name. + * @return the first stage of the new SqlRoleDefinitionGetResults definition. + */ + SqlRoleDefinitionGetResults.DefinitionStages.Blank defineUpdateSqlRoleDefinition(String name); + + /** + * Begins definition for a new SqlRoleAssignmentGetResults resource. + * + * @param name resource name. + * @return the first stage of the new SqlRoleAssignmentGetResults definition. + */ + SqlRoleAssignmentGetResults.DefinitionStages.Blank defineUpdateSqlRoleAssignment(String name); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlRoleAssignmentCreateUpdateParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlRoleAssignmentCreateUpdateParameters.java new file mode 100644 index 0000000000000..844a12f3d8bd1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlRoleAssignmentCreateUpdateParameters.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Parameters to create and update an Azure Cosmos DB SQL Role Assignment. */ +@JsonFlatten +@Fluent +public class SqlRoleAssignmentCreateUpdateParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlRoleAssignmentCreateUpdateParameters.class); + + /* + * The unique identifier for the associated Role Definition. + */ + @JsonProperty(value = "properties.roleDefinitionId") + private String roleDefinitionId; + + /* + * The data plane resource path for which access is being granted through + * this Role Assignment. + */ + @JsonProperty(value = "properties.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 = "properties.principalId") + private String principalId; + + /** + * Get the roleDefinitionId property: The unique identifier for the associated Role Definition. + * + * @return the roleDefinitionId value. + */ + public String roleDefinitionId() { + return this.roleDefinitionId; + } + + /** + * Set the roleDefinitionId property: The unique identifier for the associated Role Definition. + * + * @param roleDefinitionId the roleDefinitionId value to set. + * @return the SqlRoleAssignmentCreateUpdateParameters object itself. + */ + public SqlRoleAssignmentCreateUpdateParameters 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 SqlRoleAssignmentCreateUpdateParameters object itself. + */ + public SqlRoleAssignmentCreateUpdateParameters 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 SqlRoleAssignmentCreateUpdateParameters object itself. + */ + public SqlRoleAssignmentCreateUpdateParameters 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/models/SqlRoleAssignmentGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlRoleAssignmentGetResults.java new file mode 100644 index 0000000000000..9434a25a94ed9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlRoleAssignmentGetResults.java @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlRoleAssignmentGetResultsInner; + +/** An immutable client-side representation of SqlRoleAssignmentGetResults. */ +public interface SqlRoleAssignmentGetResults { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the roleDefinitionId property: The unique identifier for the associated Role Definition. + * + * @return the roleDefinitionId value. + */ + String roleDefinitionId(); + + /** + * Gets the scope property: The data plane resource path for which access is being granted through this Role + * Assignment. + * + * @return the scope value. + */ + String scope(); + + /** + * Gets the principalId property: The unique identifier for the associated AAD principal in the AAD graph to which + * access is being granted through this Role Assignment. Tenant ID for the principal is inferred using the tenant + * associated with the subscription. + * + * @return the principalId value. + */ + String principalId(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.SqlRoleAssignmentGetResultsInner object. + * + * @return the inner object. + */ + SqlRoleAssignmentGetResultsInner innerModel(); + + /** The entirety of the SqlRoleAssignmentGetResults definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The SqlRoleAssignmentGetResults definition stages. */ + interface DefinitionStages { + /** The first stage of the SqlRoleAssignmentGetResults definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the SqlRoleAssignmentGetResults definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, accountName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @return the next definition stage. + */ + WithCreate withExistingDatabaseAccount(String resourceGroupName, String accountName); + } + /** + * The stage of the SqlRoleAssignmentGetResults definition which contains all the minimum required properties + * for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithRoleDefinitionId, + DefinitionStages.WithScope, + DefinitionStages.WithPrincipalId { + /** + * Executes the create request. + * + * @return the created resource. + */ + SqlRoleAssignmentGetResults create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SqlRoleAssignmentGetResults create(Context context); + } + /** The stage of the SqlRoleAssignmentGetResults definition allowing to specify roleDefinitionId. */ + interface WithRoleDefinitionId { + /** + * Specifies the roleDefinitionId property: The unique identifier for the associated Role Definition.. + * + * @param roleDefinitionId The unique identifier for the associated Role Definition. + * @return the next definition stage. + */ + WithCreate withRoleDefinitionId(String roleDefinitionId); + } + /** The stage of the SqlRoleAssignmentGetResults definition allowing to specify scope. */ + interface WithScope { + /** + * Specifies the scope property: The data plane resource path for which access is being granted through this + * Role Assignment.. + * + * @param scope The data plane resource path for which access is being granted through this Role Assignment. + * @return the next definition stage. + */ + WithCreate withScope(String scope); + } + /** The stage of the SqlRoleAssignmentGetResults definition allowing to specify principalId. */ + interface WithPrincipalId { + /** + * Specifies the principalId property: The unique identifier for the associated AAD principal in the AAD + * graph to which access is being granted through this Role Assignment. Tenant ID for the principal is + * inferred using the tenant associated with the subscription.. + * + * @param principalId The unique identifier for the associated AAD principal in the AAD graph to which + * access is being granted through this Role Assignment. Tenant ID for the principal is inferred using + * the tenant associated with the subscription. + * @return the next definition stage. + */ + WithCreate withPrincipalId(String principalId); + } + } + /** + * Begins update for the SqlRoleAssignmentGetResults resource. + * + * @return the stage of resource update. + */ + SqlRoleAssignmentGetResults.Update update(); + + /** The template for SqlRoleAssignmentGetResults update. */ + interface Update extends UpdateStages.WithRoleDefinitionId, UpdateStages.WithScope, UpdateStages.WithPrincipalId { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SqlRoleAssignmentGetResults apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SqlRoleAssignmentGetResults apply(Context context); + } + /** The SqlRoleAssignmentGetResults update stages. */ + interface UpdateStages { + /** The stage of the SqlRoleAssignmentGetResults update allowing to specify roleDefinitionId. */ + interface WithRoleDefinitionId { + /** + * Specifies the roleDefinitionId property: The unique identifier for the associated Role Definition.. + * + * @param roleDefinitionId The unique identifier for the associated Role Definition. + * @return the next definition stage. + */ + Update withRoleDefinitionId(String roleDefinitionId); + } + /** The stage of the SqlRoleAssignmentGetResults update allowing to specify scope. */ + interface WithScope { + /** + * Specifies the scope property: The data plane resource path for which access is being granted through this + * Role Assignment.. + * + * @param scope The data plane resource path for which access is being granted through this Role Assignment. + * @return the next definition stage. + */ + Update withScope(String scope); + } + /** The stage of the SqlRoleAssignmentGetResults update allowing to specify principalId. */ + interface WithPrincipalId { + /** + * Specifies the principalId property: The unique identifier for the associated AAD principal in the AAD + * graph to which access is being granted through this Role Assignment. Tenant ID for the principal is + * inferred using the tenant associated with the subscription.. + * + * @param principalId The unique identifier for the associated AAD principal in the AAD graph to which + * access is being granted through this Role Assignment. Tenant ID for the principal is inferred using + * the tenant associated with the subscription. + * @return the next definition stage. + */ + Update withPrincipalId(String principalId); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SqlRoleAssignmentGetResults refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SqlRoleAssignmentGetResults refresh(Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlRoleAssignmentListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlRoleAssignmentListResult.java new file mode 100644 index 0000000000000..522697e5354f4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlRoleAssignmentListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlRoleAssignmentGetResultsInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The relevant Role Assignments. */ +@Immutable +public final class SqlRoleAssignmentListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlRoleAssignmentListResult.class); + + /* + * List of Role Assignments and their properties + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of Role Assignments and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlRoleDefinitionCreateUpdateParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlRoleDefinitionCreateUpdateParameters.java new file mode 100644 index 0000000000000..efcf3397222e8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlRoleDefinitionCreateUpdateParameters.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Parameters to create and update an Azure Cosmos DB SQL Role Definition. */ +@JsonFlatten +@Fluent +public class SqlRoleDefinitionCreateUpdateParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlRoleDefinitionCreateUpdateParameters.class); + + /* + * A user-friendly name for the Role Definition. Must be unique for the + * database account. + */ + @JsonProperty(value = "properties.roleName") + private String roleName; + + /* + * Indicates whether the Role Definition was built-in or user created. + */ + @JsonProperty(value = "properties.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 = "properties.assignableScopes") + private List assignableScopes; + + /* + * The set of operations allowed through this Role Definition. + */ + @JsonProperty(value = "properties.permissions") + private List permissions; + + /** + * Get the roleName property: A user-friendly name for the Role Definition. Must be unique for the database account. + * + * @return the roleName value. + */ + public String roleName() { + return this.roleName; + } + + /** + * Set the roleName property: A user-friendly name for the Role Definition. Must be unique for the database account. + * + * @param roleName the roleName value to set. + * @return the SqlRoleDefinitionCreateUpdateParameters object itself. + */ + public SqlRoleDefinitionCreateUpdateParameters 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 SqlRoleDefinitionCreateUpdateParameters object itself. + */ + public SqlRoleDefinitionCreateUpdateParameters 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 SqlRoleDefinitionCreateUpdateParameters object itself. + */ + public SqlRoleDefinitionCreateUpdateParameters 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 SqlRoleDefinitionCreateUpdateParameters object itself. + */ + public SqlRoleDefinitionCreateUpdateParameters 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/models/SqlRoleDefinitionGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlRoleDefinitionGetResults.java new file mode 100644 index 0000000000000..2cbe897df257d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlRoleDefinitionGetResults.java @@ -0,0 +1,262 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlRoleDefinitionGetResultsInner; +import java.util.List; + +/** An immutable client-side representation of SqlRoleDefinitionGetResults. */ +public interface SqlRoleDefinitionGetResults { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the roleName property: A user-friendly name for the Role Definition. Must be unique for the database + * account. + * + * @return the roleName value. + */ + String roleName(); + + /** + * Gets the typePropertiesType property: Indicates whether the Role Definition was built-in or user created. + * + * @return the typePropertiesType value. + */ + RoleDefinitionType typePropertiesType(); + + /** + * Gets the assignableScopes property: A set of fully qualified Scopes at or below which Role Assignments may be + * created using this Role Definition. This will allow application of this Role Definition on the entire database + * account or any underlying Database / Collection. Must have at least one element. Scopes higher than Database + * account are not enforceable as assignable Scopes. Note that resources referenced in assignable Scopes need not + * exist. + * + * @return the assignableScopes value. + */ + List assignableScopes(); + + /** + * Gets the permissions property: The set of operations allowed through this Role Definition. + * + * @return the permissions value. + */ + List permissions(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.SqlRoleDefinitionGetResultsInner object. + * + * @return the inner object. + */ + SqlRoleDefinitionGetResultsInner innerModel(); + + /** The entirety of the SqlRoleDefinitionGetResults definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The SqlRoleDefinitionGetResults definition stages. */ + interface DefinitionStages { + /** The first stage of the SqlRoleDefinitionGetResults definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the SqlRoleDefinitionGetResults definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, accountName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @return the next definition stage. + */ + WithCreate withExistingDatabaseAccount(String resourceGroupName, String accountName); + } + /** + * The stage of the SqlRoleDefinitionGetResults definition which contains all the minimum required properties + * for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithRoleName, + DefinitionStages.WithType, + DefinitionStages.WithAssignableScopes, + DefinitionStages.WithPermissions { + /** + * Executes the create request. + * + * @return the created resource. + */ + SqlRoleDefinitionGetResults create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SqlRoleDefinitionGetResults create(Context context); + } + /** The stage of the SqlRoleDefinitionGetResults definition allowing to specify roleName. */ + interface WithRoleName { + /** + * Specifies the roleName property: A user-friendly name for the Role Definition. Must be unique for the + * database account.. + * + * @param roleName A user-friendly name for the Role Definition. Must be unique for the database account. + * @return the next definition stage. + */ + WithCreate withRoleName(String roleName); + } + /** The stage of the SqlRoleDefinitionGetResults definition allowing to specify type. */ + interface WithType { + /** + * Specifies the type property: Indicates whether the Role Definition was built-in or user created.. + * + * @param type Indicates whether the Role Definition was built-in or user created. + * @return the next definition stage. + */ + WithCreate withType(RoleDefinitionType type); + } + /** The stage of the SqlRoleDefinitionGetResults definition allowing to specify assignableScopes. */ + interface WithAssignableScopes { + /** + * Specifies the assignableScopes property: A set of fully qualified Scopes at or below which Role + * Assignments may be created using this Role Definition. This will allow application of this Role + * Definition on the entire database account or any underlying Database / Collection. Must have at least one + * element. Scopes higher than Database account are not enforceable as assignable Scopes. Note that + * resources referenced in assignable Scopes need not exist.. + * + * @param assignableScopes A set of fully qualified Scopes at or below which Role Assignments may be created + * using this Role Definition. This will allow application of this Role Definition on the entire + * database account or any underlying Database / Collection. Must have at least one element. Scopes + * higher than Database account are not enforceable as assignable Scopes. Note that resources referenced + * in assignable Scopes need not exist. + * @return the next definition stage. + */ + WithCreate withAssignableScopes(List assignableScopes); + } + /** The stage of the SqlRoleDefinitionGetResults definition allowing to specify permissions. */ + interface WithPermissions { + /** + * Specifies the permissions property: The set of operations allowed through this Role Definition.. + * + * @param permissions The set of operations allowed through this Role Definition. + * @return the next definition stage. + */ + WithCreate withPermissions(List permissions); + } + } + /** + * Begins update for the SqlRoleDefinitionGetResults resource. + * + * @return the stage of resource update. + */ + SqlRoleDefinitionGetResults.Update update(); + + /** The template for SqlRoleDefinitionGetResults update. */ + interface Update + extends UpdateStages.WithRoleName, + UpdateStages.WithType, + UpdateStages.WithAssignableScopes, + UpdateStages.WithPermissions { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SqlRoleDefinitionGetResults apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SqlRoleDefinitionGetResults apply(Context context); + } + /** The SqlRoleDefinitionGetResults update stages. */ + interface UpdateStages { + /** The stage of the SqlRoleDefinitionGetResults update allowing to specify roleName. */ + interface WithRoleName { + /** + * Specifies the roleName property: A user-friendly name for the Role Definition. Must be unique for the + * database account.. + * + * @param roleName A user-friendly name for the Role Definition. Must be unique for the database account. + * @return the next definition stage. + */ + Update withRoleName(String roleName); + } + /** The stage of the SqlRoleDefinitionGetResults update allowing to specify type. */ + interface WithType { + /** + * Specifies the type property: Indicates whether the Role Definition was built-in or user created.. + * + * @param type Indicates whether the Role Definition was built-in or user created. + * @return the next definition stage. + */ + Update withType(RoleDefinitionType type); + } + /** The stage of the SqlRoleDefinitionGetResults update allowing to specify assignableScopes. */ + interface WithAssignableScopes { + /** + * Specifies the assignableScopes property: A set of fully qualified Scopes at or below which Role + * Assignments may be created using this Role Definition. This will allow application of this Role + * Definition on the entire database account or any underlying Database / Collection. Must have at least one + * element. Scopes higher than Database account are not enforceable as assignable Scopes. Note that + * resources referenced in assignable Scopes need not exist.. + * + * @param assignableScopes A set of fully qualified Scopes at or below which Role Assignments may be created + * using this Role Definition. This will allow application of this Role Definition on the entire + * database account or any underlying Database / Collection. Must have at least one element. Scopes + * higher than Database account are not enforceable as assignable Scopes. Note that resources referenced + * in assignable Scopes need not exist. + * @return the next definition stage. + */ + Update withAssignableScopes(List assignableScopes); + } + /** The stage of the SqlRoleDefinitionGetResults update allowing to specify permissions. */ + interface WithPermissions { + /** + * Specifies the permissions property: The set of operations allowed through this Role Definition.. + * + * @param permissions The set of operations allowed through this Role Definition. + * @return the next definition stage. + */ + Update withPermissions(List permissions); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SqlRoleDefinitionGetResults refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SqlRoleDefinitionGetResults refresh(Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlRoleDefinitionListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlRoleDefinitionListResult.java new file mode 100644 index 0000000000000..767dd8deb4c2a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlRoleDefinitionListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlRoleDefinitionGetResultsInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The relevant Role Definitions. */ +@Immutable +public final class SqlRoleDefinitionListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlRoleDefinitionListResult.class); + + /* + * List of Role Definitions and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of Role Definitions and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlStoredProcedureCreateUpdateParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlStoredProcedureCreateUpdateParameters.java new file mode 100644 index 0000000000000..ef76a8ba074b2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlStoredProcedureCreateUpdateParameters.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Parameters to create and update Cosmos DB storedProcedure. */ +@JsonFlatten +@Fluent +public class SqlStoredProcedureCreateUpdateParameters extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlStoredProcedureCreateUpdateParameters.class); + + /* + * The standard JSON format of a storedProcedure + */ + @JsonProperty(value = "properties.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 = "properties.options") + private CreateUpdateOptions options; + + /** + * Get the resource property: The standard JSON format of a storedProcedure. + * + * @return the resource value. + */ + public SqlStoredProcedureResource resource() { + return this.resource; + } + + /** + * Set the resource property: The standard JSON format of a storedProcedure. + * + * @param resource the resource value to set. + * @return the SqlStoredProcedureCreateUpdateParameters object itself. + */ + public SqlStoredProcedureCreateUpdateParameters 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 SqlStoredProcedureCreateUpdateParameters object itself. + */ + public SqlStoredProcedureCreateUpdateParameters withOptions(CreateUpdateOptions options) { + this.options = options; + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlStoredProcedureCreateUpdateParameters withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlStoredProcedureCreateUpdateParameters withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (resource() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property resource in model SqlStoredProcedureCreateUpdateParameters")); + } else { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlStoredProcedureGetPropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlStoredProcedureGetPropertiesResource.java new file mode 100644 index 0000000000000..75fd730af27e9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlStoredProcedureGetPropertiesResource.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The SqlStoredProcedureGetPropertiesResource model. */ +@Fluent +public final class SqlStoredProcedureGetPropertiesResource extends SqlStoredProcedureResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlStoredProcedureGetPropertiesResource.class); + + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the rid property: A system generated property. A unique identifier. + * + * @return the rid value. + */ + public String rid() { + return this.rid; + } + + /** + * Get the ts property: A system generated property that denotes the last updated timestamp of the resource. + * + * @return the ts value. + */ + public Float ts() { + return this.ts; + } + + /** + * Get the etag property: A system generated property representing the resource etag required for optimistic + * concurrency control. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** {@inheritDoc} */ + @Override + public SqlStoredProcedureGetPropertiesResource withId(String id) { + super.withId(id); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlStoredProcedureGetPropertiesResource withBody(String body) { + super.withBody(body); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlStoredProcedureGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlStoredProcedureGetResults.java new file mode 100644 index 0000000000000..a6d8c3d506fcd --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlStoredProcedureGetResults.java @@ -0,0 +1,248 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.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 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..3362a3bfec160 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlStoredProcedureListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlStoredProcedureGetResultsInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the storedProcedures and their properties. */ +@Immutable +public final class SqlStoredProcedureListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlStoredProcedureListResult.class); + + /* + * List of storedProcedures and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of storedProcedures and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlStoredProcedureResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlStoredProcedureResource.java new file mode 100644 index 0000000000000..4b2444de4e953 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlStoredProcedureResource.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB SQL storedProcedure resource object. */ +@Fluent +public class SqlStoredProcedureResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlStoredProcedureResource.class); + + /* + * Name of the Cosmos DB SQL storedProcedure + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * Body of the Stored Procedure + */ + @JsonProperty(value = "body") + private String body; + + /** + * Get the id property: Name of the Cosmos DB SQL storedProcedure. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Name of the Cosmos DB SQL storedProcedure. + * + * @param id the id value to set. + * @return the SqlStoredProcedureResource object itself. + */ + public SqlStoredProcedureResource withId(String id) { + this.id = id; + return this; + } + + /** + * Get the body property: Body of the Stored Procedure. + * + * @return the body value. + */ + public String body() { + return this.body; + } + + /** + * Set the body property: Body of the Stored Procedure. + * + * @param body the body value to set. + * @return the SqlStoredProcedureResource object itself. + */ + public SqlStoredProcedureResource withBody(String body) { + this.body = body; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model SqlStoredProcedureResource")); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlTriggerCreateUpdateParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlTriggerCreateUpdateParameters.java new file mode 100644 index 0000000000000..da4f10a4971b5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlTriggerCreateUpdateParameters.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Parameters to create and update Cosmos DB trigger. */ +@JsonFlatten +@Fluent +public class SqlTriggerCreateUpdateParameters extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlTriggerCreateUpdateParameters.class); + + /* + * The standard JSON format of a trigger + */ + @JsonProperty(value = "properties.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 = "properties.options") + private CreateUpdateOptions options; + + /** + * Get the resource property: The standard JSON format of a trigger. + * + * @return the resource value. + */ + public SqlTriggerResource resource() { + return this.resource; + } + + /** + * Set the resource property: The standard JSON format of a trigger. + * + * @param resource the resource value to set. + * @return the SqlTriggerCreateUpdateParameters object itself. + */ + public SqlTriggerCreateUpdateParameters 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 SqlTriggerCreateUpdateParameters object itself. + */ + public SqlTriggerCreateUpdateParameters withOptions(CreateUpdateOptions options) { + this.options = options; + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlTriggerCreateUpdateParameters withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlTriggerCreateUpdateParameters withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (resource() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property resource in model SqlTriggerCreateUpdateParameters")); + } else { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlTriggerGetPropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlTriggerGetPropertiesResource.java new file mode 100644 index 0000000000000..52d6e9dc6fc2c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlTriggerGetPropertiesResource.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The SqlTriggerGetPropertiesResource model. */ +@Fluent +public final class SqlTriggerGetPropertiesResource extends SqlTriggerResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlTriggerGetPropertiesResource.class); + + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the rid property: A system generated property. A unique identifier. + * + * @return the rid value. + */ + public String rid() { + return this.rid; + } + + /** + * Get the ts property: A system generated property that denotes the last updated timestamp of the resource. + * + * @return the ts value. + */ + public Float ts() { + return this.ts; + } + + /** + * Get the etag property: A system generated property representing the resource etag required for optimistic + * concurrency control. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** {@inheritDoc} */ + @Override + public SqlTriggerGetPropertiesResource withId(String id) { + super.withId(id); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlTriggerGetPropertiesResource withBody(String body) { + super.withBody(body); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlTriggerGetPropertiesResource withTriggerType(TriggerType triggerType) { + super.withTriggerType(triggerType); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlTriggerGetPropertiesResource withTriggerOperation(TriggerOperation triggerOperation) { + super.withTriggerOperation(triggerOperation); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlTriggerGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlTriggerGetResults.java new file mode 100644 index 0000000000000..efd23f9aade32 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlTriggerGetResults.java @@ -0,0 +1,248 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.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 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..ccd73cffe3ed6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlTriggerListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlTriggerGetResultsInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the triggers and their properties. */ +@Immutable +public final class SqlTriggerListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlTriggerListResult.class); + + /* + * List of triggers and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of triggers and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlTriggerResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlTriggerResource.java new file mode 100644 index 0000000000000..e858400486d4a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlTriggerResource.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB SQL trigger resource object. */ +@Fluent +public class SqlTriggerResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlTriggerResource.class); + + /* + * Name of the Cosmos DB SQL trigger + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * Body of the Trigger + */ + @JsonProperty(value = "body") + private String body; + + /* + * Type of the Trigger + */ + @JsonProperty(value = "triggerType") + private TriggerType triggerType; + + /* + * The operation the trigger is associated with + */ + @JsonProperty(value = "triggerOperation") + private TriggerOperation triggerOperation; + + /** + * Get the id property: Name of the Cosmos DB SQL trigger. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Name of the Cosmos DB SQL trigger. + * + * @param id the id value to set. + * @return the SqlTriggerResource object itself. + */ + public SqlTriggerResource withId(String id) { + this.id = id; + return this; + } + + /** + * Get the body property: Body of the Trigger. + * + * @return the body value. + */ + public String body() { + return this.body; + } + + /** + * Set the body property: Body of the Trigger. + * + * @param body the body value to set. + * @return the SqlTriggerResource object itself. + */ + public SqlTriggerResource withBody(String body) { + this.body = body; + return this; + } + + /** + * Get the triggerType property: Type of the Trigger. + * + * @return the triggerType value. + */ + public TriggerType triggerType() { + return this.triggerType; + } + + /** + * Set the triggerType property: Type of the Trigger. + * + * @param triggerType the triggerType value to set. + * @return the SqlTriggerResource object itself. + */ + public SqlTriggerResource withTriggerType(TriggerType triggerType) { + this.triggerType = triggerType; + return this; + } + + /** + * Get the triggerOperation property: The operation the trigger is associated with. + * + * @return the triggerOperation value. + */ + public TriggerOperation triggerOperation() { + return this.triggerOperation; + } + + /** + * Set the triggerOperation property: The operation the trigger is associated with. + * + * @param triggerOperation the triggerOperation value to set. + * @return the SqlTriggerResource object itself. + */ + public SqlTriggerResource withTriggerOperation(TriggerOperation triggerOperation) { + this.triggerOperation = triggerOperation; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model SqlTriggerResource")); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlUserDefinedFunctionCreateUpdateParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlUserDefinedFunctionCreateUpdateParameters.java new file mode 100644 index 0000000000000..70a94d63207ca --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlUserDefinedFunctionCreateUpdateParameters.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Parameters to create and update Cosmos DB userDefinedFunction. */ +@JsonFlatten +@Fluent +public class SqlUserDefinedFunctionCreateUpdateParameters extends ArmResourceProperties { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(SqlUserDefinedFunctionCreateUpdateParameters.class); + + /* + * The standard JSON format of a userDefinedFunction + */ + @JsonProperty(value = "properties.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 = "properties.options") + private CreateUpdateOptions options; + + /** + * Get the resource property: The standard JSON format of a userDefinedFunction. + * + * @return the resource value. + */ + public SqlUserDefinedFunctionResource resource() { + return this.resource; + } + + /** + * Set the resource property: The standard JSON format of a userDefinedFunction. + * + * @param resource the resource value to set. + * @return the SqlUserDefinedFunctionCreateUpdateParameters object itself. + */ + public SqlUserDefinedFunctionCreateUpdateParameters 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 SqlUserDefinedFunctionCreateUpdateParameters object itself. + */ + public SqlUserDefinedFunctionCreateUpdateParameters withOptions(CreateUpdateOptions options) { + this.options = options; + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlUserDefinedFunctionCreateUpdateParameters withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlUserDefinedFunctionCreateUpdateParameters withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (resource() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property resource in model SqlUserDefinedFunctionCreateUpdateParameters")); + } else { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlUserDefinedFunctionGetPropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlUserDefinedFunctionGetPropertiesResource.java new file mode 100644 index 0000000000000..e22b7a53f0f33 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlUserDefinedFunctionGetPropertiesResource.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The SqlUserDefinedFunctionGetPropertiesResource model. */ +@Fluent +public final class SqlUserDefinedFunctionGetPropertiesResource extends SqlUserDefinedFunctionResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlUserDefinedFunctionGetPropertiesResource.class); + + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the rid property: A system generated property. A unique identifier. + * + * @return the rid value. + */ + public String rid() { + return this.rid; + } + + /** + * Get the ts property: A system generated property that denotes the last updated timestamp of the resource. + * + * @return the ts value. + */ + public Float ts() { + return this.ts; + } + + /** + * Get the etag property: A system generated property representing the resource etag required for optimistic + * concurrency control. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** {@inheritDoc} */ + @Override + public SqlUserDefinedFunctionGetPropertiesResource withId(String id) { + super.withId(id); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlUserDefinedFunctionGetPropertiesResource withBody(String body) { + super.withBody(body); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlUserDefinedFunctionGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlUserDefinedFunctionGetResults.java new file mode 100644 index 0000000000000..9bfed94cf6128 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlUserDefinedFunctionGetResults.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.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 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..84124f4d6ba05 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlUserDefinedFunctionListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlUserDefinedFunctionGetResultsInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the userDefinedFunctions and their properties. */ +@Immutable +public final class SqlUserDefinedFunctionListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlUserDefinedFunctionListResult.class); + + /* + * List of userDefinedFunctions and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of userDefinedFunctions and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlUserDefinedFunctionResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlUserDefinedFunctionResource.java new file mode 100644 index 0000000000000..60d9a1bc51ebe --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlUserDefinedFunctionResource.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB SQL userDefinedFunction resource object. */ +@Fluent +public class SqlUserDefinedFunctionResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlUserDefinedFunctionResource.class); + + /* + * Name of the Cosmos DB SQL userDefinedFunction + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * Body of the User Defined Function + */ + @JsonProperty(value = "body") + private String body; + + /** + * Get the id property: Name of the Cosmos DB SQL userDefinedFunction. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Name of the Cosmos DB SQL userDefinedFunction. + * + * @param id the id value to set. + * @return the SqlUserDefinedFunctionResource object itself. + */ + public SqlUserDefinedFunctionResource withId(String id) { + this.id = id; + return this; + } + + /** + * Get the body property: Body of the User Defined Function. + * + * @return the body value. + */ + public String body() { + return this.body; + } + + /** + * Set the body property: Body of the User Defined Function. + * + * @param body the body value to set. + * @return the SqlUserDefinedFunctionResource object itself. + */ + public SqlUserDefinedFunctionResource withBody(String body) { + this.body = body; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property id in model SqlUserDefinedFunctionResource")); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableCreateUpdateParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableCreateUpdateParameters.java new file mode 100644 index 0000000000000..580609d12c81e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableCreateUpdateParameters.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Parameters to create and update Cosmos DB Table. */ +@JsonFlatten +@Fluent +public class TableCreateUpdateParameters extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TableCreateUpdateParameters.class); + + /* + * The standard JSON format of a Table + */ + @JsonProperty(value = "properties.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 = "properties.options") + private CreateUpdateOptions options; + + /** + * Get the resource property: The standard JSON format of a Table. + * + * @return the resource value. + */ + public TableResource resource() { + return this.resource; + } + + /** + * Set the resource property: The standard JSON format of a Table. + * + * @param resource the resource value to set. + * @return the TableCreateUpdateParameters object itself. + */ + public TableCreateUpdateParameters 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 TableCreateUpdateParameters object itself. + */ + public TableCreateUpdateParameters withOptions(CreateUpdateOptions options) { + this.options = options; + return this; + } + + /** {@inheritDoc} */ + @Override + public TableCreateUpdateParameters withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public TableCreateUpdateParameters withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (resource() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property resource in model TableCreateUpdateParameters")); + } else { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableGetPropertiesOptions.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableGetPropertiesOptions.java new file mode 100644 index 0000000000000..acf1624c09131 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableGetPropertiesOptions.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** The TableGetPropertiesOptions model. */ +@Fluent +public final class TableGetPropertiesOptions extends OptionsResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TableGetPropertiesOptions.class); + + /** {@inheritDoc} */ + @Override + public TableGetPropertiesOptions withThroughput(Integer throughput) { + super.withThroughput(throughput); + return this; + } + + /** {@inheritDoc} */ + @Override + public TableGetPropertiesOptions withAutoscaleSettings(AutoscaleSettings autoscaleSettings) { + super.withAutoscaleSettings(autoscaleSettings); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableGetPropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableGetPropertiesResource.java new file mode 100644 index 0000000000000..b692785d6bfb5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableGetPropertiesResource.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The TableGetPropertiesResource model. */ +@Fluent +public final class TableGetPropertiesResource extends TableResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TableGetPropertiesResource.class); + + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the rid property: A system generated property. A unique identifier. + * + * @return the rid value. + */ + public String rid() { + return this.rid; + } + + /** + * Get the ts property: A system generated property that denotes the last updated timestamp of the resource. + * + * @return the ts value. + */ + public Float ts() { + return this.ts; + } + + /** + * Get the etag property: A system generated property representing the resource etag required for optimistic + * concurrency control. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** {@inheritDoc} */ + @Override + public TableGetPropertiesResource withId(String id) { + super.withId(id); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableGetResults.java new file mode 100644 index 0000000000000..6918f20610f00 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableGetResults.java @@ -0,0 +1,252 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.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 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); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableListResult.java new file mode 100644 index 0000000000000..f7490c9913264 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.TableGetResultsInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the Table and their properties. */ +@Immutable +public final class TableListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TableListResult.class); + + /* + * List of Table and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of Table and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableResource.java new file mode 100644 index 0000000000000..596dfb6db550a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableResource.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB table resource object. */ +@Fluent +public class TableResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TableResource.class); + + /* + * Name of the Cosmos DB table + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * Get the id property: Name of the Cosmos DB table. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Name of the Cosmos DB table. + * + * @param id the id value to set. + * @return the TableResource object itself. + */ + public TableResource withId(String id) { + this.id = id; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model TableResource")); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableResources.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableResources.java new file mode 100644 index 0000000000000..e7b799eb2e3bf --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableResources.java @@ -0,0 +1,268 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of TableResources. */ +public interface TableResources { + /** + * Lists the Tables under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the Table and their properties. + */ + PagedIterable listTables(String resourceGroupName, String accountName); + + /** + * Lists the Tables under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List operation response, that contains the Table and their properties. + */ + PagedIterable listTables(String resourceGroupName, String accountName, Context context); + + /** + * Gets the Tables under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Tables under an existing Azure Cosmos DB database account with the provided name. + */ + TableGetResults getTable(String resourceGroupName, String accountName, String tableName); + + /** + * Gets the Tables under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Tables under an existing Azure Cosmos DB database account with the provided name. + */ + Response getTableWithResponse( + String resourceGroupName, String accountName, String tableName, Context context); + + /** + * Deletes an existing Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteTable(String resourceGroupName, String accountName, String tableName); + + /** + * Deletes an existing Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteTable(String resourceGroupName, String accountName, String tableName, Context context); + + /** + * Gets the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided + * name. + */ + ThroughputSettingsGetResults getTableThroughput(String resourceGroupName, String accountName, String tableName); + + /** + * Gets the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided + * name. + */ + Response getTableThroughputWithResponse( + String resourceGroupName, String accountName, String tableName, Context context); + + /** + * Update RUs per second of an Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current Table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults updateTableThroughput( + String resourceGroupName, + String accountName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Update RUs per second of an Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current Table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults updateTableThroughput( + String resourceGroupName, + String accountName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * Migrate an Azure Cosmos DB Table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateTableToAutoscale( + String resourceGroupName, String accountName, String tableName); + + /** + * Migrate an Azure Cosmos DB Table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateTableToAutoscale( + String resourceGroupName, String accountName, String tableName, Context context); + + /** + * Migrate an Azure Cosmos DB Table from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateTableToManualThroughput( + String resourceGroupName, String accountName, String tableName); + + /** + * Migrate an Azure Cosmos DB Table from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateTableToManualThroughput( + String resourceGroupName, String accountName, String tableName, Context context); + + /** + * Gets the Tables under an existing Azure Cosmos DB database account with the provided name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Tables under an existing Azure Cosmos DB database account with the provided name. + */ + TableGetResults getTableById(String id); + + /** + * Gets the Tables under an existing Azure Cosmos DB database account with the provided name. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Tables under an existing Azure Cosmos DB database account with the provided name. + */ + Response getTableByIdWithResponse(String id, Context context); + + /** + * Deletes an existing Azure Cosmos DB Table. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteTableById(String id); + + /** + * Deletes an existing Azure Cosmos DB Table. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteTableByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new TableGetResults resource. + * + * @param name resource name. + * @return the first stage of the new TableGetResults definition. + */ + TableGetResults.DefinitionStages.Blank define(String name); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ThroughputPolicyResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ThroughputPolicyResource.java new file mode 100644 index 0000000000000..bbdaa55240523 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ThroughputPolicyResource.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB resource throughput policy. */ +@Fluent +public final class ThroughputPolicyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ThroughputPolicyResource.class); + + /* + * Determines whether the ThroughputPolicy is active or not + */ + @JsonProperty(value = "isEnabled") + private Boolean isEnabled; + + /* + * Represents the percentage by which throughput can increase every time + * throughput policy kicks in. + */ + @JsonProperty(value = "incrementPercent") + private Integer incrementPercent; + + /** + * Get the isEnabled property: Determines whether the ThroughputPolicy is active or not. + * + * @return the isEnabled value. + */ + public Boolean isEnabled() { + return this.isEnabled; + } + + /** + * Set the isEnabled property: Determines whether the ThroughputPolicy is active or not. + * + * @param isEnabled the isEnabled value to set. + * @return the ThroughputPolicyResource object itself. + */ + public ThroughputPolicyResource withIsEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + + /** + * Get the incrementPercent property: Represents the percentage by which throughput can increase every time + * throughput policy kicks in. + * + * @return the incrementPercent value. + */ + public Integer incrementPercent() { + return this.incrementPercent; + } + + /** + * Set the incrementPercent property: Represents the percentage by which throughput can increase every time + * throughput policy kicks in. + * + * @param incrementPercent the incrementPercent value to set. + * @return the ThroughputPolicyResource object itself. + */ + public ThroughputPolicyResource withIncrementPercent(Integer incrementPercent) { + this.incrementPercent = incrementPercent; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ThroughputSettingsGetPropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ThroughputSettingsGetPropertiesResource.java new file mode 100644 index 0000000000000..6023879191447 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ThroughputSettingsGetPropertiesResource.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ThroughputSettingsGetPropertiesResource model. */ +@Fluent +public final class ThroughputSettingsGetPropertiesResource extends ThroughputSettingsResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ThroughputSettingsGetPropertiesResource.class); + + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the rid property: A system generated property. A unique identifier. + * + * @return the rid value. + */ + public String rid() { + return this.rid; + } + + /** + * Get the ts property: A system generated property that denotes the last updated timestamp of the resource. + * + * @return the ts value. + */ + public Float ts() { + return this.ts; + } + + /** + * Get the etag property: A system generated property representing the resource etag required for optimistic + * concurrency control. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** {@inheritDoc} */ + @Override + public ThroughputSettingsGetPropertiesResource withThroughput(Integer throughput) { + super.withThroughput(throughput); + return this; + } + + /** {@inheritDoc} */ + @Override + public ThroughputSettingsGetPropertiesResource withAutoscaleSettings(AutoscaleSettingsResource autoscaleSettings) { + super.withAutoscaleSettings(autoscaleSettings); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ThroughputSettingsGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ThroughputSettingsGetResults.java new file mode 100644 index 0000000000000..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..aefc58733ed17 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ThroughputSettingsResource.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Cosmos DB resource throughput object. Either throughput is required or autoscaleSettings is required, but not both. + */ +@Fluent +public class ThroughputSettingsResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ThroughputSettingsResource.class); + + /* + * Value of the Cosmos DB resource throughput. Either throughput is + * required or autoscaleSettings is required, but not both. + */ + @JsonProperty(value = "throughput") + private Integer throughput; + + /* + * Cosmos DB resource for autoscale settings. Either throughput is required + * or autoscaleSettings is required, but not both. + */ + @JsonProperty(value = "autoscaleSettings") + private AutoscaleSettingsResource autoscaleSettings; + + /* + * The minimum throughput of the resource + */ + @JsonProperty(value = "minimumThroughput", access = JsonProperty.Access.WRITE_ONLY) + private String minimumThroughput; + + /* + * The throughput replace is pending + */ + @JsonProperty(value = "offerReplacePending", access = JsonProperty.Access.WRITE_ONLY) + private String offerReplacePending; + + /** + * Get the throughput property: Value of the Cosmos DB resource throughput. Either throughput is required or + * autoscaleSettings is required, but not both. + * + * @return the throughput value. + */ + public Integer throughput() { + return this.throughput; + } + + /** + * Set the throughput property: Value of the Cosmos DB resource throughput. Either throughput is required or + * autoscaleSettings is required, but not both. + * + * @param throughput the throughput value to set. + * @return the ThroughputSettingsResource object itself. + */ + public ThroughputSettingsResource withThroughput(Integer throughput) { + this.throughput = throughput; + return this; + } + + /** + * Get the autoscaleSettings property: Cosmos DB resource for autoscale settings. Either throughput is required or + * autoscaleSettings is required, but not both. + * + * @return the autoscaleSettings value. + */ + public AutoscaleSettingsResource autoscaleSettings() { + return this.autoscaleSettings; + } + + /** + * Set the autoscaleSettings property: Cosmos DB resource for autoscale settings. Either throughput is required or + * autoscaleSettings is required, but not both. + * + * @param autoscaleSettings the autoscaleSettings value to set. + * @return the ThroughputSettingsResource object itself. + */ + public ThroughputSettingsResource withAutoscaleSettings(AutoscaleSettingsResource autoscaleSettings) { + this.autoscaleSettings = autoscaleSettings; + return this; + } + + /** + * Get the minimumThroughput property: The minimum throughput of the resource. + * + * @return the minimumThroughput value. + */ + public String minimumThroughput() { + return this.minimumThroughput; + } + + /** + * Get the offerReplacePending property: The throughput replace is pending. + * + * @return the offerReplacePending value. + */ + public String offerReplacePending() { + return this.offerReplacePending; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (autoscaleSettings() != null) { + autoscaleSettings().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ThroughputSettingsUpdateParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ThroughputSettingsUpdateParameters.java new file mode 100644 index 0000000000000..8c153d4029f81 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ThroughputSettingsUpdateParameters.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Parameters to update Cosmos DB resource throughput. */ +@JsonFlatten +@Fluent +public class ThroughputSettingsUpdateParameters extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ThroughputSettingsUpdateParameters.class); + + /* + * The standard JSON format of a resource throughput + */ + @JsonProperty(value = "properties.resource", required = true) + private ThroughputSettingsResource resource; + + /** + * Get the resource property: The standard JSON format of a resource throughput. + * + * @return the resource value. + */ + public ThroughputSettingsResource resource() { + return this.resource; + } + + /** + * Set the resource property: The standard JSON format of a resource throughput. + * + * @param resource the resource value to set. + * @return the ThroughputSettingsUpdateParameters object itself. + */ + public ThroughputSettingsUpdateParameters withResource(ThroughputSettingsResource resource) { + this.resource = resource; + return this; + } + + /** {@inheritDoc} */ + @Override + public ThroughputSettingsUpdateParameters withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ThroughputSettingsUpdateParameters withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (resource() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property resource in model ThroughputSettingsUpdateParameters")); + } else { + resource().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TriggerOperation.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TriggerOperation.java new file mode 100644 index 0000000000000..ac6dec81a33e4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TriggerOperation.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for TriggerOperation. */ +public final class TriggerOperation extends ExpandableStringEnum { + /** Static value All for TriggerOperation. */ + public static final TriggerOperation ALL = fromString("All"); + + /** Static value Create for TriggerOperation. */ + public static final TriggerOperation CREATE = fromString("Create"); + + /** Static value Update for TriggerOperation. */ + public static final TriggerOperation UPDATE = fromString("Update"); + + /** Static value Delete for TriggerOperation. */ + public static final TriggerOperation DELETE = fromString("Delete"); + + /** Static value Replace for TriggerOperation. */ + public static final TriggerOperation REPLACE = fromString("Replace"); + + /** + * Creates or finds a TriggerOperation from its string representation. + * + * @param name a name to look for. + * @return the corresponding TriggerOperation. + */ + @JsonCreator + public static TriggerOperation fromString(String name) { + return fromString(name, TriggerOperation.class); + } + + /** @return known TriggerOperation values. */ + public static Collection values() { + return values(TriggerOperation.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TriggerType.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TriggerType.java new file mode 100644 index 0000000000000..9b6b1526603fd --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TriggerType.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for TriggerType. */ +public final class TriggerType extends ExpandableStringEnum { + /** Static value Pre for TriggerType. */ + public static final TriggerType PRE = fromString("Pre"); + + /** Static value Post for TriggerType. */ + public static final TriggerType POST = fromString("Post"); + + /** + * Creates or finds a TriggerType from its string representation. + * + * @param name a name to look for. + * @return the corresponding TriggerType. + */ + @JsonCreator + public static TriggerType fromString(String name) { + return fromString(name, TriggerType.class); + } + + /** @return known TriggerType values. */ + public static Collection values() { + return values(TriggerType.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/UniqueKey.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/UniqueKey.java new file mode 100644 index 0000000000000..64f8549280237 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/UniqueKey.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The unique key on that enforces uniqueness constraint on documents in the collection in the Azure Cosmos DB service. + */ +@Fluent +public final class UniqueKey { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UniqueKey.class); + + /* + * List of paths must be unique for each document in the Azure Cosmos DB + * service + */ + @JsonProperty(value = "paths") + private List paths; + + /** + * Get the paths property: List of paths must be unique for each document in the Azure Cosmos DB service. + * + * @return the paths value. + */ + public List paths() { + return this.paths; + } + + /** + * Set the paths property: List of paths must be unique for each document in the Azure Cosmos DB service. + * + * @param paths the paths value to set. + * @return the UniqueKey object itself. + */ + public UniqueKey withPaths(List paths) { + this.paths = paths; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/UniqueKeyPolicy.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/UniqueKeyPolicy.java new file mode 100644 index 0000000000000..134f27c879b7e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/UniqueKeyPolicy.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure + * Cosmos DB service. + */ +@Fluent +public final class UniqueKeyPolicy { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UniqueKeyPolicy.class); + + /* + * List of unique keys on that enforces uniqueness constraint on documents + * in the collection in the Azure Cosmos DB service. + */ + @JsonProperty(value = "uniqueKeys") + private List uniqueKeys; + + /** + * Get the uniqueKeys property: List of unique keys on that enforces uniqueness constraint on documents in the + * collection in the Azure Cosmos DB service. + * + * @return the uniqueKeys value. + */ + public List uniqueKeys() { + return this.uniqueKeys; + } + + /** + * Set the uniqueKeys property: List of unique keys on that enforces uniqueness constraint on documents in the + * collection in the Azure Cosmos DB service. + * + * @param uniqueKeys the uniqueKeys value to set. + * @return the UniqueKeyPolicy object itself. + */ + public UniqueKeyPolicy withUniqueKeys(List uniqueKeys) { + this.uniqueKeys = uniqueKeys; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (uniqueKeys() != null) { + uniqueKeys().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/UnitType.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/UnitType.java new file mode 100644 index 0000000000000..4a1b3530cea34 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/UnitType.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for UnitType. */ +public final class UnitType extends ExpandableStringEnum { + /** Static value Count for UnitType. */ + public static final UnitType COUNT = fromString("Count"); + + /** Static value Bytes for UnitType. */ + public static final UnitType BYTES = fromString("Bytes"); + + /** Static value Seconds for UnitType. */ + public static final UnitType SECONDS = fromString("Seconds"); + + /** Static value Percent for UnitType. */ + public static final UnitType PERCENT = fromString("Percent"); + + /** Static value CountPerSecond for UnitType. */ + public static final UnitType COUNT_PER_SECOND = fromString("CountPerSecond"); + + /** Static value BytesPerSecond for UnitType. */ + public static final UnitType BYTES_PER_SECOND = fromString("BytesPerSecond"); + + /** Static value Milliseconds for UnitType. */ + public static final UnitType MILLISECONDS = fromString("Milliseconds"); + + /** + * Creates or finds a UnitType from its string representation. + * + * @param name a name to look for. + * @return the corresponding UnitType. + */ + @JsonCreator + public static UnitType fromString(String name) { + return fromString(name, UnitType.class); + } + + /** @return known UnitType values. */ + public static Collection values() { + return values(UnitType.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Usage.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Usage.java new file mode 100644 index 0000000000000..f19cb41736ea2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Usage.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.UsageInner; + +/** An immutable client-side representation of Usage. */ +public interface Usage { + /** + * Gets the unit property: The unit of the metric. + * + * @return the unit value. + */ + UnitType unit(); + + /** + * Gets the name property: The name information for the metric. + * + * @return the name value. + */ + MetricName name(); + + /** + * Gets the quotaPeriod property: The quota period used to summarize the usage values. + * + * @return the quotaPeriod value. + */ + String quotaPeriod(); + + /** + * Gets the limit property: Maximum value for this metric. + * + * @return the limit value. + */ + Long limit(); + + /** + * Gets the currentValue property: Current value for this metric. + * + * @return the currentValue value. + */ + Long currentValue(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.UsageInner object. + * + * @return the inner object. + */ + UsageInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/UsagesResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/UsagesResult.java new file mode 100644 index 0000000000000..bd47b2e681361 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/UsagesResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.UsageInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list usage request. */ +@Immutable +public final class UsagesResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UsagesResult.class); + + /* + * The list of usages for the database. A usage is a point in time metric + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: The list of usages for the database. A usage is a point in time metric. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/VirtualNetworkRule.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/VirtualNetworkRule.java new file mode 100644 index 0000000000000..741e9c12a4df9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/VirtualNetworkRule.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Virtual Network ACL Rule object. */ +@Fluent +public final class VirtualNetworkRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualNetworkRule.class); + + /* + * Resource ID of a subnet, for example: + * /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + */ + @JsonProperty(value = "id") + private String id; + + /* + * Create firewall rule before the virtual network has vnet service + * endpoint enabled. + */ + @JsonProperty(value = "ignoreMissingVNetServiceEndpoint") + private Boolean ignoreMissingVNetServiceEndpoint; + + /** + * Get the id property: Resource ID of a subnet, for example: + * /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Resource ID of a subnet, for example: + * /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + * + * @param id the id value to set. + * @return the VirtualNetworkRule object itself. + */ + public VirtualNetworkRule withId(String id) { + this.id = id; + return this; + } + + /** + * Get the ignoreMissingVNetServiceEndpoint property: Create firewall rule before the virtual network has vnet + * service endpoint enabled. + * + * @return the ignoreMissingVNetServiceEndpoint value. + */ + public Boolean ignoreMissingVNetServiceEndpoint() { + return this.ignoreMissingVNetServiceEndpoint; + } + + /** + * Set the ignoreMissingVNetServiceEndpoint property: Create firewall rule before the virtual network has vnet + * service endpoint enabled. + * + * @param ignoreMissingVNetServiceEndpoint the ignoreMissingVNetServiceEndpoint value to set. + * @return the VirtualNetworkRule object itself. + */ + public VirtualNetworkRule withIgnoreMissingVNetServiceEndpoint(Boolean ignoreMissingVNetServiceEndpoint) { + this.ignoreMissingVNetServiceEndpoint = ignoreMissingVNetServiceEndpoint; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/package-info.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/package-info.java new file mode 100644 index 0000000000000..824557a190c26 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the data models for CosmosDBManagementClient. Azure Cosmos DB Database Service Resource Provider + * REST API. + */ +package com.azure.resourcemanager.cosmos.generated.models; diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/package-info.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/package-info.java new file mode 100644 index 0000000000000..562d43a115bc3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the classes for CosmosDBManagementClient. Azure Cosmos DB Database Service Resource Provider REST + * API. + */ +package com.azure.resourcemanager.cosmos.generated; diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/module-info.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/module-info.java new file mode 100644 index 0000000000000..dae49a8d560d0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/module-info.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.cosmos.generated { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.cosmos.generated; + exports com.azure.resourcemanager.cosmos.generated.fluent; + exports com.azure.resourcemanager.cosmos.generated.fluent.models; + exports com.azure.resourcemanager.cosmos.generated.models; + + opens com.azure.resourcemanager.cosmos.generated.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.cosmos.generated.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/cosmos/ci.yml b/sdk/cosmos/ci.yml index 94499f05b585e..12790b7375d30 100644 --- a/sdk/cosmos/ci.yml +++ b/sdk/cosmos/ci.yml @@ -59,7 +59,7 @@ pr: - sdk/cosmos/azure-spring-data-cosmos-test/pom.xml extends: - template: ../../eng/pipelines/templates/stages/cosmos-sdk-client.yml #NOTE: Non-standard template. + template: ../../eng/pipelines/templates/stages/cosmos-sdk-client.yml parameters: ServiceDirectory: cosmos SDKType: client @@ -76,6 +76,9 @@ extends: - name: azure-cosmos-spark_3-1_2-12 groupId: com.azure.cosmos.spark safeName: azurecosmosspark3 + - name: azure-resourcemanager-cosmos-generated + groupId: com.azure.resourcemanager + safeName: azureresourcemanagercosmosgenerated AdditionalModules: - name: azure-cosmos-benchmark groupId: com.azure diff --git a/sdk/cosmos/pom.xml b/sdk/cosmos/pom.xml index 58b0c9aa4bc08..29ccfcb5982b1 100644 --- a/sdk/cosmos/pom.xml +++ b/sdk/cosmos/pom.xml @@ -61,9 +61,10 @@ azure-cosmos-benchmark azure-cosmos-dotnet-benchmark azure-cosmos-encryption + azure-cosmos-spark_3-1_2-12 + azure-resourcemanager-cosmos-generated azure-spring-data-cosmos azure-spring-data-cosmos-test - azure-cosmos-spark_3-1_2-12