diff --git a/eng/versioning/external_dependencies.txt b/eng/versioning/external_dependencies.txt index 62906a566feea..464bc9b7cf1a7 100644 --- a/eng/versioning/external_dependencies.txt +++ b/eng/versioning/external_dependencies.txt @@ -110,6 +110,7 @@ org.springframework.kafka:spring-kafka;2.5.7.RELEASE org.springframework.security:spring-security-config;5.3.5.RELEASE org.springframework.security:spring-security-core;5.3.5.RELEASE org.springframework.security:spring-security-oauth2-client;5.3.5.RELEASE +org.springframework.security:spring-security-oauth2-resource-server;5.3.5.RELEASE org.springframework.security:spring-security-oauth2-core;5.3.5.RELEASE org.springframework.security:spring-security-oauth2-jose;5.3.5.RELEASE org.springframework.security:spring-security-web;5.3.5.RELEASE diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index fa2e6238ee364..0e6472df126ab 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -40,17 +40,22 @@ com.azure:azure-ai-anomalydetector;3.0.0-beta.1;3.0.0-beta.2 com.azure:azure-ai-formrecognizer;3.0.3;3.1.0-beta.2 com.azure:azure-ai-metricsadvisor;1.0.0-beta.2;1.0.0-beta.3 com.azure:azure-ai-textanalytics;5.0.1;5.1.0-beta.4 +com.azure:azure-analytics-synapse-accesscontrol;1.0.0-beta.1;1.0.0-beta.2 +com.azure:azure-analytics-synapse-artifacts;1.0.0-beta.1;1.0.0-beta.2 +com.azure:azure-analytics-synapse-spark;1.0.0-beta.1;1.0.0-beta.2 +com.azure:azure-analytics-synapse-managedprivateendpoints;1.0.0-beta.1;1.0.0-beta.1 +com.azure:azure-analytics-synapse-monitoring;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-communication-chat;1.0.0-beta.3;1.0.0-beta.4 com.azure:azure-communication-common;1.0.0-beta.3;1.0.0-beta.4 com.azure:azure-communication-administration;1.0.0-beta.3;1.0.0-beta.4 com.azure:azure-communication-sms;1.0.0-beta.3;1.0.0-beta.4 -com.azure:azure-core;1.10.0;1.11.0 -com.azure:azure-core-amqp;1.6.0;1.7.0-beta.3 +com.azure:azure-core;1.11.0;1.12.0-beta.1 +com.azure:azure-core-amqp;2.0.0;2.1.0-beta.1 com.azure:azure-core-amqp-experimental;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-core-experimental;1.0.0-beta.8;1.0.0-beta.9 com.azure:azure-core-http-jdk-httpclient;1.0.0-beta.1;1.0.0-beta.1 -com.azure:azure-core-http-netty;1.6.3;1.7.0 -com.azure:azure-core-http-okhttp;1.3.3;1.4.0 +com.azure:azure-core-http-netty;1.7.0;1.8.0-beta.1 +com.azure:azure-core-http-okhttp;1.4.0;1.5.0-beta.1 com.azure:azure-core-management;1.0.0;1.1.0-beta.1 com.azure:azure-core-serializer-avro-apache;1.0.0-beta.5;1.0.0-beta.6 com.azure:azure-core-serializer-avro-jackson;1.0.0-beta.1;1.0.0-beta.2 @@ -68,12 +73,12 @@ com.azure:azure-data-schemaregistry-avro;1.0.0-beta.4;1.0.0-beta.5 com.azure:azure-data-tables;12.0.0-beta.3;12.0.0-beta.4 com.azure:azure-digitaltwins-core;1.0.1;1.1.0-beta.1 com.azure:azure-e2e;1.0.0-beta.1;1.0.0-beta.1 -com.azure:azure-identity;1.2.0;1.3.0-beta.1 +com.azure:azure-identity;1.2.0;1.2.1 com.azure:azure-identity-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-messaging-eventgrid;2.0.0-beta.3;2.0.0-beta.4 com.azure:azure-messaging-eventhubs;5.3.1;5.4.0-beta.2 com.azure:azure-messaging-eventhubs-checkpointstore-blob;1.3.1;1.4.0-beta.2 -com.azure:azure-messaging-servicebus;7.0.0-beta.7;7.0.0-beta.8 +com.azure:azure-messaging-servicebus;7.0.0;7.1.0-beta.1 com.azure:azure-messaging-servicebus-track1-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-messaging-servicebus-track2-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-search-documents;11.1.2;11.2.0-beta.4 @@ -86,17 +91,17 @@ com.azure:azure-security-keyvault-secrets;4.2.3;4.3.0-beta.3 com.azure:azure-sdk-template;1.2.1-beta.2;1.2.1-beta.16 com.azure:azure-spring-data-cosmos;3.1.0;3.2.0-beta.1 com.azure:azure-spring-data-cosmos-test;3.0.0-beta.1;3.0.0-beta.1 -com.azure:azure-storage-blob;12.9.0;12.10.0-beta.1 -com.azure:azure-storage-blob-batch;12.7.0;12.8.0-beta.1 +com.azure:azure-storage-blob;12.9.0;12.10.0-beta.2 +com.azure:azure-storage-blob-batch;12.7.0;12.8.0-beta.2 com.azure:azure-storage-blob-changefeed;12.0.0-beta.4;12.0.0-beta.5 -com.azure:azure-storage-blob-cryptography;12.9.0;12.10.0-beta.1 +com.azure:azure-storage-blob-cryptography;12.9.0;12.10.0-beta.2 com.azure:azure-storage-blob-nio;12.0.0-beta.2;12.0.0-beta.3 -com.azure:azure-storage-common;12.9.0;12.10.0-beta.1 -com.azure:azure-storage-file-share;12.7.0;12.8.0-beta.1 -com.azure:azure-storage-file-datalake;12.3.0;12.4.0-beta.1 -com.azure:azure-storage-internal-avro;12.0.1;12.1.0-beta.1 +com.azure:azure-storage-common;12.9.0;12.10.0-beta.2 +com.azure:azure-storage-file-share;12.7.0;12.8.0-beta.2 +com.azure:azure-storage-file-datalake;12.3.0;12.4.0-beta.2 +com.azure:azure-storage-internal-avro;12.0.1;12.0.2-beta.2 com.azure:azure-storage-perf;1.0.0-beta.1;1.0.0-beta.1 -com.azure:azure-storage-queue;12.7.0;12.8.0-beta.1 +com.azure:azure-storage-queue;12.7.0;12.8.0-beta.2 com.azure:perf-test-core;1.0.0-beta.1;1.0.0-beta.1 com.azure.spring:azure-spring-boot-starter-active-directory-b2c;3.0.0-beta.1;3.0.0-beta.2 com.azure.spring:azure-spring-boot-starter-active-directory;3.0.0-beta.1;3.0.0-beta.2 @@ -168,6 +173,7 @@ com.azure.resourcemanager:azure-resourcemanager-sql;2.1.0;2.2.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-storage;2.1.0;2.2.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-trafficmanager;2.1.0;2.2.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-test;2.0.0-beta.1;2.0.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-cosmos-generated;1.0.0-beta.1;1.0.0-beta.1 com.microsoft:microsoft-opentelemetry-exporter-azuremonitor;1.0.0-beta.1;1.0.0-beta.2 @@ -176,9 +182,7 @@ com.microsoft:microsoft-opentelemetry-exporter-azuremonitor;1.0.0-beta.1;1.0.0-b # Format; # unreleased_:;dependency-version # note: The unreleased dependencies will not be manipulated with the automatic PR creation code. -unreleased_com.azure:azure-core;1.11.0 -unreleased_com.azure:azure-core-amqp;1.7.0-beta.3 -unreleased_com.azure:azure-messaging-servicebus;7.0.0-beta.7 +unreleased_com.azure:azure-messaging-servicebus;7.0.0 # Released Beta dependencies: Copy the entry from above, prepend "beta_", remove the current # version and set the version to the released beta. Released beta dependencies are only valid @@ -188,4 +192,3 @@ unreleased_com.azure:azure-messaging-servicebus;7.0.0-beta.7 # beta_:;dependency-version # note: Released beta versions will not be manipulated with the automatic PR creation code. beta_com.azure:azure-security-keyvault-keys;4.3.0-beta.1 -beta_com.azure:azure-core-amqp;1.7.0-beta.2 diff --git a/eng/versioning/version_data.txt b/eng/versioning/version_data.txt index 61c6a98825dfd..da53965c2792b 100644 --- a/eng/versioning/version_data.txt +++ b/eng/versioning/version_data.txt @@ -34,7 +34,7 @@ com.microsoft.azure:azure-keyvault-cryptography;1.2.4;1.3.0-beta.1 com.microsoft.azure:azure-keyvault-extensions;1.2.4;1.3.0-beta.1 com.microsoft.azure:azure-keyvault-test;1.2.3;1.2.4 com.microsoft.azure:azure-keyvault-webkey;1.2.4;1.3.0-beta.1 -com.microsoft.azure:azure-servicebus;3.5.0;3.5.1 +com.microsoft.azure:azure-servicebus;3.5.1;3.6.0-beta.1 com.microsoft.azure:azure-storage-blob;11.0.2;11.0.2 com.microsoft.azure.msi_auth_token_provider:azure-authentication-msi-token-provider;1.1.0-beta.1;1.1.0-beta.1 com.microsoft.azure:azure-eventgrid;1.4.0-beta.1;1.4.0-beta.1 diff --git a/pom.xml b/pom.xml index d97614e5dba32..85f448c1740a2 100644 --- a/pom.xml +++ b/pom.xml @@ -35,6 +35,7 @@ sdk/search sdk/servicebus sdk/storage + sdk/synapse sdk/tables sdk/template sdk/textanalytics 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..a4133af34bb81 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2020-12-10) + +- 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-2020-09. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). \ No newline at end of file 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..669a45ec44a58 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/README.md @@ -0,0 +1,84 @@ +# 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-2020-09. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +```xml + + com.azure.resourcemanager + azure-resourcemanager-cosmos-generated + 1.0.0-beta.1 + +``` + +### 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: + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-cosmos-generated;current}) +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +CosmosDBManager manager = CosmosDBManager + .authenticate(credential, profile); +``` +[//]: # ({x-version-update-end}) + +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 + +If you would like to become an active contributor to this project please follow the instructions provided in [Microsoft +Azure Projects Contribution Guidelines](http://azure.github.io/guidelines.html). + +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 + + +[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/master/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/master/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..fa66b7b8279f9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/pom.xml @@ -0,0 +1,62 @@ + + 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. Azure Cosmos DB Database Service Resource Provider REST API. Package tag package-2020-09. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt + 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-management + 1.0.0 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + true + + + + + 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..b55d4f0d60b84 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/CosmosDBManager.java @@ -0,0 +1,445 @@ +// Copyright (c) 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.BearerTokenAuthenticationPolicy; +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.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.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.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 PrivateLinkResources privateLinkResources; + + private PrivateEndpointConnections privateEndpointConnections; + + 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 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; + } + + /** + * 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."); + + if (retryPolicy == null) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies + .add( + new UserAgentPolicy( + null, + "com.azure.resourcemanager.cosmos.generated", + "1.0.0-beta.1", + Configuration.getGlobalConfiguration())); + policies.add(new RequestIdPolicy()); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies + .add( + new BearerTokenAuthenticationPolicy( + credential, profile.getEnvironment().getManagementEndpoint() + "/.default")); + 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 PrivateLinkResources. */ + public PrivateLinkResources privateLinkResources() { + if (this.privateLinkResources == null) { + this.privateLinkResources = new PrivateLinkResourcesImpl(clientObject.getPrivateLinkResources(), this); + } + return privateLinkResources; + } + + /** @return Resource collection API of PrivateEndpointConnections. */ + public PrivateEndpointConnections privateEndpointConnections() { + if (this.privateEndpointConnections == null) { + this.privateEndpointConnections = + new PrivateEndpointConnectionsImpl(clientObject.getPrivateEndpointConnections(), this); + } + return privateEndpointConnections; + } + + /** + * @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..08a997206d24b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CassandraResourcesClient.java @@ -0,0 +1,946 @@ +// Copyright (c) Microsoft 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws 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..88d198af96974 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CosmosDBManagementClient.java @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.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 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 PrivateLinkResourcesClient object to access its operations. + * + * @return the PrivateLinkResourcesClient object. + */ + PrivateLinkResourcesClient getPrivateLinkResources(); + + /** + * Gets the PrivateEndpointConnectionsClient object to access its operations. + * + * @return the PrivateEndpointConnectionsClient object. + */ + PrivateEndpointConnectionsClient getPrivateEndpointConnections(); +} 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..85c4caa58019d --- /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 Parameters for patching Azure Cosmos DB database account properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the 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 Parameters for patching Azure Cosmos DB database account properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 Parameters for patching Azure Cosmos DB database account properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the 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 Parameters for patching Azure Cosmos DB database account properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 Parameters to create and update Cosmos DB database accounts. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the 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 Parameters to create and update Cosmos DB database accounts. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the 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 Parameters to create and update Cosmos DB database accounts. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the 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 Parameters to create and update Cosmos DB database accounts. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the 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 list of new failover policies for the failover priority change. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 list of new failover policies for the failover priority change. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 list of new failover policies for the failover priority change. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 list of new failover policies for the failover priority change. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 online or offline. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 online or offline. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 online or offline. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 online or offline. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 or offline. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 or offline. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 or offline. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 or offline. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 Parameters to regenerate the keys within 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> 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 Parameters to regenerate the keys within 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> 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 Parameters to regenerate the keys within 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 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 Parameters to regenerate the keys within 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 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..f9881a9307773 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/GremlinResourcesClient.java @@ -0,0 +1,939 @@ +// Copyright (c) Microsoft 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws 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..21a6496302935 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/MongoDBResourcesClient.java @@ -0,0 +1,946 @@ +// Copyright (c) Microsoft 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws 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..1e301428ed21d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/NotebookWorkspacesClient.java @@ -0,0 +1,371 @@ +// Copyright (c) Microsoft 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.ArmProxyResource; +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 resource model definition for a ARM proxy resource. It will have + * everything other than required location and tags. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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, + ArmProxyResource 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 resource model definition for a ARM proxy resource. It will have + * everything other than required location and tags. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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, + ArmProxyResource 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 resource model definition for a ARM proxy resource. It will have + * everything other than required location and tags. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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, + ArmProxyResource 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 resource model definition for a ARM proxy resource. It will have + * everything other than required location and tags. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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, + ArmProxyResource 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..1a4db42d6d312 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PrivateEndpointConnectionsClient.java @@ -0,0 +1,217 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.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.PrivateEndpointConnectionAutoGeneratedInner; + +/** 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) + PrivateEndpointConnectionAutoGeneratedInner 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, PrivateEndpointConnectionAutoGeneratedInner> + beginCreateOrUpdate( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionAutoGeneratedInner 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, PrivateEndpointConnectionAutoGeneratedInner> + beginCreateOrUpdate( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionAutoGeneratedInner 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) + PrivateEndpointConnectionAutoGeneratedInner createOrUpdate( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionAutoGeneratedInner 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) + PrivateEndpointConnectionAutoGeneratedInner createOrUpdate( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionAutoGeneratedInner 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/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..1771122690a73 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/SqlResourcesClient.java @@ -0,0 +1,1714 @@ +// Copyright (c) Microsoft 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.SqlContainerGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlDatabaseGetResultsInner; +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.SqlContainerCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.SqlDatabaseCreateUpdateParameters; +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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB + * 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 Parameters to create and update Cosmos DB + * 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 Parameters to create and update Cosmos DB + * 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 Parameters to create and update Cosmos DB + * 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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); +} 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..f9bf454220e8c --- /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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws 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/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..963345d4ec9d0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraKeyspaceGetResultsInner.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.CassandraKeyspaceGetPropertiesResource; +import com.azure.resourcemanager.cosmos.generated.models.OptionsResource; +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; + + /* + * Cosmos DB options resource object + */ + @JsonProperty(value = "properties.options", access = JsonProperty.Access.WRITE_ONLY) + private OptionsResource 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: Cosmos DB options resource object. + * + * @return the options value. + */ + public OptionsResource options() { + return this.options; + } + + /** {@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..d1ee38477ee9f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraTableGetResultsInner.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.CassandraTableGetPropertiesResource; +import com.azure.resourcemanager.cosmos.generated.models.OptionsResource; +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; + + /* + * Cosmos DB options resource object + */ + @JsonProperty(value = "properties.options", access = JsonProperty.Access.WRITE_ONLY) + private OptionsResource 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: Cosmos DB options resource object. + * + * @return the options value. + */ + public OptionsResource options() { + return this.options; + } + + /** {@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..28a5fac8c21be --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountGetResultsInner.java @@ -0,0 +1,706 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code 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.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.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.PrivateEndpointConnection; +import com.azure.resourcemanager.cosmos.generated.models.PublicNetworkAccess; +import com.azure.resourcemanager.cosmos.generated.models.VirtualNetworkRule; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +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; + + /* + * 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; + + /* + * Whether requests from Public Network are allowed + */ + @JsonProperty(value = "properties.publicNetworkAccess", access = JsonProperty.Access.WRITE_ONLY) + 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; + + /* + * 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; + + /** + * 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 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 publicNetworkAccess property: Whether requests from Public Network are allowed. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccess publicNetworkAccess() { + return this.publicNetworkAccess; + } + + /** + * 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 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; + } + + /** {@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 (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 (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/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..99f3eee560117 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/GremlinDatabaseGetResultsInner.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.GremlinDatabaseGetPropertiesResource; +import com.azure.resourcemanager.cosmos.generated.models.OptionsResource; +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; + + /* + * Cosmos DB options resource object + */ + @JsonProperty(value = "properties.options", access = JsonProperty.Access.WRITE_ONLY) + private OptionsResource 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: Cosmos DB options resource object. + * + * @return the options value. + */ + public OptionsResource options() { + return this.options; + } + + /** {@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..4bc819504d7db --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/GremlinGraphGetResultsInner.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.GremlinGraphGetPropertiesResource; +import com.azure.resourcemanager.cosmos.generated.models.OptionsResource; +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; + + /* + * Cosmos DB options resource object + */ + @JsonProperty(value = "properties.options", access = JsonProperty.Access.WRITE_ONLY) + private OptionsResource 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: Cosmos DB options resource object. + * + * @return the options value. + */ + public OptionsResource options() { + return this.options; + } + + /** {@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..ff0b29ee0b343 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoDBCollectionGetResultsInner.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBCollectionGetPropertiesResource; +import com.azure.resourcemanager.cosmos.generated.models.OptionsResource; +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; + + /* + * Cosmos DB options resource object + */ + @JsonProperty(value = "properties.options", access = JsonProperty.Access.WRITE_ONLY) + private OptionsResource 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: Cosmos DB options resource object. + * + * @return the options value. + */ + public OptionsResource options() { + return this.options; + } + + /** {@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..0905c49155ec4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoDBDatabaseGetResultsInner.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBDatabaseGetPropertiesResource; +import com.azure.resourcemanager.cosmos.generated.models.OptionsResource; +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; + + /* + * Cosmos DB options resource object + */ + @JsonProperty(value = "properties.options", access = JsonProperty.Access.WRITE_ONLY) + private OptionsResource 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: Cosmos DB options resource object. + * + * @return the options value. + */ + public OptionsResource options() { + return this.options; + } + + /** {@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/PrivateEndpointConnectionAutoGeneratedInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PrivateEndpointConnectionAutoGeneratedInner.java new file mode 100644 index 0000000000000..12b92ba6b2e73 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PrivateEndpointConnectionAutoGeneratedInner.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.PrivateLinkServiceConnectionStatePropertyAutoGenerated; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A private endpoint connection. */ +@JsonFlatten +@Fluent +public class PrivateEndpointConnectionAutoGeneratedInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionAutoGeneratedInner.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 PrivateLinkServiceConnectionStatePropertyAutoGenerated 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 PrivateEndpointConnectionAutoGeneratedInner object itself. + */ + public PrivateEndpointConnectionAutoGeneratedInner withPrivateEndpoint(PrivateEndpointProperty privateEndpoint) { + this.privateEndpoint = privateEndpoint; + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: Connection State of the Private Endpoint Connection. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateLinkServiceConnectionStatePropertyAutoGenerated privateLinkServiceConnectionState() { + return this.privateLinkServiceConnectionState; + } + + /** + * Set the privateLinkServiceConnectionState property: Connection State of the Private Endpoint Connection. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the PrivateEndpointConnectionAutoGeneratedInner object itself. + */ + public PrivateEndpointConnectionAutoGeneratedInner withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionStatePropertyAutoGenerated 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 PrivateEndpointConnectionAutoGeneratedInner object itself. + */ + public PrivateEndpointConnectionAutoGeneratedInner 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 PrivateEndpointConnectionAutoGeneratedInner object itself. + */ + public PrivateEndpointConnectionAutoGeneratedInner 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/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..4b8eacf1d8c86 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlContainerGetResultsInner.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.OptionsResource; +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; + + /* + * Cosmos DB options resource object + */ + @JsonProperty(value = "properties.options", access = JsonProperty.Access.WRITE_ONLY) + private OptionsResource 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: Cosmos DB options resource object. + * + * @return the options value. + */ + public OptionsResource options() { + return this.options; + } + + /** {@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..d6ec5e205fe57 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlDatabaseGetResultsInner.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.OptionsResource; +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; + + /* + * Cosmos DB options resource object + */ + @JsonProperty(value = "properties.options", access = JsonProperty.Access.WRITE_ONLY) + private OptionsResource 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: Cosmos DB options resource object. + * + * @return the options value. + */ + public OptionsResource options() { + return this.options; + } + + /** {@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/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..0d843c25fcea5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/TableGetResultsInner.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.OptionsResource; +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; + + /* + * Cosmos DB options resource object + */ + @JsonProperty(value = "properties.options", access = JsonProperty.Access.WRITE_ONLY) + private OptionsResource 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: Cosmos DB options resource object. + * + * @return the options value. + */ + public OptionsResource options() { + return this.options; + } + + /** {@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/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..8c2f6f7d4fea2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraKeyspaceGetResultsImpl.java @@ -0,0 +1,231 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.CosmosDBManager; +import com.azure.resourcemanager.cosmos.generated.fluent.models.CassandraKeyspaceGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.CassandraKeyspaceCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.CassandraKeyspaceGetPropertiesResource; +import com.azure.resourcemanager.cosmos.generated.models.CassandraKeyspaceGetResults; +import com.azure.resourcemanager.cosmos.generated.models.CassandraKeyspaceResource; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.OptionsResource; +import java.util.Collections; +import java.util.Map; + +public final class CassandraKeyspaceGetResultsImpl + implements CassandraKeyspaceGetResults, CassandraKeyspaceGetResults.Definition, CassandraKeyspaceGetResults.Update { + private CassandraKeyspaceGetResultsInner innerObject; + + private final 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 OptionsResource 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 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; + } + + public CassandraKeyspaceGetResultsImpl(String name, 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; + } + + public CassandraKeyspaceGetResultsImpl( + CassandraKeyspaceGetResultsInner innerObject, 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..f1e99809c2f2d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraResourcesClientImpl.java @@ -0,0 +1,4540 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listCassandraKeyspaces( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listCassandraKeyspaces( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getCassandraKeyspace( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getCassandraKeyspace( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + apiVersion, + 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 Parameters to create and update Cosmos DB 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createUpdateCassandraKeyspace( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + apiVersion, + createUpdateCassandraKeyspaceParameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or update an Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param createUpdateCassandraKeyspaceParameters Parameters to create and update Cosmos DB 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createUpdateCassandraKeyspace( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + apiVersion, + 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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.")); + } + final String apiVersion = "2020-09-01"; + return FluxUtil + .withContext( + context -> + service + .deleteCassandraKeyspace( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + apiVersion, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the 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.")); + } + final String apiVersion = "2020-09-01"; + context = this.client.mergeContext(context); + return service + .deleteCassandraKeyspace( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getCassandraKeyspaceThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getCassandraKeyspaceThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + apiVersion, + 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateCassandraKeyspaceThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + apiVersion, + updateThroughputParameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param updateThroughputParameters Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateCassandraKeyspaceThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + apiVersion, + 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateCassandraKeyspaceToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateCassandraKeyspaceToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateCassandraKeyspaceToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateCassandraKeyspaceToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listCassandraTables( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listCassandraTables( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getCassandraTable( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + tableName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getCassandraTable( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + tableName, + apiVersion, + 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 Parameters to create and update Cosmos DB 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createUpdateCassandraTable( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + tableName, + apiVersion, + createUpdateCassandraTableParameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or update an Azure Cosmos DB Cassandra Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param createUpdateCassandraTableParameters Parameters to create and update Cosmos DB 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createUpdateCassandraTable( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + tableName, + apiVersion, + 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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.")); + } + final String apiVersion = "2020-09-01"; + return FluxUtil + .withContext( + context -> + service + .deleteCassandraTable( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + tableName, + apiVersion, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the 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.")); + } + final String apiVersion = "2020-09-01"; + context = this.client.mergeContext(context); + return service + .deleteCassandraTable( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + tableName, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getCassandraTableThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + tableName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getCassandraTableThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + tableName, + apiVersion, + 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateCassandraTableThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + tableName, + apiVersion, + updateThroughputParameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateCassandraTableThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + tableName, + apiVersion, + 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateCassandraTableToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + tableName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateCassandraTableToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + tableName, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateCassandraTableToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + tableName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Migrate an Azure Cosmos DB Cassandra table from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateCassandraTableToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + tableName, + apiVersion, + 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..314478ded1be5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraResourcesImpl.java @@ -0,0 +1,658 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.CosmosDBManager; +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 CosmosDBManager serviceManager; + + public CassandraResourcesImpl(CassandraResourcesClient innerClient, CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listCassandraKeyspaces( + String resourceGroupName, String accountName) { + PagedIterable inner = + this.serviceClient().listCassandraKeyspaces(resourceGroupName, accountName); + return inner.mapPage(inner1 -> new CassandraKeyspaceGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listCassandraKeyspaces( + String resourceGroupName, String accountName, Context context) { + PagedIterable inner = + this.serviceClient().listCassandraKeyspaces(resourceGroupName, accountName, context); + return inner.mapPage(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 inner.mapPage(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 inner.mapPage(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 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..bc6640a50413a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraTableGetResultsImpl.java @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.CosmosDBManager; +import com.azure.resourcemanager.cosmos.generated.fluent.models.CassandraTableGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.CassandraTableCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.CassandraTableGetPropertiesResource; +import com.azure.resourcemanager.cosmos.generated.models.CassandraTableGetResults; +import com.azure.resourcemanager.cosmos.generated.models.CassandraTableResource; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.OptionsResource; +import java.util.Collections; +import java.util.Map; + +public final class CassandraTableGetResultsImpl + implements CassandraTableGetResults, CassandraTableGetResults.Definition, CassandraTableGetResults.Update { + private CassandraTableGetResultsInner innerObject; + + private final 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 OptionsResource 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 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; + } + + public CassandraTableGetResultsImpl(String name, 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; + } + + public CassandraTableGetResultsImpl(CassandraTableGetResultsInner innerObject, 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..d815bd0bbcb28 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionPartitionRegionsClientImpl.java @@ -0,0 +1,362 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + region, + databaseRid, + collectionRid, + apiVersion, + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + region, + databaseRid, + collectionRid, + apiVersion, + 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..1bbde7952292a --- /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.CosmosDBManager; +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 CosmosDBManager serviceManager; + + public CollectionPartitionRegionsImpl( + CollectionPartitionRegionsClient innerClient, 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 inner.mapPage(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 inner.mapPage(inner1 -> new PartitionMetricImpl(inner1, this.manager())); + } + + private CollectionPartitionRegionsClient serviceClient() { + return this.innerClient; + } + + private 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..2b134df31ebc8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionPartitionsClientImpl.java @@ -0,0 +1,598 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + collectionRid, + apiVersion, + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + collectionRid, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listUsages( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + collectionRid, + apiVersion, + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listUsages( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + collectionRid, + apiVersion, + 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..d09d96e6699fd --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionPartitionsImpl.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.CosmosDBManager; +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 CosmosDBManager serviceManager; + + public CollectionPartitionsImpl(CollectionPartitionsClient innerClient, 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 inner.mapPage(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 inner.mapPage(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 inner.mapPage(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 inner.mapPage(inner1 -> new PartitionUsageImpl(inner1, this.manager())); + } + + private CollectionPartitionsClient serviceClient() { + return this.innerClient; + } + + private 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..7c9cf2544fe09 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionRegionsClientImpl.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.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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + region, + databaseRid, + collectionRid, + apiVersion, + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + region, + databaseRid, + collectionRid, + apiVersion, + 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..a2ce6d44ffa31 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionRegionsImpl.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.CosmosDBManager; +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 CosmosDBManager serviceManager; + + public CollectionRegionsImpl(CollectionRegionsClient innerClient, 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 inner.mapPage(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 inner.mapPage(inner1 -> new MetricImpl(inner1, this.manager())); + } + + private CollectionRegionsClient serviceClient() { + return this.innerClient; + } + + private 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..b5aad4ca06145 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionsClientImpl.java @@ -0,0 +1,819 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + collectionRid, + apiVersion, + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + collectionRid, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listUsages( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + collectionRid, + apiVersion, + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listUsages( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + collectionRid, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetricDefinitions( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + collectionRid, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetricDefinitions( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + collectionRid, + apiVersion, + 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..cbc9db3ca3b09 --- /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.CosmosDBManager; +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 CosmosDBManager serviceManager; + + public CollectionsImpl(CollectionsClient innerClient, 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 inner.mapPage(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 inner.mapPage(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 inner.mapPage(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 inner.mapPage(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 inner.mapPage(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 inner.mapPage(inner1 -> new MetricDefinitionImpl(inner1, this.manager())); + } + + private CollectionsClient serviceClient() { + return this.innerClient; + } + + private 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..9f8b4a8689006 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CosmosDBManagementClientImpl.java @@ -0,0 +1,560 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.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; + } + + /** 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 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 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; + } + + /** + * 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.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.privateLinkResources = new PrivateLinkResourcesClientImpl(this); + this.privateEndpointConnections = new PrivateEndpointConnectionsClientImpl(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 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.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..4b899dffd274f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountGetResultsImpl.java @@ -0,0 +1,517 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.CosmosDBManager; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountGetResultsInner; +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.DatabaseAccountCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountGetResults; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountKind; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountOfferType; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountUpdateParameters; +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.PrivateEndpointConnection; +import com.azure.resourcemanager.cosmos.generated.models.PublicNetworkAccess; +import com.azure.resourcemanager.cosmos.generated.models.VirtualNetworkRule; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class DatabaseAccountGetResultsImpl + implements DatabaseAccountGetResults, DatabaseAccountGetResults.Definition, DatabaseAccountGetResults.Update { + private DatabaseAccountGetResultsInner innerObject; + + private final 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 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); + } 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 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 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 Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public DatabaseAccountGetResultsInner innerModel() { + return this.innerObject; + } + + private 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; + } + + public DatabaseAccountGetResultsImpl(String name, 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; + } + + public DatabaseAccountGetResultsImpl(DatabaseAccountGetResultsInner innerObject, 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 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 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 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 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; + } + } + + 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..f6d8e9c58151b --- /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.CosmosDBManager; +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 CosmosDBManager serviceManager; + + public DatabaseAccountListConnectionStringsResultImpl( + DatabaseAccountListConnectionStringsResultInner innerObject, 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 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..8c86f93f2cd59 --- /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.CosmosDBManager; +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 CosmosDBManager serviceManager; + + public DatabaseAccountListKeysResultImpl( + DatabaseAccountListKeysResultInner innerObject, 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 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..6d4d94d338d35 --- /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.CosmosDBManager; +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 CosmosDBManager serviceManager; + + public DatabaseAccountListReadOnlyKeysResultImpl( + DatabaseAccountListReadOnlyKeysResultInner innerObject, 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 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..cbca368bd3fc4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountRegionsClientImpl.java @@ -0,0 +1,291 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + region, + apiVersion, + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + region, + apiVersion, + 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..97caa145b436b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountRegionsImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.CosmosDBManager; +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 CosmosDBManager serviceManager; + + public DatabaseAccountRegionsImpl(DatabaseAccountRegionsClient innerClient, 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 inner.mapPage(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 inner.mapPage(inner1 -> new MetricImpl(inner1, this.manager())); + } + + private DatabaseAccountRegionsClient serviceClient() { + return this.innerClient; + } + + private 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..d7f6ec3aed1e7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountsClientImpl.java @@ -0,0 +1,3998 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + 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 Parameters for patching Azure Cosmos DB database account properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + updateParameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Updates the properties of an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param updateParameters Parameters for patching Azure Cosmos DB database account properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + 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 Parameters for patching Azure Cosmos DB database account properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the 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 Parameters for patching Azure Cosmos DB database account properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 Parameters for patching Azure Cosmos DB database account properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the 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 Parameters for patching Azure Cosmos DB database account properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 Parameters for patching Azure Cosmos DB database account properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the 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 Parameters for patching Azure Cosmos DB database account properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 Parameters for patching Azure Cosmos DB database account properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the 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 Parameters for patching Azure Cosmos DB database account properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 Parameters to create and update Cosmos DB database accounts. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + createUpdateParameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates + * on an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateParameters Parameters to create and update Cosmos DB database accounts. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + 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 Parameters to create and update Cosmos DB database accounts. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the 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 Parameters to create and update Cosmos DB database accounts. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the 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 Parameters to create and update Cosmos DB database accounts. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the 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 Parameters to create and update Cosmos DB database accounts. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the 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 Parameters to create and update Cosmos DB database accounts. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the 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 Parameters to create and update Cosmos DB database accounts. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the 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 Parameters to create and update Cosmos DB database accounts. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the 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 Parameters to create and update Cosmos DB database accounts. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the 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.")); + } + final String apiVersion = "2020-09-01"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the 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.")); + } + final String apiVersion = "2020-09-01"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + 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 list of new failover policies for the failover priority change. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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(); + } + final String apiVersion = "2020-09-01"; + return FluxUtil + .withContext( + context -> + service + .failoverPriorityChange( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + failoverParameters, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a + * write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values + * must be unique for each of the regions in which the database account exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param failoverParameters The list of new failover policies for the failover priority change. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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(); + } + final String apiVersion = "2020-09-01"; + context = this.client.mergeContext(context); + return service + .failoverPriorityChange( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + 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 list of new failover policies for the failover priority change. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 list of new failover policies for the failover priority change. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 list of new failover policies for the failover priority change. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 list of new failover policies for the failover priority change. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 list of new failover policies for the failover priority change. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 list of new failover policies for the failover priority change. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 list of new failover policies for the failover priority change. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 list of new failover policies for the failover priority change. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listKeys( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listKeys( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listConnectionStrings( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listConnectionStrings( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + 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 online or offline. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .offlineRegion( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + regionParameterForOffline, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Offline the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param regionParameterForOffline Cosmos DB region to online or offline. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .offlineRegion( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + 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 online or offline. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 online or offline. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 online or offline. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 online or offline. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 online or offline. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 online or offline. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 online or offline. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 online or offline. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 or offline. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .onlineRegion( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + regionParameterForOnline, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Online the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param regionParameterForOnline Cosmos DB region to online or offline. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .onlineRegion( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + 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 or offline. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 or offline. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 or offline. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 or offline. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 or offline. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 or offline. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 or offline. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 or offline. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getReadOnlyKeys( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getReadOnlyKeys( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listReadOnlyKeys( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listReadOnlyKeys( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + 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 Parameters to regenerate the keys within 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>> 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(); + } + final String apiVersion = "2020-09-01"; + return FluxUtil + .withContext( + context -> + service + .regenerateKey( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + keyToRegenerate, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Regenerates an access key for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyToRegenerate Parameters to regenerate the keys within 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>> 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(); + } + final String apiVersion = "2020-09-01"; + context = this.client.mergeContext(context); + return service + .regenerateKey( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + 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 Parameters to regenerate the keys within 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> 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 Parameters to regenerate the keys within 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> 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 Parameters to regenerate the keys within 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> 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 Parameters to regenerate the keys within 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> 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 Parameters to regenerate the keys within 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 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 Parameters to regenerate the keys within 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 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 Parameters to regenerate the keys within 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 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 Parameters to regenerate the keys within 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 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.")); + } + final String apiVersion = "2020-09-01"; + return FluxUtil + .withContext( + context -> service.checkNameExists(this.client.getEndpoint(), accountName, apiVersion, context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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.")); + } + final String apiVersion = "2020-09-01"; + context = this.client.mergeContext(context); + return service.checkNameExists(this.client.getEndpoint(), accountName, apiVersion, 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listUsages( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listUsages( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetricDefinitions( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetricDefinitions( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + 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..25dccfb091ffa --- /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.CosmosDBManager; +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 CosmosDBManager serviceManager; + + public DatabaseAccountsImpl(DatabaseAccountsClient innerClient, 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 delete(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 inner.mapPage(inner1 -> new DatabaseAccountGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return inner.mapPage(inner1 -> new DatabaseAccountGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName); + return inner.mapPage(inner1 -> new DatabaseAccountGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return inner.mapPage(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 inner.mapPage(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 inner.mapPage(inner1 -> new MetricImpl(inner1, this.manager())); + } + + public PagedIterable listUsages(String resourceGroupName, String accountName) { + PagedIterable inner = this.serviceClient().listUsages(resourceGroupName, accountName); + return inner.mapPage(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 inner.mapPage(inner1 -> new UsageImpl(inner1, this.manager())); + } + + public PagedIterable listMetricDefinitions(String resourceGroupName, String accountName) { + PagedIterable inner = + this.serviceClient().listMetricDefinitions(resourceGroupName, accountName); + return inner.mapPage(inner1 -> new MetricDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, Context context) { + PagedIterable inner = + this.serviceClient().listMetricDefinitions(resourceGroupName, accountName, context); + return inner.mapPage(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 CosmosDBManager manager() { + return this.serviceManager; + } + + public DatabaseAccountGetResultsImpl define(String name) { + return new DatabaseAccountGetResultsImpl(name, this.manager()); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabasesClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabasesClientImpl.java new file mode 100644 index 0000000000000..3141da6ec5966 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabasesClientImpl.java @@ -0,0 +1,726 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + apiVersion, + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listUsages( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + apiVersion, + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listUsages( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetricDefinitions( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetricDefinitions( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + apiVersion, + 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..46cac33d71810 --- /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.CosmosDBManager; +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 CosmosDBManager serviceManager; + + public DatabasesImpl(DatabasesClient innerClient, 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 inner.mapPage(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 inner.mapPage(inner1 -> new MetricImpl(inner1, this.manager())); + } + + public PagedIterable listUsages(String resourceGroupName, String accountName, String databaseRid) { + PagedIterable inner = this.serviceClient().listUsages(resourceGroupName, accountName, databaseRid); + return inner.mapPage(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 inner.mapPage(inner1 -> new UsageImpl(inner1, this.manager())); + } + + public PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, String databaseRid) { + PagedIterable inner = + this.serviceClient().listMetricDefinitions(resourceGroupName, accountName, databaseRid); + return inner.mapPage(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 inner.mapPage(inner1 -> new MetricDefinitionImpl(inner1, this.manager())); + } + + private DatabasesClient serviceClient() { + return this.innerClient; + } + + private 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..b54289855c119 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/GremlinDatabaseGetResultsImpl.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.CosmosDBManager; +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.GremlinDatabaseGetPropertiesResource; +import com.azure.resourcemanager.cosmos.generated.models.GremlinDatabaseGetResults; +import com.azure.resourcemanager.cosmos.generated.models.GremlinDatabaseResource; +import com.azure.resourcemanager.cosmos.generated.models.OptionsResource; +import java.util.Collections; +import java.util.Map; + +public final class GremlinDatabaseGetResultsImpl + implements GremlinDatabaseGetResults, GremlinDatabaseGetResults.Definition, GremlinDatabaseGetResults.Update { + private GremlinDatabaseGetResultsInner innerObject; + + private final 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 OptionsResource 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 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; + } + + public GremlinDatabaseGetResultsImpl(String name, 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; + } + + public GremlinDatabaseGetResultsImpl(GremlinDatabaseGetResultsInner innerObject, 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..3eb2ba473a334 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/GremlinGraphGetResultsImpl.java @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.CosmosDBManager; +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.GremlinGraphGetPropertiesResource; +import com.azure.resourcemanager.cosmos.generated.models.GremlinGraphGetResults; +import com.azure.resourcemanager.cosmos.generated.models.GremlinGraphResource; +import com.azure.resourcemanager.cosmos.generated.models.OptionsResource; +import java.util.Collections; +import java.util.Map; + +public final class GremlinGraphGetResultsImpl + implements GremlinGraphGetResults, GremlinGraphGetResults.Definition, GremlinGraphGetResults.Update { + private GremlinGraphGetResultsInner innerObject; + + private final 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 OptionsResource 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 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; + } + + public GremlinGraphGetResultsImpl(String name, 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; + } + + public GremlinGraphGetResultsImpl(GremlinGraphGetResultsInner innerObject, 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..eb2d96ad34c6c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/GremlinResourcesClientImpl.java @@ -0,0 +1,4524 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listGremlinDatabases( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listGremlinDatabases( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getGremlinDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getGremlinDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + 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 Parameters to create and update Cosmos DB 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createUpdateGremlinDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + createUpdateGremlinDatabaseParameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or update an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateGremlinDatabaseParameters Parameters to create and update Cosmos DB 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createUpdateGremlinDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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.")); + } + final String apiVersion = "2020-09-01"; + return FluxUtil + .withContext( + context -> + service + .deleteGremlinDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the 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.")); + } + final String apiVersion = "2020-09-01"; + context = this.client.mergeContext(context); + return service + .deleteGremlinDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getGremlinDatabaseThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getGremlinDatabaseThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateGremlinDatabaseThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + updateThroughputParameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateGremlinDatabaseThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateGremlinDatabaseToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Migrate an Azure Cosmos DB Gremlin database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateGremlinDatabaseToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateGremlinDatabaseToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Migrate an Azure Cosmos DB Gremlin database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateGremlinDatabaseToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listGremlinGraphs( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listGremlinGraphs( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getGremlinGraph( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + graphName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getGremlinGraph( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + graphName, + apiVersion, + 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 Parameters to create and update Cosmos DB 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createUpdateGremlinGraph( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + graphName, + apiVersion, + createUpdateGremlinGraphParameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or update an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param createUpdateGremlinGraphParameters Parameters to create and update Cosmos DB 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createUpdateGremlinGraph( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + graphName, + apiVersion, + 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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.")); + } + final String apiVersion = "2020-09-01"; + return FluxUtil + .withContext( + context -> + service + .deleteGremlinGraph( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + graphName, + apiVersion, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the 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.")); + } + final String apiVersion = "2020-09-01"; + context = this.client.mergeContext(context); + return service + .deleteGremlinGraph( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + graphName, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getGremlinGraphThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + graphName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getGremlinGraphThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + graphName, + apiVersion, + 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateGremlinGraphThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + graphName, + apiVersion, + updateThroughputParameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param updateThroughputParameters Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateGremlinGraphThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + graphName, + apiVersion, + 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateGremlinGraphToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + graphName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateGremlinGraphToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + graphName, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateGremlinGraphToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + graphName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateGremlinGraphToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + graphName, + apiVersion, + 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..a22eba09e2b81 --- /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.CosmosDBManager; +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 CosmosDBManager serviceManager; + + public GremlinResourcesImpl(GremlinResourcesClient innerClient, CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listGremlinDatabases(String resourceGroupName, String accountName) { + PagedIterable inner = + this.serviceClient().listGremlinDatabases(resourceGroupName, accountName); + return inner.mapPage(inner1 -> new GremlinDatabaseGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listGremlinDatabases( + String resourceGroupName, String accountName, Context context) { + PagedIterable inner = + this.serviceClient().listGremlinDatabases(resourceGroupName, accountName, context); + return inner.mapPage(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 inner.mapPage(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 inner.mapPage(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 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..f49edfcdf2590 --- /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.CosmosDBManager; +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 CosmosDBManager serviceManager; + + public MetricDefinitionImpl(MetricDefinitionInner innerObject, 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 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..406232b4e1318 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MetricImpl.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.CosmosDBManager; +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 CosmosDBManager serviceManager; + + public MetricImpl(MetricInner innerObject, 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 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..3bc83a89e5f12 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MongoDBCollectionGetResultsImpl.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.CosmosDBManager; +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.MongoDBCollectionGetPropertiesResource; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBCollectionGetResults; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBCollectionResource; +import com.azure.resourcemanager.cosmos.generated.models.OptionsResource; +import java.util.Collections; +import java.util.Map; + +public final class MongoDBCollectionGetResultsImpl + implements MongoDBCollectionGetResults, MongoDBCollectionGetResults.Definition, MongoDBCollectionGetResults.Update { + private MongoDBCollectionGetResultsInner innerObject; + + private final 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 OptionsResource 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 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; + } + + public MongoDBCollectionGetResultsImpl(String name, 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; + } + + public MongoDBCollectionGetResultsImpl( + MongoDBCollectionGetResultsInner innerObject, 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..8443ed82e8a7e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MongoDBDatabaseGetResultsImpl.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.CosmosDBManager; +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.MongoDBDatabaseGetPropertiesResource; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBDatabaseGetResults; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBDatabaseResource; +import com.azure.resourcemanager.cosmos.generated.models.OptionsResource; +import java.util.Collections; +import java.util.Map; + +public final class MongoDBDatabaseGetResultsImpl + implements MongoDBDatabaseGetResults, MongoDBDatabaseGetResults.Definition, MongoDBDatabaseGetResults.Update { + private MongoDBDatabaseGetResultsInner innerObject; + + private final 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 OptionsResource 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 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; + } + + public MongoDBDatabaseGetResultsImpl(String name, 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; + } + + public MongoDBDatabaseGetResultsImpl(MongoDBDatabaseGetResultsInner innerObject, 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..99510a800764a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MongoDBResourcesClientImpl.java @@ -0,0 +1,4569 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMongoDBDatabases( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMongoDBDatabases( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getMongoDBDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getMongoDBDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + 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 Parameters to create and update Cosmos DB 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createUpdateMongoDBDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + createUpdateMongoDBDatabaseParameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or updates Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateMongoDBDatabaseParameters Parameters to create and update Cosmos DB 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createUpdateMongoDBDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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.")); + } + final String apiVersion = "2020-09-01"; + return FluxUtil + .withContext( + context -> + service + .deleteMongoDBDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the 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.")); + } + final String apiVersion = "2020-09-01"; + context = this.client.mergeContext(context); + return service + .deleteMongoDBDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getMongoDBDatabaseThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getMongoDBDatabaseThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateMongoDBDatabaseThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + updateThroughputParameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Update RUs per second of the an Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateMongoDBDatabaseThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateMongoDBDatabaseToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Migrate an Azure Cosmos DB MongoDB database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateMongoDBDatabaseToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateMongoDBDatabaseToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Migrate an Azure Cosmos DB MongoDB database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateMongoDBDatabaseToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMongoDBCollections( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMongoDBCollections( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getMongoDBCollection( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + collectionName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getMongoDBCollection( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + collectionName, + apiVersion, + 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 Parameters to create and update Cosmos DB 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createUpdateMongoDBCollection( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + collectionName, + apiVersion, + createUpdateMongoDBCollectionParameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or update an Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param createUpdateMongoDBCollectionParameters Parameters to create and update Cosmos DB 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createUpdateMongoDBCollection( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + collectionName, + apiVersion, + 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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.")); + } + final String apiVersion = "2020-09-01"; + return FluxUtil + .withContext( + context -> + service + .deleteMongoDBCollection( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + collectionName, + apiVersion, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the 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.")); + } + final String apiVersion = "2020-09-01"; + context = this.client.mergeContext(context); + return service + .deleteMongoDBCollection( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + collectionName, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getMongoDBCollectionThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + collectionName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getMongoDBCollectionThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + collectionName, + apiVersion, + 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateMongoDBCollectionThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + collectionName, + apiVersion, + updateThroughputParameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Update the RUs per second of an Azure Cosmos DB MongoDB collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param updateThroughputParameters Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateMongoDBCollectionThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + collectionName, + apiVersion, + 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateMongoDBCollectionToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + collectionName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Migrate an Azure Cosmos DB MongoDB collection from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateMongoDBCollectionToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + collectionName, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateMongoDBCollectionToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + collectionName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Migrate an Azure Cosmos DB MongoDB collection from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateMongoDBCollectionToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + collectionName, + apiVersion, + 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..6dab9d86dfeb5 --- /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.CosmosDBManager; +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 CosmosDBManager serviceManager; + + public MongoDBResourcesImpl(MongoDBResourcesClient innerClient, CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listMongoDBDatabases(String resourceGroupName, String accountName) { + PagedIterable inner = + this.serviceClient().listMongoDBDatabases(resourceGroupName, accountName); + return inner.mapPage(inner1 -> new MongoDBDatabaseGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listMongoDBDatabases( + String resourceGroupName, String accountName, Context context) { + PagedIterable inner = + this.serviceClient().listMongoDBDatabases(resourceGroupName, accountName, context); + return inner.mapPage(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 inner.mapPage(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 inner.mapPage(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 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..d02e53b885b42 --- /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.CosmosDBManager; +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 CosmosDBManager serviceManager; + + public NotebookWorkspaceConnectionInfoResultImpl( + NotebookWorkspaceConnectionInfoResultInner innerObject, 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 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..593595bc17e17 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/NotebookWorkspaceImpl.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.CosmosDBManager; +import com.azure.resourcemanager.cosmos.generated.fluent.models.NotebookWorkspaceInner; +import com.azure.resourcemanager.cosmos.generated.models.ArmProxyResource; +import com.azure.resourcemanager.cosmos.generated.models.NotebookWorkspace; +import com.azure.resourcemanager.cosmos.generated.models.NotebookWorkspaceName; + +public final class NotebookWorkspaceImpl + implements NotebookWorkspace, NotebookWorkspace.Definition, NotebookWorkspace.Update { + private NotebookWorkspaceInner innerObject; + + private final 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 CosmosDBManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String accountName; + + private NotebookWorkspaceName notebookWorkspaceName; + + private ArmProxyResource createNotebookCreateUpdateParameters; + + private ArmProxyResource 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; + } + + public NotebookWorkspaceImpl(NotebookWorkspaceName name, CosmosDBManager serviceManager) { + this.innerObject = new NotebookWorkspaceInner(); + this.serviceManager = serviceManager; + this.notebookWorkspaceName = name; + this.createNotebookCreateUpdateParameters = new ArmProxyResource(); + } + + public NotebookWorkspaceImpl update() { + this.updateNotebookCreateUpdateParameters = new ArmProxyResource(); + 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; + } + + public NotebookWorkspaceImpl(NotebookWorkspaceInner innerObject, 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; + } +} 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..691aef3e1c797 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/NotebookWorkspacesClientImpl.java @@ -0,0 +1,1823 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.ArmProxyResource; +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") ArmProxyResource 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabaseAccount( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + accountName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabaseAccount( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + accountName, + notebookWorkspaceName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + 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 resource model definition for a ARM proxy resource. It will have + * everything other than required location and tags. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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, + ArmProxyResource 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + accountName, + notebookWorkspaceName, + notebookCreateUpdateParameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Creates the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param notebookCreateUpdateParameters The resource model definition for a ARM proxy resource. It will have + * everything other than required location and tags. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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, + ArmProxyResource 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + 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 resource model definition for a ARM proxy resource. It will have + * everything other than required location and tags. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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, + ArmProxyResource 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 resource model definition for a ARM proxy resource. It will have + * everything other than required location and tags. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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, + ArmProxyResource 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 resource model definition for a ARM proxy resource. It will have + * everything other than required location and tags. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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, + ArmProxyResource 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 resource model definition for a ARM proxy resource. It will have + * everything other than required location and tags. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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, + ArmProxyResource 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 resource model definition for a ARM proxy resource. It will have + * everything other than required location and tags. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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, + ArmProxyResource 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 resource model definition for a ARM proxy resource. It will have + * everything other than required location and tags. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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, + ArmProxyResource 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 resource model definition for a ARM proxy resource. It will have + * everything other than required location and tags. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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, + ArmProxyResource 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 resource model definition for a ARM proxy resource. It will have + * everything other than required location and tags. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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, + ArmProxyResource 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + accountName, + notebookWorkspaceName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listConnectionInfo( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + accountName, + notebookWorkspaceName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listConnectionInfo( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .regenerateAuthToken( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + accountName, + notebookWorkspaceName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Regenerates the auth token for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .regenerateAuthToken( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .start( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + accountName, + notebookWorkspaceName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Starts the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .start( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + 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..e30e332fc8210 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/NotebookWorkspacesImpl.java @@ -0,0 +1,263 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.CosmosDBManager; +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 CosmosDBManager serviceManager; + + public NotebookWorkspacesImpl(NotebookWorkspacesClient innerClient, CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByDatabaseAccount(String resourceGroupName, String accountName) { + PagedIterable inner = + this.serviceClient().listByDatabaseAccount(resourceGroupName, accountName); + return inner.mapPage(inner1 -> new NotebookWorkspaceImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabaseAccount( + String resourceGroupName, String accountName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabaseAccount(resourceGroupName, accountName, context); + return inner.mapPage(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 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..d4b098e10ad1b --- /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.CosmosDBManager; +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 CosmosDBManager serviceManager; + + public OperationImpl(OperationInner innerObject, 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 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..2dbdcd89fa6fb --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/OperationsClientImpl.java @@ -0,0 +1,270 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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..f61d354fffc8f --- /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.CosmosDBManager; +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 CosmosDBManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return inner.mapPage(inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return inner.mapPage(inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private 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..0c06f63b238f3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionKeyRangeIdRegionsClientImpl.java @@ -0,0 +1,402 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + region, + databaseRid, + collectionRid, + partitionKeyRangeId, + apiVersion, + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + 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, + apiVersion, + 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..6dd3bdc004ddb --- /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.CosmosDBManager; +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 CosmosDBManager serviceManager; + + public PartitionKeyRangeIdRegionsImpl( + PartitionKeyRangeIdRegionsClient innerClient, 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 inner.mapPage(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 inner.mapPage(inner1 -> new PartitionMetricImpl(inner1, this.manager())); + } + + private PartitionKeyRangeIdRegionsClient serviceClient() { + return this.innerClient; + } + + private 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..62354b6743141 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionKeyRangeIdsClientImpl.java @@ -0,0 +1,365 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + collectionRid, + partitionKeyRangeId, + apiVersion, + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + collectionRid, + partitionKeyRangeId, + apiVersion, + 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..8d2b39795a44c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionKeyRangeIdsImpl.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.CosmosDBManager; +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 CosmosDBManager serviceManager; + + public PartitionKeyRangeIdsImpl(PartitionKeyRangeIdsClient innerClient, 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 inner.mapPage(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 inner.mapPage(inner1 -> new PartitionMetricImpl(inner1, this.manager())); + } + + private PartitionKeyRangeIdsClient serviceClient() { + return this.innerClient; + } + + private 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..59f01e181dcfc --- /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.CosmosDBManager; +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 CosmosDBManager serviceManager; + + public PartitionMetricImpl(PartitionMetricInner innerObject, 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 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..edbff129f7964 --- /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.CosmosDBManager; +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 CosmosDBManager serviceManager; + + public PartitionUsageImpl(PartitionUsageInner innerObject, 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 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..ef251c29126e9 --- /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.CosmosDBManager; +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 CosmosDBManager serviceManager; + + public PercentileMetricImpl(PercentileMetricInner innerObject, 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 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..206bcd5fa6e25 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileSourceTargetsClientImpl.java @@ -0,0 +1,345 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + sourceRegion, + targetRegion, + apiVersion, + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + sourceRegion, + targetRegion, + apiVersion, + 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..ca73881fb9525 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileSourceTargetsImpl.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.CosmosDBManager; +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 CosmosDBManager serviceManager; + + public PercentileSourceTargetsImpl(PercentileSourceTargetsClient innerClient, 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 inner.mapPage(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 inner.mapPage(inner1 -> new PercentileMetricImpl(inner1, this.manager())); + } + + private PercentileSourceTargetsClient serviceClient() { + return this.innerClient; + } + + private 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..666b4d9ec7c70 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileTargetsClientImpl.java @@ -0,0 +1,302 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + targetRegion, + apiVersion, + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + targetRegion, + apiVersion, + 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..7725b1bd027a7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileTargetsImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.CosmosDBManager; +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 CosmosDBManager serviceManager; + + public PercentileTargetsImpl(PercentileTargetsClient innerClient, 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 inner.mapPage(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 inner.mapPage(inner1 -> new PercentileMetricImpl(inner1, this.manager())); + } + + private PercentileTargetsClient serviceClient() { + return this.innerClient; + } + + private 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..fe2c66ff8e878 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentilesClientImpl.java @@ -0,0 +1,280 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + 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..4358cdfe781d5 --- /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.CosmosDBManager; +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 CosmosDBManager serviceManager; + + public PercentilesImpl(PercentilesClient innerClient, 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 inner.mapPage(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 inner.mapPage(inner1 -> new PercentileMetricImpl(inner1, this.manager())); + } + + private PercentilesClient serviceClient() { + return this.innerClient; + } + + private CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateEndpointConnectionAutoGeneratedImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateEndpointConnectionAutoGeneratedImpl.java new file mode 100644 index 0000000000000..cb906e9df5eb9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateEndpointConnectionAutoGeneratedImpl.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.CosmosDBManager; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PrivateEndpointConnectionAutoGeneratedInner; +import com.azure.resourcemanager.cosmos.generated.models.PrivateEndpointConnectionAutoGenerated; +import com.azure.resourcemanager.cosmos.generated.models.PrivateEndpointProperty; +import com.azure.resourcemanager.cosmos.generated.models.PrivateLinkServiceConnectionStatePropertyAutoGenerated; + +public final class PrivateEndpointConnectionAutoGeneratedImpl + implements PrivateEndpointConnectionAutoGenerated, + PrivateEndpointConnectionAutoGenerated.Definition, + PrivateEndpointConnectionAutoGenerated.Update { + private PrivateEndpointConnectionAutoGeneratedInner innerObject; + + private final 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 PrivateLinkServiceConnectionStatePropertyAutoGenerated privateLinkServiceConnectionState() { + return this.innerModel().privateLinkServiceConnectionState(); + } + + public String groupId() { + return this.innerModel().groupId(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public PrivateEndpointConnectionAutoGeneratedInner innerModel() { + return this.innerObject; + } + + private CosmosDBManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String accountName; + + private String privateEndpointConnectionName; + + public PrivateEndpointConnectionAutoGeneratedImpl withExistingDatabaseAccount( + String resourceGroupName, String accountName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + return this; + } + + public PrivateEndpointConnectionAutoGenerated create() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .createOrUpdate( + resourceGroupName, accountName, privateEndpointConnectionName, this.innerModel(), Context.NONE); + return this; + } + + public PrivateEndpointConnectionAutoGenerated create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .createOrUpdate( + resourceGroupName, accountName, privateEndpointConnectionName, this.innerModel(), context); + return this; + } + + public PrivateEndpointConnectionAutoGeneratedImpl(String name, CosmosDBManager serviceManager) { + this.innerObject = new PrivateEndpointConnectionAutoGeneratedInner(); + this.serviceManager = serviceManager; + this.privateEndpointConnectionName = name; + } + + public PrivateEndpointConnectionAutoGeneratedImpl update() { + return this; + } + + public PrivateEndpointConnectionAutoGenerated apply() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .createOrUpdate( + resourceGroupName, accountName, privateEndpointConnectionName, this.innerModel(), Context.NONE); + return this; + } + + public PrivateEndpointConnectionAutoGenerated apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .createOrUpdate( + resourceGroupName, accountName, privateEndpointConnectionName, this.innerModel(), context); + return this; + } + + public PrivateEndpointConnectionAutoGeneratedImpl( + PrivateEndpointConnectionAutoGeneratedInner innerObject, 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 PrivateEndpointConnectionAutoGenerated refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .getWithResponse(resourceGroupName, accountName, privateEndpointConnectionName, Context.NONE) + .getValue(); + return this; + } + + public PrivateEndpointConnectionAutoGenerated refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .getWithResponse(resourceGroupName, accountName, privateEndpointConnectionName, context) + .getValue(); + return this; + } + + public PrivateEndpointConnectionAutoGeneratedImpl withPrivateEndpoint(PrivateEndpointProperty privateEndpoint) { + this.innerModel().withPrivateEndpoint(privateEndpoint); + return this; + } + + public PrivateEndpointConnectionAutoGeneratedImpl withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionStatePropertyAutoGenerated privateLinkServiceConnectionState) { + this.innerModel().withPrivateLinkServiceConnectionState(privateLinkServiceConnectionState); + return this; + } + + public PrivateEndpointConnectionAutoGeneratedImpl withGroupId(String groupId) { + this.innerModel().withGroupId(groupId); + return this; + } + + public PrivateEndpointConnectionAutoGeneratedImpl 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..28e6122d6035f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateEndpointConnectionsClientImpl.java @@ -0,0 +1,1085 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.PrivateEndpointConnectionAutoGeneratedInner; +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") PrivateEndpointConnectionAutoGeneratedInner 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 apiVersion = "2019-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabaseAccount( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + accountName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2019-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabaseAccount( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + 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 apiVersion = "2019-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + accountName, + privateEndpointConnectionName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2019-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + 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 PrivateEndpointConnectionAutoGeneratedInner 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, + PrivateEndpointConnectionAutoGeneratedInner 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 apiVersion = "2019-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + accountName, + privateEndpointConnectionName, + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters A private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionAutoGeneratedInner 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 apiVersion = "2019-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + 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< + PollResult, PrivateEndpointConnectionAutoGeneratedInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionAutoGeneratedInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, accountName, privateEndpointConnectionName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + PrivateEndpointConnectionAutoGeneratedInner.class, + PrivateEndpointConnectionAutoGeneratedInner.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< + PollResult, PrivateEndpointConnectionAutoGeneratedInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionAutoGeneratedInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, accountName, privateEndpointConnectionName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + PrivateEndpointConnectionAutoGeneratedInner.class, + PrivateEndpointConnectionAutoGeneratedInner.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< + PollResult, PrivateEndpointConnectionAutoGeneratedInner> + beginCreateOrUpdate( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionAutoGeneratedInner 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< + PollResult, PrivateEndpointConnectionAutoGeneratedInner> + beginCreateOrUpdate( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionAutoGeneratedInner 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, + PrivateEndpointConnectionAutoGeneratedInner 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, + PrivateEndpointConnectionAutoGeneratedInner 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 PrivateEndpointConnectionAutoGeneratedInner createOrUpdate( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionAutoGeneratedInner 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 PrivateEndpointConnectionAutoGeneratedInner createOrUpdate( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionAutoGeneratedInner 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 apiVersion = "2019-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + accountName, + privateEndpointConnectionName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the 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 apiVersion = "2019-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + 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..39c2a0e66a56c --- /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.CosmosDBManager; +import com.azure.resourcemanager.cosmos.generated.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PrivateEndpointConnectionAutoGeneratedInner; +import com.azure.resourcemanager.cosmos.generated.models.PrivateEndpointConnectionAutoGenerated; +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 CosmosDBManager serviceManager; + + public PrivateEndpointConnectionsImpl( + PrivateEndpointConnectionsClient innerClient, CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByDatabaseAccount( + String resourceGroupName, String accountName) { + PagedIterable inner = + this.serviceClient().listByDatabaseAccount(resourceGroupName, accountName); + return inner.mapPage(inner1 -> new PrivateEndpointConnectionAutoGeneratedImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabaseAccount( + String resourceGroupName, String accountName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabaseAccount(resourceGroupName, accountName, context); + return inner.mapPage(inner1 -> new PrivateEndpointConnectionAutoGeneratedImpl(inner1, this.manager())); + } + + public PrivateEndpointConnectionAutoGenerated get( + String resourceGroupName, String accountName, String privateEndpointConnectionName) { + PrivateEndpointConnectionAutoGeneratedInner inner = + this.serviceClient().get(resourceGroupName, accountName, privateEndpointConnectionName); + if (inner != null) { + return new PrivateEndpointConnectionAutoGeneratedImpl(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 PrivateEndpointConnectionAutoGeneratedImpl(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 PrivateEndpointConnectionAutoGenerated 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 CosmosDBManager manager() { + return this.serviceManager; + } + + public PrivateEndpointConnectionAutoGeneratedImpl define(String name) { + return new PrivateEndpointConnectionAutoGeneratedImpl(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..efb4f8efe35cf --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateLinkResourceImpl.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.CosmosDBManager; +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 CosmosDBManager serviceManager; + + public PrivateLinkResourceImpl(PrivateLinkResourceInner innerObject, 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 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..b766b5a822a2d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateLinkResourcesClientImpl.java @@ -0,0 +1,427 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 apiVersion = "2019-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabaseAccount( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + accountName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2019-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabaseAccount( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + 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 apiVersion = "2019-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + accountName, + groupName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2019-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + 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..0b022059bf1eb --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateLinkResourcesImpl.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.CosmosDBManager; +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 CosmosDBManager serviceManager; + + public PrivateLinkResourcesImpl(PrivateLinkResourcesClient innerClient, CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByDatabaseAccount(String resourceGroupName, String accountName) { + PagedIterable inner = + this.serviceClient().listByDatabaseAccount(resourceGroupName, accountName); + return inner.mapPage(inner1 -> new PrivateLinkResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabaseAccount( + String resourceGroupName, String accountName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabaseAccount(resourceGroupName, accountName, context); + return inner.mapPage(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 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..670127a8c76e5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlContainerGetResultsImpl.java @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.CosmosDBManager; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlContainerGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.OptionsResource; +import com.azure.resourcemanager.cosmos.generated.models.SqlContainerCreateUpdateParameters; +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 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 OptionsResource 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 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; + } + + public SqlContainerGetResultsImpl(String name, 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; + } + + public SqlContainerGetResultsImpl(SqlContainerGetResultsInner innerObject, 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 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..785f6b85b4ace --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlDatabaseGetResultsImpl.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.CosmosDBManager; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlDatabaseGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.OptionsResource; +import com.azure.resourcemanager.cosmos.generated.models.SqlDatabaseCreateUpdateParameters; +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 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 OptionsResource 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 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; + } + + public SqlDatabaseGetResultsImpl(String name, 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; + } + + public SqlDatabaseGetResultsImpl(SqlDatabaseGetResultsInner innerObject, 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..54a198ffe74dc --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlResourcesClientImpl.java @@ -0,0 +1,8408 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.SqlContainerGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlDatabaseGetResultsInner; +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.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.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); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listSqlDatabases( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listSqlDatabases( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getSqlDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getSqlDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + 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 Parameters to create and update Cosmos DB 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createUpdateSqlDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + createUpdateSqlDatabaseParameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or update an Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateSqlDatabaseParameters Parameters to create and update Cosmos DB 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createUpdateSqlDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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.")); + } + final String apiVersion = "2020-09-01"; + return FluxUtil + .withContext( + context -> + service + .deleteSqlDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the 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.")); + } + final String apiVersion = "2020-09-01"; + context = this.client.mergeContext(context); + return service + .deleteSqlDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getSqlDatabaseThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getSqlDatabaseThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateSqlDatabaseThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + updateThroughputParameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateSqlDatabaseThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateSqlDatabaseToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Migrate an Azure Cosmos DB SQL database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateSqlDatabaseToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateSqlDatabaseToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Migrate an Azure Cosmos DB SQL database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateSqlDatabaseToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listSqlContainers( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listSqlContainers( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getSqlContainer( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getSqlContainer( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + apiVersion, + 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 Parameters to create and update Cosmos DB 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createUpdateSqlContainer( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + apiVersion, + createUpdateSqlContainerParameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or update an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param createUpdateSqlContainerParameters Parameters to create and update Cosmos DB 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createUpdateSqlContainer( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + apiVersion, + 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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.")); + } + final String apiVersion = "2020-09-01"; + return FluxUtil + .withContext( + context -> + service + .deleteSqlContainer( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + apiVersion, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes an existing Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the 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.")); + } + final String apiVersion = "2020-09-01"; + context = this.client.mergeContext(context); + return service + .deleteSqlContainer( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getSqlContainerThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getSqlContainerThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + apiVersion, + 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateSqlContainerThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + apiVersion, + updateThroughputParameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param updateThroughputParameters Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateSqlContainerThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + apiVersion, + 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateSqlContainerToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Migrate an Azure Cosmos DB SQL container from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateSqlContainerToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateSqlContainerToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Migrate an Azure Cosmos DB SQL container from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateSqlContainerToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listSqlStoredProcedures( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listSqlStoredProcedures( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getSqlStoredProcedure( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + storedProcedureName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getSqlStoredProcedure( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + storedProcedureName, + apiVersion, + 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 Parameters to create and update Cosmos DB 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createUpdateSqlStoredProcedure( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + storedProcedureName, + apiVersion, + createUpdateSqlStoredProcedureParameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or update an Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @param createUpdateSqlStoredProcedureParameters Parameters to create and update Cosmos DB 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createUpdateSqlStoredProcedure( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + storedProcedureName, + apiVersion, + 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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.")); + } + final String apiVersion = "2020-09-01"; + return FluxUtil + .withContext( + context -> + service + .deleteSqlStoredProcedure( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + storedProcedureName, + apiVersion, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the 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.")); + } + final String apiVersion = "2020-09-01"; + context = this.client.mergeContext(context); + return service + .deleteSqlStoredProcedure( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + storedProcedureName, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listSqlUserDefinedFunctions( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listSqlUserDefinedFunctions( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getSqlUserDefinedFunction( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + userDefinedFunctionName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getSqlUserDefinedFunction( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + userDefinedFunctionName, + apiVersion, + 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 Parameters to create and update Cosmos DB + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createUpdateSqlUserDefinedFunction( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + userDefinedFunctionName, + apiVersion, + createUpdateSqlUserDefinedFunctionParameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or update an Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param createUpdateSqlUserDefinedFunctionParameters Parameters to create and update Cosmos DB + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createUpdateSqlUserDefinedFunction( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + userDefinedFunctionName, + apiVersion, + 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 Parameters to create and update Cosmos DB + * 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 Parameters to create and update Cosmos DB + * 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 Parameters to create and update Cosmos DB + * 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 Parameters to create and update Cosmos DB + * 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 Parameters to create and update Cosmos DB + * 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 Parameters to create and update Cosmos DB + * 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 Parameters to create and update Cosmos DB + * 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 Parameters to create and update Cosmos DB + * 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.")); + } + final String apiVersion = "2020-09-01"; + return FluxUtil + .withContext( + context -> + service + .deleteSqlUserDefinedFunction( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + userDefinedFunctionName, + apiVersion, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the 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.")); + } + final String apiVersion = "2020-09-01"; + context = this.client.mergeContext(context); + return service + .deleteSqlUserDefinedFunction( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + userDefinedFunctionName, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listSqlTriggers( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listSqlTriggers( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getSqlTrigger( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + triggerName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getSqlTrigger( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + triggerName, + apiVersion, + 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 Parameters to create and update Cosmos DB 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createUpdateSqlTrigger( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + triggerName, + apiVersion, + createUpdateSqlTriggerParameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or update an Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @param createUpdateSqlTriggerParameters Parameters to create and update Cosmos DB 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createUpdateSqlTrigger( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + triggerName, + apiVersion, + 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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.")); + } + final String apiVersion = "2020-09-01"; + return FluxUtil + .withContext( + context -> + service + .deleteSqlTrigger( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + triggerName, + apiVersion, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the 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.")); + } + final String apiVersion = "2020-09-01"; + context = this.client.mergeContext(context); + return service + .deleteSqlTrigger( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + triggerName, + apiVersion, + 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(); + } +} 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..458e312dd3c05 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlResourcesImpl.java @@ -0,0 +1,1428 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.CosmosDBManager; +import com.azure.resourcemanager.cosmos.generated.fluent.SqlResourcesClient; +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.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.SqlContainerGetResults; +import com.azure.resourcemanager.cosmos.generated.models.SqlDatabaseGetResults; +import com.azure.resourcemanager.cosmos.generated.models.SqlResources; +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 CosmosDBManager serviceManager; + + public SqlResourcesImpl(SqlResourcesClient innerClient, CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listSqlDatabases(String resourceGroupName, String accountName) { + PagedIterable inner = + this.serviceClient().listSqlDatabases(resourceGroupName, accountName); + return inner.mapPage(inner1 -> new SqlDatabaseGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listSqlDatabases( + String resourceGroupName, String accountName, Context context) { + PagedIterable inner = + this.serviceClient().listSqlDatabases(resourceGroupName, accountName, context); + return inner.mapPage(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 inner.mapPage(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 inner.mapPage(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 inner.mapPage(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 inner.mapPage(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 inner.mapPage(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 inner.mapPage(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 inner.mapPage(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 inner.mapPage(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 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 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); + } + + private SqlResourcesClient serviceClient() { + return this.innerClient; + } + + private 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()); + } +} 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..1523cec45b185 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlStoredProcedureGetResultsImpl.java @@ -0,0 +1,247 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.CosmosDBManager; +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 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 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; + } + + public SqlStoredProcedureGetResultsImpl(String name, 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; + } + + public SqlStoredProcedureGetResultsImpl( + SqlStoredProcedureGetResultsInner innerObject, 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..b91283912761e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlTriggerGetResultsImpl.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.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.CosmosDBManager; +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 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 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; + } + + public SqlTriggerGetResultsImpl(String name, 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; + } + + public SqlTriggerGetResultsImpl(SqlTriggerGetResultsInner innerObject, 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..8a61b196ed25b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlUserDefinedFunctionGetResultsImpl.java @@ -0,0 +1,247 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.CosmosDBManager; +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 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 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; + } + + public SqlUserDefinedFunctionGetResultsImpl(String name, 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; + } + + public SqlUserDefinedFunctionGetResultsImpl( + SqlUserDefinedFunctionGetResultsInner innerObject, 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..20737cabaaef1 --- /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.CosmosDBManager; +import com.azure.resourcemanager.cosmos.generated.fluent.models.TableGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.OptionsResource; +import com.azure.resourcemanager.cosmos.generated.models.TableCreateUpdateParameters; +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 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 OptionsResource 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 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; + } + + public TableGetResultsImpl(String name, 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; + } + + public TableGetResultsImpl(TableGetResultsInner innerObject, 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..56762e552036f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/TableResourcesClientImpl.java @@ -0,0 +1,2176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listTables( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listTables( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getTable( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + tableName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getTable( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + tableName, + apiVersion, + 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 Parameters to create and update Cosmos DB 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createUpdateTable( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + tableName, + apiVersion, + createUpdateTableParameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or update an Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param createUpdateTableParameters Parameters to create and update Cosmos DB 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createUpdateTable( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + tableName, + apiVersion, + 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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 Parameters to create and update Cosmos DB 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.")); + } + final String apiVersion = "2020-09-01"; + return FluxUtil + .withContext( + context -> + service + .deleteTable( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + tableName, + apiVersion, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes an existing Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the 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.")); + } + final String apiVersion = "2020-09-01"; + context = this.client.mergeContext(context); + return service + .deleteTable( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + tableName, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getTableThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + tableName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getTableThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + tableName, + apiVersion, + 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateTableThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + tableName, + apiVersion, + updateThroughputParameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Update RUs per second of an Azure Cosmos DB Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateTableThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + tableName, + apiVersion, + 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateTableToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + tableName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Migrate an Azure Cosmos DB Table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateTableToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + tableName, + apiVersion, + 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateTableToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + tableName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Migrate an Azure Cosmos DB Table from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 apiVersion = "2020-09-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateTableToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + tableName, + apiVersion, + 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..4bd5ff95eda70 --- /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.CosmosDBManager; +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 CosmosDBManager serviceManager; + + public TableResourcesImpl(TableResourcesClient innerClient, CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listTables(String resourceGroupName, String accountName) { + PagedIterable inner = this.serviceClient().listTables(resourceGroupName, accountName); + return inner.mapPage(inner1 -> new TableGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listTables(String resourceGroupName, String accountName, Context context) { + PagedIterable inner = + this.serviceClient().listTables(resourceGroupName, accountName, context); + return inner.mapPage(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 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..e6ef2f04bfb1f --- /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.CosmosDBManager; +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 CosmosDBManager serviceManager; + + public ThroughputSettingsGetResultsImpl( + ThroughputSettingsGetResultsInner innerObject, 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 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..12e0ef4bffb73 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/UsageImpl.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.resourcemanager.cosmos.generated.CosmosDBManager; +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 CosmosDBManager serviceManager; + + public UsageImpl(UsageInner innerObject, 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 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..75d289fcaf4d3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/Utils.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.implementation; + +import java.util.Arrays; +import java.util.Iterator; + +final class Utils { + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.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; + } +} 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/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/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..0e585801e3a92 --- /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.Immutable; +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. */ +@Immutable +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/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..89c374da73f56 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupPolicy.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.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +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) +}) +@Immutable +public class BackupPolicy { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BackupPolicy.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/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..e7125b36a5efc --- /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.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** The CassandraKeyspaceGetPropertiesOptions model. */ +@Immutable +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..d304e9440cb83 --- /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.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The CassandraKeyspaceGetPropertiesResource model. */ +@Immutable +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..d528c3613205f --- /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: Cosmos DB options resource object. + * + * @return the options value. + */ + OptionsResource 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..a683b6b0ae840 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraResources.java @@ -0,0 +1,551 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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..fd2bbd1e891ac --- /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.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** The CassandraTableGetPropertiesOptions model. */ +@Immutable +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..e6a3cdd843904 --- /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.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The CassandraTableGetPropertiesResource model. */ +@Immutable +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..65641ac6e22ad --- /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: Cosmos DB options resource object. + * + * @return the options value. + */ + OptionsResource 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..18aaa6bd756df --- /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..5356e8e629ea2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ContainerPartitionKey.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.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 + */ + @JsonProperty(value = "kind") + private PartitionKind kind; + + /* + * Indicates the version of the partition key definition + */ + @JsonProperty(value = "version") + private Integer version; + + /** + * 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. + * + * @return the kind value. + */ + public PartitionKind kind() { + return this.kind; + } + + /** + * Set the kind property: Indicates the kind of algorithm used for partitioning. + * + * @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; + } + + /** + * 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..45af6d10b1a67 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ContinuousModeBackupPolicy.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.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.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") +@Immutable +public final class ContinuousModeBackupPolicy extends BackupPolicy { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ContinuousModeBackupPolicy.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/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/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..3eeeca02a97ba --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountCreateUpdateParameters.java @@ -0,0 +1,607 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code 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; + + /* + * 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; + + /* + * Whether requests from Public Network are allowed + */ + @JsonProperty(value = "properties.publicNetworkAccess", access = JsonProperty.Access.WRITE_ONLY) + 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; + + /* + * 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; + + /** 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 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 publicNetworkAccess property: Whether requests from Public Network are allowed. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccess publicNetworkAccess() { + return this.publicNetworkAccess; + } + + /** + * 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 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; + } + + /** {@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 (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 (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/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..a74e391009f4a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountGetResults.java @@ -0,0 +1,815 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.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 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 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 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 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.WithConsistencyPolicy, + DefinitionStages.WithIpRules, + DefinitionStages.WithIsVirtualNetworkFilterEnabled, + DefinitionStages.WithEnableAutomaticFailover, + DefinitionStages.WithCapabilities, + DefinitionStages.WithVirtualNetworkRules, + DefinitionStages.WithEnableMultipleWriteLocations, + DefinitionStages.WithEnableCassandraConnector, + DefinitionStages.WithConnectorOffer, + DefinitionStages.WithDisableKeyBasedMetadataWriteAccess, + DefinitionStages.WithKeyVaultKeyUri, + DefinitionStages.WithEnableFreeTier, + DefinitionStages.WithApiProperties, + DefinitionStages.WithEnableAnalyticalStorage, + DefinitionStages.WithBackupPolicy, + DefinitionStages.WithCors { + /** + * 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 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 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 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); + } + } + /** + * 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.WithConsistencyPolicy, + UpdateStages.WithLocations, + UpdateStages.WithIpRules, + UpdateStages.WithIsVirtualNetworkFilterEnabled, + UpdateStages.WithEnableAutomaticFailover, + UpdateStages.WithCapabilities, + UpdateStages.WithVirtualNetworkRules, + UpdateStages.WithEnableMultipleWriteLocations, + UpdateStages.WithEnableCassandraConnector, + UpdateStages.WithConnectorOffer, + UpdateStages.WithDisableKeyBasedMetadataWriteAccess, + UpdateStages.WithKeyVaultKeyUri, + UpdateStages.WithEnableFreeTier, + UpdateStages.WithApiProperties, + UpdateStages.WithEnableAnalyticalStorage, + UpdateStages.WithBackupPolicy, + UpdateStages.WithCors { + /** + * 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 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 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 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); + } + } + /** + * 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); +} 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..e937a7f8781d4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountUpdateParameters.java @@ -0,0 +1,593 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code 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 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") + private Map tags; + + /* + * The location of the resource group to which the resource belongs. + */ + @JsonProperty(value = "location") + private String location; + + /* + * 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; + + /* + * Whether requests from Public Network are allowed + */ + @JsonProperty(value = "properties.publicNetworkAccess", access = JsonProperty.Access.WRITE_ONLY) + 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; + + /* + * 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; + + /** + * 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 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 publicNetworkAccess property: Whether requests from Public Network are allowed. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccess publicNetworkAccess() { + return this.publicNetworkAccess; + } + + /** + * 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 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (consistencyPolicy() != null) { + consistencyPolicy().validate(); + } + if (locations() != null) { + locations().forEach(e -> e.validate()); + } + if (ipRules() != null) { + ipRules().forEach(e -> e.validate()); + } + if (capabilities() != null) { + capabilities().forEach(e -> e.validate()); + } + if (virtualNetworkRules() != null) { + virtualNetworkRules().forEach(e -> e.validate()); + } + if (apiProperties() != null) { + apiProperties().validate(); + } + if (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..e7e6e26bc40bf --- /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 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. + */ + 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 list of new failover policies for the failover priority change. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 list of new failover policies for the failover priority change. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 online or offline. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 online or offline. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 or offline. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 or offline. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 Parameters to regenerate the keys within 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 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 Parameters to regenerate the keys within 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 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/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/ErrorAdditionalInfo.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ErrorAdditionalInfo.java new file mode 100644 index 0000000000000..de37511c99759 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ErrorAdditionalInfo.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 resource management error additional info. */ +@Immutable +public final class ErrorAdditionalInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ErrorAdditionalInfo.class); + + /* + * The additional info type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * The additional info. + */ + @JsonProperty(value = "info", access = JsonProperty.Access.WRITE_ONLY) + private Object info; + + /** + * Get the type property: The additional info type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the info property: The additional info. + * + * @return the info value. + */ + public Object info() { + return this.info; + } + + /** + * 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/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..fb4c9b4b106d3 --- /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.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** The GremlinDatabaseGetPropertiesOptions model. */ +@Immutable +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..d1ddc5bf99f6b --- /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.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The GremlinDatabaseGetPropertiesResource model. */ +@Immutable +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..34394c32ff51f --- /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: Cosmos DB options resource object. + * + * @return the options value. + */ + OptionsResource 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..1533b944a0cb6 --- /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.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** The GremlinGraphGetPropertiesOptions model. */ +@Immutable +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..6d502043df109 --- /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.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The GremlinGraphGetPropertiesResource model. */ +@Immutable +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..ca9b9f4c1c669 --- /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: Cosmos DB options resource object. + * + * @return the options value. + */ + OptionsResource 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..3de00ad7950f7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinResources.java @@ -0,0 +1,547 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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..d0cdddf9c344b --- /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/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..305423abc0eef --- /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.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** The MongoDBCollectionGetPropertiesOptions model. */ +@Immutable +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..a1f553b2371c7 --- /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.Immutable; +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. */ +@Immutable +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..6c6265bba4500 --- /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: Cosmos DB options resource object. + * + * @return the options value. + */ + OptionsResource 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..62e85221b4273 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionResource.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +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") + 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..1d4e167206474 --- /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.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** The MongoDBDatabaseGetPropertiesOptions model. */ +@Immutable +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..9efb83929c4ae --- /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.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The MongoDBDatabaseGetPropertiesResource model. */ +@Immutable +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..ab23a05b23725 --- /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: Cosmos DB options resource object. + * + * @return the options value. + */ + OptionsResource 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..f48b43076c3df --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBResources.java @@ -0,0 +1,552 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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/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..db7b2ba0874f5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspace.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.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); +} 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/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..743ea82b00a6d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionKind.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 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"); + + /** + * 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..c47c5abe89c30 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PeriodicModeBackupPolicy.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 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; + } + + /** + * 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/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..354bf3447fa8e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateEndpointConnection.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A private endpoint connection. */ +@JsonFlatten +@Fluent +public class PrivateEndpointConnection extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpointConnection.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; + + /** + * 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 PrivateEndpointConnection object itself. + */ + public PrivateEndpointConnection 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 PrivateEndpointConnection object itself. + */ + public PrivateEndpointConnection withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState) { + this.privateLinkServiceConnectionState = privateLinkServiceConnectionState; + 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/models/PrivateEndpointConnectionAutoGenerated.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateEndpointConnectionAutoGenerated.java new file mode 100644 index 0000000000000..1ec6e53521c71 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateEndpointConnectionAutoGenerated.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.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PrivateEndpointConnectionAutoGeneratedInner; + +/** An immutable client-side representation of PrivateEndpointConnectionAutoGenerated. */ +public interface PrivateEndpointConnectionAutoGenerated { + /** + * 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. + */ + PrivateLinkServiceConnectionStatePropertyAutoGenerated 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.PrivateEndpointConnectionAutoGeneratedInner object. + * + * @return the inner object. + */ + PrivateEndpointConnectionAutoGeneratedInner innerModel(); + + /** The entirety of the PrivateEndpointConnectionAutoGenerated definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The PrivateEndpointConnectionAutoGenerated definition stages. */ + interface DefinitionStages { + /** The first stage of the PrivateEndpointConnectionAutoGenerated definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the PrivateEndpointConnectionAutoGenerated 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 PrivateEndpointConnectionAutoGenerated 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. + */ + PrivateEndpointConnectionAutoGenerated create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + PrivateEndpointConnectionAutoGenerated create(Context context); + } + /** The stage of the PrivateEndpointConnectionAutoGenerated 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 PrivateEndpointConnectionAutoGenerated 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( + PrivateLinkServiceConnectionStatePropertyAutoGenerated privateLinkServiceConnectionState); + } + /** The stage of the PrivateEndpointConnectionAutoGenerated 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 PrivateEndpointConnectionAutoGenerated 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 PrivateEndpointConnectionAutoGenerated resource. + * + * @return the stage of resource update. + */ + PrivateEndpointConnectionAutoGenerated.Update update(); + + /** The template for PrivateEndpointConnectionAutoGenerated update. */ + interface Update + extends UpdateStages.WithPrivateEndpoint, + UpdateStages.WithPrivateLinkServiceConnectionState, + UpdateStages.WithGroupId, + UpdateStages.WithProvisioningState { + /** + * Executes the update request. + * + * @return the updated resource. + */ + PrivateEndpointConnectionAutoGenerated apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + PrivateEndpointConnectionAutoGenerated apply(Context context); + } + /** The PrivateEndpointConnectionAutoGenerated update stages. */ + interface UpdateStages { + /** The stage of the PrivateEndpointConnectionAutoGenerated 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 PrivateEndpointConnectionAutoGenerated 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( + PrivateLinkServiceConnectionStatePropertyAutoGenerated privateLinkServiceConnectionState); + } + /** The stage of the PrivateEndpointConnectionAutoGenerated 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 PrivateEndpointConnectionAutoGenerated 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. + */ + PrivateEndpointConnectionAutoGenerated refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + PrivateEndpointConnectionAutoGenerated 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..465bd09ce7a49 --- /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.PrivateEndpointConnectionAutoGeneratedInner; +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..e223a09d73d0e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateEndpointConnections.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of PrivateEndpointConnections. */ +public interface PrivateEndpointConnections { + /** + * List all private endpoint connections on a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private endpoint connections. + */ + 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. + */ + PrivateEndpointConnectionAutoGenerated 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. + */ + PrivateEndpointConnectionAutoGenerated 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 PrivateEndpointConnectionAutoGenerated resource. + * + * @param name resource name. + * @return the first stage of the new PrivateEndpointConnectionAutoGenerated definition. + */ + PrivateEndpointConnectionAutoGenerated.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..539b18a2e8767 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateLinkServiceConnectionStateProperty.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; + +/** 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; + + /* + * 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 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/PrivateLinkServiceConnectionStatePropertyAutoGenerated.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateLinkServiceConnectionStatePropertyAutoGenerated.java new file mode 100644 index 0000000000000..d180bd136a190 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateLinkServiceConnectionStatePropertyAutoGenerated.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.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 PrivateLinkServiceConnectionStatePropertyAutoGenerated { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(PrivateLinkServiceConnectionStatePropertyAutoGenerated.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 PrivateLinkServiceConnectionStatePropertyAutoGenerated object itself. + */ + public PrivateLinkServiceConnectionStatePropertyAutoGenerated 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 PrivateLinkServiceConnectionStatePropertyAutoGenerated object itself. + */ + public PrivateLinkServiceConnectionStatePropertyAutoGenerated 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/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..980dc3be1dc40 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServerVersion.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 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"); + + /** + * 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..86a5c87ecb09e --- /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.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** The SqlContainerGetPropertiesOptions model. */ +@Immutable +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..c782b5edccc3f --- /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.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The SqlContainerGetPropertiesResource model. */ +@Immutable +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..5c3116dce2a23 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerGetResults.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.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: Cosmos DB options resource object. + * + * @return the options value. + */ + OptionsResource 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); +} 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..b9514112895dc --- /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.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** The SqlDatabaseGetPropertiesOptions model. */ +@Immutable +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..348a8b43bdca7 --- /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: Cosmos DB options resource object. + * + * @return the options value. + */ + OptionsResource 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..5a5ad6bf66794 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlResources.java @@ -0,0 +1,1034 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); +} 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..ef3edc70fb864 --- /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.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The SqlStoredProcedureGetPropertiesResource model. */ +@Immutable +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..c5e37b0010c8c --- /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.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The SqlTriggerGetPropertiesResource model. */ +@Immutable +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..8d9ac8744d7e1 --- /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.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The SqlUserDefinedFunctionGetPropertiesResource model. */ +@Immutable +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..94df4046f11a1 --- /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.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** The TableGetPropertiesOptions model. */ +@Immutable +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..9a39558082a7a --- /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.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The TableGetPropertiesResource model. */ +@Immutable +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..084ef9fbc4be2 --- /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: Cosmos DB options resource object. + * + * @return the options value. + */ + OptionsResource 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..13b4bba21b1de --- /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 Parameters to update Cosmos DB resource throughput. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 Parameters to update Cosmos DB resource throughput. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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..435dcba319ebf --- /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.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ThroughputSettingsGetPropertiesResource model. */ +@Immutable +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 a72899ac68a13..2b02dcf0bc342 100644 --- a/sdk/cosmos/ci.yml +++ b/sdk/cosmos/ci.yml @@ -3,53 +3,56 @@ trigger: branches: include: - - master - - hotfix/* - - release/* + - master + - hotfix/* + - release/* paths: include: - - sdk/cosmos/ + - sdk/cosmos/ exclude: - - sdk/cosmos/mgmt - - sdk/cosmos/mgmt-v2015_04_08 - - sdk/cosmos/mgmt-v2019_08_01 - - sdk/cosmos/mgmt-v2019_08_01_preview - - sdk/cosmos/mgmt-v2019_12_12 + - sdk/cosmos/mgmt + - sdk/cosmos/mgmt-v2015_04_08 + - sdk/cosmos/mgmt-v2019_08_01 + - sdk/cosmos/mgmt-v2019_08_01_preview + - sdk/cosmos/mgmt-v2019_12_12 pr: branches: include: - - master - - feature/* - - hotfix/* - - release/* + - master + - feature/* + - hotfix/* + - release/* paths: include: - - sdk/cosmos/ + - sdk/cosmos/ exclude: - - sdk/cosmos/mgmt - - sdk/cosmos/mgmt-v2015_04_08 - - sdk/cosmos/mgmt-v2019_08_01 - - sdk/cosmos/mgmt-v2019_08_01_preview - - sdk/cosmos/mgmt-v2019_12_12 + - sdk/cosmos/mgmt + - sdk/cosmos/mgmt-v2015_04_08 + - sdk/cosmos/mgmt-v2019_08_01 + - sdk/cosmos/mgmt-v2019_08_01_preview + - sdk/cosmos/mgmt-v2019_12_12 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 Artifacts: - - name: azure-cosmos - groupId: com.azure - safeName: azurecosmos - - name: azure-spring-data-cosmos - groupId: com.azure - safeName: azurespringdatacosmos - - name: azure-cosmos-encryption - groupId: com.azure - safeName: azurecosmosencryption + - name: azure-cosmos + groupId: com.azure + safeName: azurecosmos + - name: azure-spring-data-cosmos + groupId: com.azure + safeName: azurespringdatacosmos + - name: azure-cosmos-encryption + groupId: com.azure + safeName: azurecosmosencryption + - name: azure-resourcemanager-cosmos-generated + groupId: com.azure.resourcemanager + safeName: azureresourcemanagercosmosgenerated AdditionalModules: - - name: azure-cosmos-benchmark - groupId: com.azure - - name: azure-spring-data-cosmos-test - groupId: com.azure + - name: azure-cosmos-benchmark + groupId: com.azure + - name: azure-spring-data-cosmos-test + groupId: com.azure diff --git a/sdk/cosmos/pom.xml b/sdk/cosmos/pom.xml index ffe95f8a3385d..a7b59e6de4bc6 100644 --- a/sdk/cosmos/pom.xml +++ b/sdk/cosmos/pom.xml @@ -12,6 +12,7 @@ azure-cosmos azure-cosmos-benchmark azure-cosmos-encryption + azure-resourcemanager-cosmos-generated azure-spring-data-cosmos azure-spring-data-cosmos-test