com.azure.cosmos.implementation.AsyncDocumentClient Maven / Gradle / Ivy
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.azure.cosmos.implementation;
import com.azure.core.credential.AzureKeyCredential;
import com.azure.core.credential.TokenCredential;
import com.azure.cosmos.ConsistencyLevel;
import com.azure.cosmos.CosmosAsyncClient;
import com.azure.cosmos.CosmosContainerProactiveInitConfig;
import com.azure.cosmos.CosmosEndToEndOperationLatencyPolicyConfig;
import com.azure.cosmos.CosmosItemSerializer;
import com.azure.cosmos.CosmosOperationPolicy;
import com.azure.cosmos.SessionRetryOptions;
import com.azure.cosmos.implementation.apachecommons.lang.StringUtils;
import com.azure.cosmos.implementation.batch.ServerBatchRequest;
import com.azure.cosmos.implementation.caches.RxClientCollectionCache;
import com.azure.cosmos.implementation.caches.RxPartitionKeyRangeCache;
import com.azure.cosmos.implementation.circuitBreaker.GlobalPartitionEndpointManagerForCircuitBreaker;
import com.azure.cosmos.implementation.clienttelemetry.ClientTelemetry;
import com.azure.cosmos.implementation.directconnectivity.AddressSelector;
import com.azure.cosmos.implementation.faultinjection.IFaultInjectorProvider;
import com.azure.cosmos.implementation.query.PartitionedQueryExecutionInfo;
import com.azure.cosmos.implementation.throughputControl.config.ThroughputControlGroupInternal;
import com.azure.cosmos.models.CosmosAuthorizationTokenResolver;
import com.azure.cosmos.models.CosmosBatchResponse;
import com.azure.cosmos.models.CosmosChangeFeedRequestOptions;
import com.azure.cosmos.models.CosmosClientTelemetryConfig;
import com.azure.cosmos.models.CosmosContainerIdentity;
import com.azure.cosmos.models.CosmosItemIdentity;
import com.azure.cosmos.models.CosmosPatchOperations;
import com.azure.cosmos.models.CosmosQueryRequestOptions;
import com.azure.cosmos.models.FeedRange;
import com.azure.cosmos.models.FeedResponse;
import com.azure.cosmos.models.PartitionKey;
import com.azure.cosmos.models.SqlQuerySpec;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Map;
/**
* Provides a client-side logical representation of the Azure Cosmos DB
* database service. This async client is used to configure and execute requests
* against the service.
*
*
* {@link AsyncDocumentClient} async APIs return project reactor's {@link
* Flux}, and so you can use project reactor {@link Flux} functionality.
* The async {@link Flux} based APIs perform the requested operation only after
* subscription.
*
*
* The service client encapsulates the endpoint and credentials used to access
* the Cosmos DB service.
*
* To instantiate you can use the {@link Builder}
*
* {@code
* ConnectionPolicy connectionPolicy = new ConnectionPolicy(DirectConnectionConfig.getDefaultConfig());
* AsyncDocumentClient client = new AsyncDocumentClient.Builder()
* .withServiceEndpoint(serviceEndpoint)
* .withMasterKeyOrResourceToken(masterKey)
* .withConnectionPolicy(connectionPolicy)
* .withConsistencyLevel(ConsistencyLevel.SESSION)
* .buildAsyncClient();
* }
*
*/
public interface AsyncDocumentClient {
/**
* Helper class to buildAsyncClient {@link AsyncDocumentClient} instances
* as logical representation of the Azure Cosmos DB database service.
*
*
* {@code
* ConnectionPolicy connectionPolicy = new ConnectionPolicy(DirectConnectionConfig.getDefaultConfig());
* AsyncDocumentClient client = new AsyncDocumentClient.Builder()
* .withServiceEndpoint(serviceEndpoint)
* .withMasterKeyOrResourceToken(masterKey)
* .withConnectionPolicy(connectionPolicy)
* .withConsistencyLevel(ConsistencyLevel.SESSION)
* .buildAsyncClient();
* }
*
*/
class Builder {
Configs configs = new Configs();
ConnectionPolicy connectionPolicy;
ConsistencyLevel desiredConsistencyLevel;
List permissionFeed;
String masterKeyOrResourceToken;
URI serviceEndpoint;
CosmosAuthorizationTokenResolver cosmosAuthorizationTokenResolver;
AzureKeyCredential credential;
TokenCredential tokenCredential;
boolean sessionCapturingOverride;
boolean transportClientSharing;
boolean contentResponseOnWriteEnabled;
private CosmosClientMetadataCachesSnapshot state;
private ApiType apiType;
CosmosClientTelemetryConfig clientTelemetryConfig;
private String clientCorrelationId = null;
private CosmosEndToEndOperationLatencyPolicyConfig cosmosEndToEndOperationLatencyPolicyConfig;
private SessionRetryOptions sessionRetryOptions;
private CosmosContainerProactiveInitConfig containerProactiveInitConfig;
private CosmosItemSerializer defaultCustomSerializer;
private boolean isRegionScopedSessionCapturingEnabled;
private List operationPolicies;
public Builder withServiceEndpoint(String serviceEndpoint) {
try {
this.serviceEndpoint = new URI(serviceEndpoint);
} catch (URISyntaxException e) {
throw new IllegalArgumentException(e.getMessage());
}
return this;
}
public Builder withDefaultSerializer( CosmosItemSerializer defaultCustomSerializer) {
this.defaultCustomSerializer = defaultCustomSerializer;
return this;
}
public Builder withState(CosmosClientMetadataCachesSnapshot state) {
this.state = state;
return this;
}
public Builder withApiType(ApiType apiType) {
this.apiType = apiType;
return this;
}
public Builder withClientCorrelationId(String clientCorrelationId) {
this.clientCorrelationId = clientCorrelationId;
return this;
}
/**
* New method withMasterKeyOrResourceToken will take either master key or resource token
* and perform authentication for accessing resource.
*
* @param masterKeyOrResourceToken MasterKey or resourceToken for authentication.
* @return current Builder.
* @deprecated use {@link #withMasterKeyOrResourceToken(String)} instead.
*/
@Deprecated
public Builder withMasterKey(String masterKeyOrResourceToken) {
this.masterKeyOrResourceToken = masterKeyOrResourceToken;
return this;
}
/**
* This method will accept the master key , additionally it can also consume
* resource token too for authentication.
*
* @param masterKeyOrResourceToken MasterKey or resourceToken for authentication.
* @return current Builder.
*/
public Builder withMasterKeyOrResourceToken(String masterKeyOrResourceToken) {
this.masterKeyOrResourceToken = masterKeyOrResourceToken;
return this;
}
/**
* This method will accept the permission list , which contains the
* resource tokens needed to access resources.
*
* @param permissionFeed Permission list for authentication.
* @return current Builder.
*/
public Builder withPermissionFeed(List permissionFeed) {
this.permissionFeed = permissionFeed;
return this;
}
public Builder withConsistencyLevel(ConsistencyLevel desiredConsistencyLevel) {
this.desiredConsistencyLevel = desiredConsistencyLevel;
return this;
}
public Builder withConfigs(Configs configs) {
this.configs = configs;
return this;
}
public Builder withSessionCapturingOverride(boolean sessionCapturingOverride) {
this.sessionCapturingOverride = sessionCapturingOverride;
return this;
}
public Builder withConnectionPolicy(ConnectionPolicy connectionPolicy) {
this.connectionPolicy = connectionPolicy;
return this;
}
public Builder withTransportClientSharing(boolean transportClientSharing) {
this.transportClientSharing = transportClientSharing;
return this;
}
public Builder withCredential(AzureKeyCredential credential) {
if (credential != null && StringUtils.isEmpty(credential.getKey())) {
throw new IllegalArgumentException("Cannot buildAsyncClient client with empty key credential");
}
this.credential = credential;
return this;
}
public Builder withContentResponseOnWriteEnabled(boolean contentResponseOnWriteEnabled) {
this.contentResponseOnWriteEnabled = contentResponseOnWriteEnabled;
return this;
}
/**
* This method will accept functional interface TokenResolver which helps in generation authorization
* token per request. AsyncDocumentClient can be successfully initialized with this API without passing any MasterKey, ResourceToken or PermissionFeed.
* @param cosmosAuthorizationTokenResolver The tokenResolver
* @return current Builder.
*/
public Builder withTokenResolver(CosmosAuthorizationTokenResolver cosmosAuthorizationTokenResolver) {
this.cosmosAuthorizationTokenResolver = cosmosAuthorizationTokenResolver;
return this;
}
/**
* This method will accept functional interface TokenCredential which helps in generation authorization
* token per request. AsyncDocumentClient can be successfully initialized with this API without passing any MasterKey, ResourceToken or PermissionFeed.
* @param tokenCredential the token credential
* @return current Builder.
*/
public Builder withTokenCredential(TokenCredential tokenCredential) {
this.tokenCredential = tokenCredential;
return this;
}
/***
* Set the client telemetry config.
*
* @param clientTelemetryConfig the {@link CosmosClientTelemetryConfig}.
*
* @return the current builder.
*/
public Builder withClientTelemetryConfig(CosmosClientTelemetryConfig clientTelemetryConfig) {
this.clientTelemetryConfig = clientTelemetryConfig;
return this;
}
public Builder withEndToEndOperationLatencyPolicyConfig(CosmosEndToEndOperationLatencyPolicyConfig endToEndOperationLatencyPolicyConfig) {
this.cosmosEndToEndOperationLatencyPolicyConfig = endToEndOperationLatencyPolicyConfig;
return this;
}
public Builder withSessionRetryOptions(SessionRetryOptions sessionRetryOptions) {
this.sessionRetryOptions = sessionRetryOptions;
return this;
}
public Builder withContainerProactiveInitConfig(CosmosContainerProactiveInitConfig containerProactiveInitConfig) {
this.containerProactiveInitConfig = containerProactiveInitConfig;
return this;
}
public Builder withRegionScopedSessionCapturingEnabled(boolean isRegionScopedSessionCapturingEnabled) {
this.isRegionScopedSessionCapturingEnabled = isRegionScopedSessionCapturingEnabled;
return this;
}
private void ifThrowIllegalArgException(boolean value, String error) {
if (value) {
throw new IllegalArgumentException(error);
}
}
public AsyncDocumentClient build() {
ifThrowIllegalArgException(this.serviceEndpoint == null || StringUtils.isEmpty(this.serviceEndpoint.toString()), "cannot buildAsyncClient client without service endpoint");
ifThrowIllegalArgException(
this.masterKeyOrResourceToken == null && (permissionFeed == null || permissionFeed.isEmpty())
&& this.credential == null && this.tokenCredential == null && this.cosmosAuthorizationTokenResolver == null,
"cannot buildAsyncClient client without any one of masterKey, " +
"resource token, permissionFeed and azure key credential");
ifThrowIllegalArgException(credential != null && StringUtils.isEmpty(credential.getKey()),
"cannot buildAsyncClient client without key credential");
RxDocumentClientImpl client = new RxDocumentClientImpl(serviceEndpoint,
masterKeyOrResourceToken,
permissionFeed,
connectionPolicy,
desiredConsistencyLevel,
configs,
cosmosAuthorizationTokenResolver,
credential,
tokenCredential,
sessionCapturingOverride,
transportClientSharing,
contentResponseOnWriteEnabled,
state,
apiType,
clientTelemetryConfig,
clientCorrelationId,
cosmosEndToEndOperationLatencyPolicyConfig,
sessionRetryOptions,
containerProactiveInitConfig,
defaultCustomSerializer,
isRegionScopedSessionCapturingEnabled,
operationPolicies
);
client.init(state, null);
return client;
}
public Configs getConfigs() {
return configs;
}
public void setConfigs(Configs configs) {
this.configs = configs;
}
public ConnectionPolicy getConnectionPolicy() {
return connectionPolicy;
}
public void setConnectionPolicy(ConnectionPolicy connectionPolicy) {
this.connectionPolicy = connectionPolicy;
}
public ConsistencyLevel getDesiredConsistencyLevel() {
return desiredConsistencyLevel;
}
public URI getServiceEndpoint() {
return serviceEndpoint;
}
public void setServiceEndpoint(URI serviceEndpoint) {
this.serviceEndpoint = serviceEndpoint;
}
public AzureKeyCredential getCredential() {
return credential;
}
public Builder withOperationPolicies(List operationPolicies) {
this.operationPolicies = operationPolicies;
return this;
}
}
/**
* Gets the default service endpoint as passed in by the user during construction.
*
* @return the service endpoint URI
*/
URI getServiceEndpoint();
/**
* Gets the desired consistency level
*
* @return the consistency level
*/
ConsistencyLevel getConsistencyLevel();
/**
* Gets the client telemetry
*
* @return the client telemetry
*/
ClientTelemetry getClientTelemetry();
String getClientCorrelationId();
String getMachineId();
String getUserAgent();
/**
* Gets the boolean which indicates whether to only return the headers and status code in Cosmos DB response
* in case of Create, Update and Delete operations on CosmosItem.
*
* If set to false (which is by default), this removes the resource from response. It reduces networking
* and CPU load by not sending the resource back over the network and serializing it
* on the client.
*
* By-default, this is false.
*
* @return a boolean indicating whether resource will be included in the response or not.
*/
boolean isContentResponseOnWriteEnabled();
/**
* Gets the connection policy
*
* @return the connection policy
*/
ConnectionPolicy getConnectionPolicy();
/**
* Creates a database.
*
* After subscription the operation will be performed.
* The {@link Mono} upon successful completion will contain a single resource response with the created database.
* In case of failure the {@link Mono} will error.
*
* @param database the database.
* @param options the request options.
* @return a {@link Mono} containing the single resource response with the created database or an error.
*/
Mono> createDatabase(Database database, RequestOptions options);
/**
* Deletes a database.
*
* After subscription the operation will be performed.
* The {@link Mono} upon successful completion will contain a single resource response with the deleted database.
* In case of failure the {@link Mono} will error.
*
* @param databaseLink the database link.
* @param options the request options.
* @return a {@link Mono} containing the single resource response with the deleted database or an error.
*/
Mono> deleteDatabase(String databaseLink, RequestOptions options);
/**
* Reads a database.
*
* After subscription the operation will be performed.
* The {@link Mono} upon successful completion will contain a single resource response with the read database.
* In case of failure the {@link Mono} will error.
*
* @param databaseLink the database link.
* @param options the request options.
* @return a {@link Mono} containing the single resource response with the read database or an error.
*/
Mono> readDatabase(String databaseLink, RequestOptions options);
/**
* Reads all databases.
*
* After subscription the operation will be performed.
* The {@link Flux} will contain one or several feed response of the read databases.
* In case of failure the {@link Flux} will error.
*
* @param state the query operation state
* @return a {@link Flux} containing one or several feed response pages of read databases or an error.
*/
Flux> readDatabases(QueryFeedOperationState state);
/**
* Query for databases.
*
* After subscription the operation will be performed.
* The {@link Flux} will contain one or several feed response of the read databases.
* In case of failure the {@link Flux} will error.
*
* @param query the query.
* @param state the query operation state.
* @return a {@link Flux} containing one or several feed response pages of read databases or an error.
*/
Flux> queryDatabases(String query, QueryFeedOperationState state);
/**
* Query for databases.
*
* After subscription the operation will be performed.
* The {@link Flux} will contain one or several feed response of the obtained databases.
* In case of failure the {@link Flux} will error.
*
* @param querySpec the SQL query specification.
* @param state the query operation state.
* @return a {@link Flux} containing one or several feed response pages of the obtained databases or an error.
*/
Flux> queryDatabases(SqlQuerySpec querySpec, QueryFeedOperationState state);
/**
* Creates a document collection.
*
* After subscription the operation will be performed.
* The {@link Mono} upon successful completion will contain a single resource response with the created collection.
* In case of failure the {@link Mono} will error.
*
* @param databaseLink the database link.
* @param collection the collection.
* @param options the request options.
* @return a {@link Mono} containing the single resource response with the created collection or an error.
*/
Mono> createCollection(String databaseLink, DocumentCollection collection,
RequestOptions options);
/**
* Replaces a document collection.
*
* After subscription the operation will be performed.
* The {@link Mono} upon successful completion will contain a single resource response with the replaced document collection.
* In case of failure the {@link Mono} will error.
*
* @param collection the document collection to use.
* @param options the request options.
* @return a {@link Mono} containing the single resource response with the replaced document collection or an error.
*/
Mono> replaceCollection(DocumentCollection collection, RequestOptions options);
/**
* Deletes a document collection
*
* After subscription the operation will be performed.
* The {@link Mono} upon successful completion will contain a single resource response for the deleted database.
* In case of failure the {@link Mono} will error.
*
* @param collectionLink the collection link.
* @param options the request options.
* @return a {@link Mono} containing the single resource response for the deleted database or an error.
*/
Mono> deleteCollection(String collectionLink, RequestOptions options);
/**
* Reads a document collection
*
* After subscription the operation will be performed.
* The {@link Mono} upon successful completion will contain a single resource response with the read collection.
* In case of failure the {@link Mono} will error.
*
* @param collectionLink the collection link.
* @param options the request options.
* @return a {@link Mono} containing the single resource response with the read collection or an error.
*/
Mono> readCollection(String collectionLink, RequestOptions options);
/**
* Reads all document collections in a database.
*
* After subscription the operation will be performed.
* The {@link Flux} will contain one or several feed response of the read collections.
* In case of failure the {@link Flux} will error.
*
* @param databaseLink the database link.
* @param state the query option state.
* @return a {@link Flux} containing one or several feed response pages of the read collections or an error.
*/
Flux> readCollections(String databaseLink, QueryFeedOperationState state);
/**
* Query for document collections in a database.
*
* After subscription the operation will be performed.
* The {@link Flux} will contain one or several feed response of the obtained collections.
* In case of failure the {@link Flux} will error.
*
* @param databaseLink the database link.
* @param query the query.
* @param state the query operation state.
* @return a {@link Flux} containing one or several feed response pages of the obtained collections or an error.
*/
Flux> queryCollections(String databaseLink, String query, QueryFeedOperationState state);
/**
* Query for document collections in a database.
*
* After subscription the operation will be performed.
* The {@link Flux} will contain one or several feed response of the obtained collections.
* In case of failure the {@link Flux} will error.
*
* @param databaseLink the database link.
* @param querySpec the SQL query specification.
* @param state the query operation state.
* @return a {@link Flux} containing one or several feed response pages of the obtained collections or an error.
*/
Flux> queryCollections(String databaseLink, SqlQuerySpec querySpec, QueryFeedOperationState state);
/**
* Creates a document.
*
* After subscription the operation will be performed.
* The {@link Mono} upon successful completion will contain a single resource response with the created document.
* In case of failure the {@link Mono} will error.
*
* @param collectionLink the link to the parent document collection.
* @param document the document represented as a POJO or Document object.
* @param options the request options.
* @param disableAutomaticIdGeneration the flag for disabling automatic id generation.
* @return a {@link Mono} containing the single resource response with the created document or an error.
*/
Mono> createDocument(String collectionLink, Object document, RequestOptions options,
boolean disableAutomaticIdGeneration);
/**
* Upserts a document.
*
* After subscription the operation will be performed.
* The {@link Mono} upon successful completion will contain a single resource response with the upserted document.
* In case of failure the {@link Mono} will error.
*
* @param collectionLink the link to the parent document collection.
* @param document the document represented as a POJO or Document object to upsert.
* @param options the request options.
* @param disableAutomaticIdGeneration the flag for disabling automatic id generation.
* @return a {@link Mono} containing the single resource response with the upserted document or an error.
*/
Mono> upsertDocument(String collectionLink, Object document, RequestOptions options,
boolean disableAutomaticIdGeneration);
/**
* Replaces a document using a POJO object.
*
* After subscription the operation will be performed.
* The {@link Mono} upon successful completion will contain a single resource response with the replaced document.
* In case of failure the {@link Mono} will error.
*
* @param documentLink the document link.
* @param document the document represented as a POJO or Document object.
* @param options the request options.
* @return a {@link Mono} containing the single resource response with the replaced document or an error.
*/
Mono> replaceDocument(String documentLink, Object document, RequestOptions options);
/**
* Apply patch on an item.
*
* After subscription the operation will be performed.
* The {@link Mono} upon successful completion will contain a single resource response with the patched document.
* In case of failure the {@link Mono} will error.
*
* @param documentLink the document link.
* @param cosmosPatchOperations container with the list of patch operations.
* @param options the request options.
*
* @return a {@link Mono} containing the single resource response with the patched document or an error.
*/
Mono> patchDocument(String documentLink, CosmosPatchOperations cosmosPatchOperations, RequestOptions options);
/**
* Replaces a document with the passed in document.
*
* After subscription the operation will be performed.
* The {@link Mono} upon successful completion will contain a single resource response with the replaced document.
* In case of failure the {@link Mono} will error.
*
* @param document the document to replace (containing the document id).
* @param options the request options.
* @return a {@link Mono} containing the single resource response with the replaced document or an error.
*/
Mono> replaceDocument(Document document, RequestOptions options);
/**
* Deletes a document
*
* After subscription the operation will be performed.
* The {@link Mono} upon successful completion will contain a single resource response for the deleted document.
* In case of failure the {@link Mono} will error.
*
* @param documentLink the document link.
* @param options the request options.
* @return a {@link Mono} containing the single resource response for the deleted document or an error.
*/
Mono> deleteDocument(String documentLink, RequestOptions options);
/**
* Deletes a document
*
* After subscription the operation will be performed.
* The {@link Mono} upon successful completion will contain a single resource response for the deleted document.
* In case of failure the {@link Mono} will error.
*
* @param internalObjectNode the internalObjectNode to delete (containing the id).
* @param options the request options.
* @return a {@link Mono} containing the single resource response for the deleted document or an error.
*/
Mono> deleteDocument(String documentLink, InternalObjectNode internalObjectNode, RequestOptions options);
Mono> deleteAllDocumentsByPartitionKey(String collectionLink, PartitionKey partitionKey, RequestOptions options);
/**
* Reads a document
*
* After subscription the operation will be performed.
* The {@link Mono} upon successful completion will contain a single resource response with the read document.
* In case of failure the {@link Mono} will error.
*
* @param documentLink the document link.
* @param options the request options.
* @return a {@link Mono} containing the single resource response with the read document or an error.
*/
Mono> readDocument(String documentLink, RequestOptions options);
/**
* Reads all documents in a document collection.
*
* After subscription the operation will be performed.
* The {@link Flux} will contain one or several feed response of the read documents.
* In case of failure the {@link Flux} will error.
*
* @param collectionLink the collection link.
* @param state the query operation state.
* @param the type parameter
* @return a {@link Flux} containing one or several feed response pages of the read documents or an error.
*/
Flux> readDocuments(
String collectionLink, QueryFeedOperationState state, Class classOfT);
/**
* Query for documents in a document collection.
*
* After subscription the operation will be performed.
* The {@link Flux} will contain one or several feed response of the obtained documents.
* In case of failure the {@link Flux} will error.
*
* @param collectionLink the link to the parent document collection.
* @param query the query.
* @param state the query operation state.
* @param the type parameter
* @return a {@link Flux} containing one or several feed response pages of the obtained document or an error.
*/
Flux> queryDocuments(
String collectionLink, String query, QueryFeedOperationState state, Class classOfT);
/**
* Query for documents in a document collection.
*
* After subscription the operation will be performed.
* The {@link Flux} will contain one or several feed response of the obtained documents.
* In case of failure the {@link Flux} will error.
*
* @param collectionLink the link to the parent document collection.
* @param querySpec the SQL query specification.
* @param state the query operation state.
* @param the type parameter
* @return a {@link Flux} containing one or several feed response pages of the obtained documents or an error.
*/
Flux> queryDocuments(
String collectionLink, SqlQuerySpec querySpec, QueryFeedOperationState state, Class classOfT);
/**
* Query for documents change feed in a document collection.
* After subscription the operation will be performed.
* The {@link Flux} will contain one or several feed response pages of the obtained documents.
* In case of failure the {@link Flux} will error.
*
* @param collection the parent document collection.
* @param requestOptions the change feed request options.
* @param the type parameter
* @return a {@link Flux} containing one or several feed response pages of the obtained documents or an error.
*/
Flux> queryDocumentChangeFeed(
DocumentCollection collection,
CosmosChangeFeedRequestOptions requestOptions,
Class classOfT);
/**
* Query for documents change feed in a document collection.
* After subscription the operation will be performed.
* The {@link Flux} will contain one or several feed response pages of the obtained documents.
* In case of failure the {@link Flux} will error.
*
* @param collection the parent document collection.
* @param state the change feed operation state.
* @param the type parameter
* @return a {@link Flux} containing one or several feed response pages of the obtained documents or an error.
*/
Flux> queryDocumentChangeFeedFromPagedFlux(
DocumentCollection collection,
ChangeFeedOperationState state,
Class classOfT);
/**
* Reads all partition key ranges in a document collection.
* After subscription the operation will be performed.
* The {@link Flux} will contain one or several feed response pages of the obtained partition key ranges.
* In case of failure the {@link Flux} will error.
*
* @param collectionLink the link to the parent document collection.
* @param state the query operation state.
* @return a {@link Flux} containing one or several feed response pages of the obtained partition key ranges or an error.
*/
Flux> readPartitionKeyRanges(String collectionLink, QueryFeedOperationState state);
Flux> readPartitionKeyRanges(String collectionLink, CosmosQueryRequestOptions options);
/**
* Gets the feed ranges of a container.
*
* @param collectionLink the link to the parent document collection.
* @param forceRefresh a flag indicating whether to force a refresh
* @return a {@link List} of @{link FeedRange} containing the feed ranges of a container.
*/
Mono> getFeedRanges(String collectionLink, boolean forceRefresh);
/**
* Creates a stored procedure.
*
* After subscription the operation will be performed.
* The {@link Mono} upon successful completion will contain a single resource response with the created stored procedure.
* In case of failure the {@link Mono} will error.
*
* @param collectionLink the collection link.
* @param storedProcedure the stored procedure to create.
* @param options the request options.
* @return a {@link Mono} containing the single resource response with the created stored procedure or an error.
*/
Mono> createStoredProcedure(String collectionLink, StoredProcedure storedProcedure,
RequestOptions options);
/**
* Replaces a stored procedure.
*
* After subscription the operation will be performed.
* The {@link Mono} upon successful completion will contain a single resource response with the replaced stored procedure.
* In case of failure the {@link Mono} will error.
*
* @param storedProcedure the stored procedure to use.
* @param options the request options.
* @return a {@link Mono} containing the single resource response with the replaced stored procedure or an error.
*/
Mono> replaceStoredProcedure(StoredProcedure storedProcedure, RequestOptions options);
/**
* Deletes a stored procedure
*
* After subscription the operation will be performed.
* The {@link Mono} upon successful completion will contain a single resource response for the deleted stored procedure.
* In case of failure the {@link Mono} will error.
*
* @param storedProcedureLink the stored procedure link.
* @param options the request options.
* @return a {@link Mono} containing the single resource response for the deleted stored procedure or an error.
*/
Mono> deleteStoredProcedure(String storedProcedureLink, RequestOptions options);
/**
* READ a stored procedure
*
* After subscription the operation will be performed.
* The {@link Mono} upon successful completion will contain a single resource response with the read stored procedure.
* In case of failure the {@link Mono} will error.
*
* @param storedProcedureLink the stored procedure link.
* @param options the request options.
* @return a {@link Mono} containing the single resource response with the read stored procedure or an error.
*/
Mono> readStoredProcedure(String storedProcedureLink, RequestOptions options);
/**
* Reads all stored procedures in a document collection link.
*
* After subscription the operation will be performed.
* The {@link Flux} will contain one or several feed response pages of the read stored procedures.
* In case of failure the {@link Flux} will error.
*
* @param collectionLink the collection link.
* @param state the query operation state.
* @return a {@link Flux} containing one or several feed response pages of the read stored procedures or an error.
*/
Flux> readStoredProcedures(String collectionLink, QueryFeedOperationState state);
/**
* Query for stored procedures in a document collection.
*
* After subscription the operation will be performed.
* The {@link Flux} will contain one or several feed response pages of the obtained stored procedures.
* In case of failure the {@link Flux} will error.
*
* @param collectionLink the collection link.
* @param query the query.
* @param state the query operation state.
* @return a {@link Flux} containing one or several feed response pages of the obtained stored procedures or an error.
*/
Flux> queryStoredProcedures(String collectionLink, String query, QueryFeedOperationState state);
/**
* Query for stored procedures in a document collection.
*
* After subscription the operation will be performed.
* The {@link Flux} will contain one or several feed response pages of the obtained stored procedures.
* In case of failure the {@link Flux} will error.
*
* @param collectionLink the collection link.
* @param querySpec the SQL query specification.
* @param state the query operation state.
* @return a {@link Flux} containing one or several feed response pages of the obtained stored procedures or an error.
*/
Flux> queryStoredProcedures(String collectionLink, SqlQuerySpec querySpec,
QueryFeedOperationState state);
/**
* Executes a stored procedure
*
* After subscription the operation will be performed.
* The {@link Mono} upon successful completion will contain a single resource response with the stored procedure response.
* In case of failure the {@link Mono} will error.
*
* @param storedProcedureLink the stored procedure link.
* @param options the request options.
* @param procedureParams the array of procedure parameter values.
* @return a {@link Mono} containing the single resource response with the stored procedure response or an error.
*/
Mono executeStoredProcedure(String storedProcedureLink, RequestOptions options,
List