Class CosmosItemRequestOptions

java.lang.Object
com.azure.cosmos.models.CosmosItemRequestOptions
Direct Known Subclasses:
CosmosPatchItemRequestOptions

public class CosmosItemRequestOptions extends Object
Encapsulates options that can be specified for a request issued to cosmos Item.
  • Constructor Details

    • CosmosItemRequestOptions

      public CosmosItemRequestOptions()
      Constructor
  • Method Details

    • getIfMatchETag

      public String getIfMatchETag()
      Gets the If-Match (ETag) associated with the request in the Azure Cosmos DB service.
      Returns:
      the ifMatchETag associated with the request.
    • setIfMatchETag

      public CosmosItemRequestOptions setIfMatchETag(String ifMatchETag)
      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

      public String 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

      public CosmosItemRequestOptions setIfNoneMatchETag(String ifNoneMatchETag)
      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

      public ConsistencyLevel getConsistencyLevel()
      Gets the consistency level required for the request.
      Returns:
      the consistency level.
    • setConsistencyLevel

      public CosmosItemRequestOptions setConsistencyLevel(ConsistencyLevel consistencyLevel)
      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

      public IndexingDirective getIndexingDirective()
      Gets the indexing directive (index, do not index etc).
      Returns:
      the indexing directive.
    • setIndexingDirective

      public CosmosItemRequestOptions setIndexingDirective(IndexingDirective indexingDirective)
      Sets the indexing directive (index, do not index etc).
      Parameters:
      indexingDirective - the indexing directive.
      Returns:
      the CosmosItemRequestOptions.
    • getPreTriggerInclude

      public List<String> getPreTriggerInclude()
      Gets the triggers to be invoked before the operation.
      Returns:
      the triggers to be invoked before the operation.
    • setPreTriggerInclude

      public CosmosItemRequestOptions setPreTriggerInclude(List<String> preTriggerInclude)
      Sets the triggers to be invoked before the operation.
      Parameters:
      preTriggerInclude - the triggers to be invoked before the operation.
      Returns:
      the CosmosItemRequestOptions.
    • getPostTriggerInclude

      public List<String> getPostTriggerInclude()
      Gets the triggers to be invoked after the operation.
      Returns:
      the triggers to be invoked after the operation.
    • setPostTriggerInclude

      public CosmosItemRequestOptions setPostTriggerInclude(List<String> postTriggerInclude)
      Sets the triggers to be invoked after the operation.
      Parameters:
      postTriggerInclude - the triggers to be invoked after the operation.
      Returns:
      the CosmosItemRequestOptions.
    • getSessionToken

      public String getSessionToken()
      Gets the token for use with session consistency.
      Returns:
      the session token.
    • setSessionToken

      public CosmosItemRequestOptions setSessionToken(String sessionToken)
      Sets the token for use with session consistency.
      Parameters:
      sessionToken - the session token.
      Returns:
      the CosmosItemRequestOptions.
    • isContentResponseOnWriteEnabled

      public Boolean 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 on CosmosClientBuilder, however if specified on CosmosItemRequestOptions, it will override the value specified in CosmosClientBuilder 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 on CosmosClientBuilder, however if specified on CosmosItemRequestOptions, it will override the value specified in CosmosClientBuilder 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

      public DedicatedGatewayRequestOptions 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

      public Duration 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