Package com.azure.cosmos.models
Class CosmosItemRequestOptions
java.lang.Object
com.azure.cosmos.models.CosmosItemRequestOptions
- Direct Known Subclasses:
CosmosPatchItemRequestOptions
Encapsulates options that can be specified for a request issued to cosmos Item.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGets the consistency level required for the request.Gets the Dedicated Gateway Request OptionsGets the If-Match (ETag) associated with the request in the Azure Cosmos DB service.Gets the If-None-Match (ETag) associated with the request in the Azure Cosmos DB service.Gets the indexing directive (index, do not index etc).Gets the triggers to be invoked after the operation.Gets the triggers to be invoked before the operation.Gets the token for use with session consistency.Gets the thresholdForDiagnosticsOnTracer, if latency on CRUD operation is greater than this diagnostics will be sent to open telemetry exporter as events in tracer span of end to end CRUD api.Gets the throughput control group name.Gets the boolean to only return the headers and status code in Cosmos DB response in case of Create, Update and Delete operations on CosmosItem.setConsistencyLevel
(ConsistencyLevel consistencyLevel) Sets the consistency level required for the request.setContentResponseOnWriteEnabled
(Boolean contentResponseOnWriteEnabled) Sets the boolean to only return the headers and status code in Cosmos DB response in case of Create, Update and Delete operations on CosmosItem.setDedicatedGatewayRequestOptions
(DedicatedGatewayRequestOptions dedicatedGatewayRequestOptions) Sets the Dedicated Gateway Request OptionssetIfMatchETag
(String ifMatchETag) Sets the If-Match (ETag) associated with the request in the Azure Cosmos DB service.setIfNoneMatchETag
(String ifNoneMatchETag) Sets the If-None-Match (ETag) associated with the request in the Azure Cosmos DB service.setIndexingDirective
(IndexingDirective indexingDirective) Sets the indexing directive (index, do not index etc).setPostTriggerInclude
(List<String> postTriggerInclude) Sets the triggers to be invoked after the operation.setPreTriggerInclude
(List<String> preTriggerInclude) Sets the triggers to be invoked before the operation.setSessionToken
(String sessionToken) Sets the token for use with session consistency.setThresholdForDiagnosticsOnTracer
(Duration thresholdForDiagnosticsOnTracer) Sets the thresholdForDiagnosticsOnTracer, if latency on CRUD operation is greater than this diagnostics will be sent to open telemetry exporter as events in tracer span of end to end CRUD api.void
setThroughputControlGroupName
(String throughputControlGroupName) Sets the throughput control group name.
-
Constructor Details
-
CosmosItemRequestOptions
public CosmosItemRequestOptions()Constructor
-
-
Method Details
-
getIfMatchETag
Gets the If-Match (ETag) associated with the request in the Azure Cosmos DB service.- Returns:
- the ifMatchETag associated with the request.
-
setIfMatchETag
Sets the If-Match (ETag) associated with the request in the Azure Cosmos DB service.- Parameters:
ifMatchETag
- the ifMatchETag associated with the request.- Returns:
- the current request options
-
getIfNoneMatchETag
Gets the If-None-Match (ETag) associated with the request in the Azure Cosmos DB service.- Returns:
- the ifNoneMatchETag associated with the request.
-
setIfNoneMatchETag
Sets the If-None-Match (ETag) associated with the request in the Azure Cosmos DB service.- Parameters:
ifNoneMatchETag
- the ifNoneMatchETag associated with the request.- Returns:
- the current request options
-
getConsistencyLevel
Gets the consistency level required for the request.- Returns:
- the consistency level.
-
setConsistencyLevel
Sets the consistency level required for the request. The effective consistency level can only be reduced for read/query requests. So when the Account's default consistency level is for example Session you can specify on a request-by-request level for individual requests that Eventual consistency is sufficient - which could reduce the latency and RU charges for this request but will not guarantee session consistency (read-your-own-write) anymore NOTE: If the consistency-level set on a request level here is SESSION and the default consistency level specified when constructing the CosmosClient instance via CosmosClientBuilder.consistencyLevel is not SESSION then session token capturing also needs to be enabled by calling CosmosClientBuilder:sessionCapturingOverrideEnabled(true) explicitly.- Parameters:
consistencyLevel
- the consistency level.- Returns:
- the CosmosItemRequestOptions.
-
getIndexingDirective
Gets the indexing directive (index, do not index etc).- Returns:
- the indexing directive.
-
setIndexingDirective
Sets the indexing directive (index, do not index etc).- Parameters:
indexingDirective
- the indexing directive.- Returns:
- the CosmosItemRequestOptions.
-
getPreTriggerInclude
Gets the triggers to be invoked before the operation.- Returns:
- the triggers to be invoked before the operation.
-
setPreTriggerInclude
Sets the triggers to be invoked before the operation.- Parameters:
preTriggerInclude
- the triggers to be invoked before the operation.- Returns:
- the CosmosItemRequestOptions.
-
getPostTriggerInclude
Gets the triggers to be invoked after the operation.- Returns:
- the triggers to be invoked after the operation.
-
setPostTriggerInclude
Sets the triggers to be invoked after the operation.- Parameters:
postTriggerInclude
- the triggers to be invoked after the operation.- Returns:
- the CosmosItemRequestOptions.
-
getSessionToken
Gets the token for use with session consistency.- Returns:
- the session token.
-
setSessionToken
Sets the token for use with session consistency.- Parameters:
sessionToken
- the session token.- Returns:
- the CosmosItemRequestOptions.
-
isContentResponseOnWriteEnabled
Gets the boolean 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, service doesn't return a payload in the response. It reduces networking and CPU load by not sending the payload back over the network and serializing it on the client. This feature does not impact RU usage for read or write operations. NOTE: This flag is also present onCosmosClientBuilder
, however if specified onCosmosItemRequestOptions
, it will override the value specified inCosmosClientBuilder
for this request. By-default, this is null.- Returns:
- a boolean indicating whether payload will be included in the response or not for this request.
-
setContentResponseOnWriteEnabled
public CosmosItemRequestOptions setContentResponseOnWriteEnabled(Boolean contentResponseOnWriteEnabled) Sets the boolean 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, service doesn't return payload in the response. It reduces networking and CPU load by not sending the payload back over the network and serializing it on the client. This feature does not impact RU usage for read or write operations. By-default, this is null. NOTE: This flag is also present onCosmosClientBuilder
, however if specified onCosmosItemRequestOptions
, it will override the value specified inCosmosClientBuilder
for this request.- Parameters:
contentResponseOnWriteEnabled
- a boolean indicating whether payload will be included in the response or not for this request- Returns:
- the CosmosItemRequestOptions.
-
getDedicatedGatewayRequestOptions
Gets the Dedicated Gateway Request Options- Returns:
- the Dedicated Gateway Request Options
-
setDedicatedGatewayRequestOptions
public CosmosItemRequestOptions setDedicatedGatewayRequestOptions(DedicatedGatewayRequestOptions dedicatedGatewayRequestOptions) Sets the Dedicated Gateway Request Options- Parameters:
dedicatedGatewayRequestOptions
- Dedicated Gateway Request Options- Returns:
- the CosmosItemRequestOptions
-
getThroughputControlGroupName
@Beta(value=V4_13_0, warningText="Preview API - subject to change in non-backwards compatible way") public String getThroughputControlGroupName()Gets the throughput control group name.- Returns:
- the throughput control group name.
-
setThroughputControlGroupName
@Beta(value=V4_13_0, warningText="Preview API - subject to change in non-backwards compatible way") public void setThroughputControlGroupName(String throughputControlGroupName) Sets the throughput control group name.- Parameters:
throughputControlGroupName
- the throughput control group name.
-
getThresholdForDiagnosticsOnTracer
Gets the thresholdForDiagnosticsOnTracer, if latency on CRUD operation is greater than this diagnostics will be sent to open telemetry exporter as events in tracer span of end to end CRUD api. Default is 100 ms.- Returns:
- thresholdForDiagnosticsOnTracerInMS the latency threshold for diagnostics on tracer.
-
setThresholdForDiagnosticsOnTracer
public CosmosItemRequestOptions setThresholdForDiagnosticsOnTracer(Duration thresholdForDiagnosticsOnTracer) Sets the thresholdForDiagnosticsOnTracer, if latency on CRUD operation is greater than this diagnostics will be sent to open telemetry exporter as events in tracer span of end to end CRUD api. Default is 100 ms.- Parameters:
thresholdForDiagnosticsOnTracer
- the latency threshold for diagnostics on tracer.- Returns:
- the CosmosItemRequestOptions
-