Class CosmosBulkOperations

java.lang.Object
com.azure.cosmos.models.CosmosBulkOperations

public final class CosmosBulkOperations extends Object
Utility for creating bulk operations which can be executed by calling CosmosAsyncContainer.executeBulkOperations(Flux, CosmosBulkExecutionOptions) . Also while creating these operation, if some options which are only for individual operation can be provided by passing a CosmosBulkItemRequestOptions while creating the bulk operation. See also CosmosBulkExecutionOptions.
  • Constructor Details

    • CosmosBulkOperations

      public CosmosBulkOperations()
  • Method Details

    • getCreateItemOperation

      public static <T> CosmosItemOperation getCreateItemOperation(T item, PartitionKey partitionKey)
      Instantiate an operation for Creating item in Bulk execution.
      Type Parameters:
      T - The type of item to be created.
      Parameters:
      item - A JSON serializable object that must contain an id property.
      partitionKey - the partition key for the operation
      Returns:
      the bulk operation.
    • getCreateItemOperation

      public static <T, TContext> CosmosItemOperation getCreateItemOperation(T item, PartitionKey partitionKey, TContext context)
      Instantiate an operation for Creating item in Bulk execution.
      Type Parameters:
      T - The type of item to be created.
      TContext - The type of context to be used.
      Parameters:
      item - A JSON serializable object that must contain an id property.
      partitionKey - the partition key for the operation
      context - The caller provided context for this operation.
      Returns:
      the bulk operation.
    • getCreateItemOperation

      public static <T> CosmosItemOperation getCreateItemOperation(T item, PartitionKey partitionKey, CosmosBulkItemRequestOptions requestOptions)
      Instantiate an operation for Creating item in Bulk execution.
      Type Parameters:
      T - The type of item to be created.
      Parameters:
      item - A JSON serializable object that must contain an id property.
      partitionKey - the partition key for the operation.
      requestOptions - The options for the item request.
      Returns:
      the bulk operation.
    • getCreateItemOperation

      public static <T, TContext> CosmosItemOperation getCreateItemOperation(T item, PartitionKey partitionKey, CosmosBulkItemRequestOptions requestOptions, TContext context)
      Instantiate an operation for Creating item in Bulk execution.
      Type Parameters:
      T - The type of item to be created.
      TContext - The type of context to be used.
      Parameters:
      item - A JSON serializable object that must contain an id property.
      partitionKey - the partition key for the operation.
      requestOptions - The options for the item request.
      context - The caller provided context for this operation.
      Returns:
      the bulk operation.
    • getDeleteItemOperation

      public static CosmosItemOperation getDeleteItemOperation(String id, PartitionKey partitionKey)
      Instantiate an operation for deleting item in Bulk execution.
      Parameters:
      id - The unique id of the item.
      partitionKey - the partition key for the operation.
      Returns:
      the bulk operation.
    • getDeleteItemOperation

      public static <TContext> CosmosItemOperation getDeleteItemOperation(String id, PartitionKey partitionKey, TContext context)
      Instantiate an operation for deleting item in Bulk execution.
      Type Parameters:
      TContext - The type of context to be used.
      Parameters:
      id - The unique id of the item.
      partitionKey - the partition key for the operation.
      context - The caller provided context for this operation.
      Returns:
      the bulk operation.
    • getDeleteItemOperation

      public static CosmosItemOperation getDeleteItemOperation(String id, PartitionKey partitionKey, CosmosBulkItemRequestOptions requestOptions)
      Instantiate an operation for deleting item in Bulk execution.
      Parameters:
      id - The unique id of the item.
      partitionKey - the partition key for the operation..
      requestOptions - The options for the item request.
      Returns:
      the bulk operation.
    • getDeleteItemOperation

      public static <TContext> CosmosItemOperation getDeleteItemOperation(String id, PartitionKey partitionKey, CosmosBulkItemRequestOptions requestOptions, TContext context)
      Instantiate an operation for deleting item in Bulk execution.
      Type Parameters:
      TContext - The type of context to be used.
      Parameters:
      id - The unique id of the item.
      partitionKey - the partition key for the operation..
      requestOptions - The options for the item request.
      context - The caller provided context for this operation.
      Returns:
      the bulk operation.
    • getReadItemOperation

      public static CosmosItemOperation getReadItemOperation(String id, PartitionKey partitionKey)
      Instantiate an operation for read item in Bulk execution.
      Parameters:
      id - The unique id of the item.
      partitionKey - the partition key for the operation.
      Returns:
      the bulk operation.
    • getReadItemOperation

      public static <TContext> CosmosItemOperation getReadItemOperation(String id, PartitionKey partitionKey, TContext context)
      Instantiate an operation for read item in Bulk execution.
      Type Parameters:
      TContext - The type of context to be used.
      Parameters:
      id - The unique id of the item.
      partitionKey - the partition key for the operation.
      context - The caller provided context for this operation.
      Returns:
      the bulk operation.
    • getReadItemOperation

      public static CosmosItemOperation getReadItemOperation(String id, PartitionKey partitionKey, CosmosBulkItemRequestOptions requestOptions)
      Instantiate an operation for read item in Bulk execution.
      Parameters:
      id - The unique id of the item.
      partitionKey - the partition key for the operation..
      requestOptions - The options for the item request.
      Returns:
      the bulk operation.
    • getReadItemOperation

      public static <TContext> CosmosItemOperation getReadItemOperation(String id, PartitionKey partitionKey, CosmosBulkItemRequestOptions requestOptions, TContext context)
      Instantiate an operation for read item in Bulk execution.
      Type Parameters:
      TContext - The type of context to be used.
      Parameters:
      id - The unique id of the item.
      partitionKey - the partition key for the operation..
      requestOptions - The options for the item request.
      context - The caller provided context for this operation.
      Returns:
      the bulk operation.
    • getReplaceItemOperation

      public static <T> CosmosItemOperation getReplaceItemOperation(String id, T item, PartitionKey partitionKey)
      Instantiate an operation for replace item in Bulk execution.
      Type Parameters:
      T - The type of item to be replaced.
      Parameters:
      id - The unique id of the item.
      item - A JSON serializable object that must contain an id property.
      partitionKey - the partition key for the operation.
      Returns:
      the bulk operation.
    • getReplaceItemOperation

      public static <T, TContext> CosmosItemOperation getReplaceItemOperation(String id, T item, PartitionKey partitionKey, TContext context)
      Instantiate an operation for replace item in Bulk execution.
      Type Parameters:
      T - The type of item to be replaced.
      TContext - The type of context to be used.
      Parameters:
      id - The unique id of the item.
      item - A JSON serializable object that must contain an id property.
      partitionKey - the partition key for the operation.
      context - The caller provided context for this operation.
      Returns:
      the bulk operation.
    • getReplaceItemOperation

      public static <T> CosmosItemOperation getReplaceItemOperation(String id, T item, PartitionKey partitionKey, CosmosBulkItemRequestOptions requestOptions)
      Instantiate an operation for replace item in Bulk execution.
      Type Parameters:
      T - The type of item to be replaced.
      Parameters:
      id - The unique id of the item..
      item - A JSON serializable object that must contain an id property.
      partitionKey - the partition key for the operation.
      requestOptions - The options for the item request.
      Returns:
      the bulk operation.
    • getReplaceItemOperation

      public static <T, TContext> CosmosItemOperation getReplaceItemOperation(String id, T item, PartitionKey partitionKey, CosmosBulkItemRequestOptions requestOptions, TContext context)
      Instantiate an operation for replace item in Bulk execution.
      Type Parameters:
      T - The type of item to be replaced.
      TContext - The type of context to be used.
      Parameters:
      id - The unique id of the item..
      item - A JSON serializable object that must contain an id property.
      partitionKey - the partition key for the operation.
      requestOptions - The options for the item request.
      context - The caller provided context for this operation.
      Returns:
      the bulk operation.
    • getUpsertItemOperation

      public static <T> CosmosItemOperation getUpsertItemOperation(T item, PartitionKey partitionKey)
      Instantiate an operation for upsert item in Bulk execution.
      Type Parameters:
      T - The type of item to be upserted.
      Parameters:
      item - A JSON serializable object that must contain an id property.
      partitionKey - the partition key for the operation.
      Returns:
      the bulk operation.
    • getUpsertItemOperation

      public static <T, TContext> CosmosItemOperation getUpsertItemOperation(T item, PartitionKey partitionKey, TContext context)
      Instantiate an operation for upsert item in Bulk execution.
      Type Parameters:
      T - The type of item to be upserted.
      TContext - The type of context to be used.
      Parameters:
      item - A JSON serializable object that must contain an id property.
      partitionKey - the partition key for the operation.
      context - The caller provided context for this operation.
      Returns:
      the bulk operation.
    • getUpsertItemOperation

      public static <T> CosmosItemOperation getUpsertItemOperation(T item, PartitionKey partitionKey, CosmosBulkItemRequestOptions requestOptions)
      Instantiate an operation for upsert item in Bulk execution.
      Type Parameters:
      T - The type of item to be upserted.
      Parameters:
      item - A JSON serializable object that must contain an id property.
      partitionKey - the partition key for the operation.
      requestOptions - The options for the item request.
      Returns:
      the bulk operation.
    • getUpsertItemOperation

      public static <T, TContext> CosmosItemOperation getUpsertItemOperation(T item, PartitionKey partitionKey, CosmosBulkItemRequestOptions requestOptions, TContext context)
      Instantiate an operation for upsert item in Bulk execution.
      Type Parameters:
      T - The type of item to be upserted.
      TContext - The type of context to be used.
      Parameters:
      item - A JSON serializable object that must contain an id property.
      partitionKey - the partition key for the operation.
      requestOptions - The options for the item request.
      context - The caller provided context for this operation.
      Returns:
      the bulk operation.
    • getPatchItemOperation

      public static CosmosItemOperation getPatchItemOperation(String id, PartitionKey partitionKey, CosmosPatchOperations cosmosPatchOperations)
      Instantiate an operation for a patch in Bulk execution.
      Parameters:
      id - the item id.
      partitionKey - the partition key for the operation.
      cosmosPatchOperations - Represents a container having list of operations to be sequentially applied to the referred Cosmos item.
      Returns:
      the bulk operation.
    • getPatchItemOperation

      public static <TContext> CosmosItemOperation getPatchItemOperation(String id, PartitionKey partitionKey, CosmosPatchOperations cosmosPatchOperations, TContext context)
      Instantiate an operation for a patch in Bulk execution.
      Type Parameters:
      TContext - The type of context to be used.
      Parameters:
      id - the item id.
      partitionKey - the partition key for the operation.
      cosmosPatchOperations - Represents a container having list of operations to be sequentially applied to the referred Cosmos item.
      context - The caller provided context for this operation.
      Returns:
      the bulk operation.
    • getPatchItemOperation

      public static CosmosItemOperation getPatchItemOperation(String id, PartitionKey partitionKey, CosmosPatchOperations cosmosPatchOperations, CosmosBulkPatchItemRequestOptions requestOptions)
      Instantiate an operation for a patch in Bulk execution.
      Parameters:
      id - the item id.
      partitionKey - the partition key for the operation.
      cosmosPatchOperations - Represents a container having list of operations to be sequentially applied to the referred Cosmos item.
      requestOptions - The options for the item request.
      Returns:
      the bulk operation.
    • getPatchItemOperation

      public static <TContext> CosmosItemOperation getPatchItemOperation(String id, PartitionKey partitionKey, CosmosPatchOperations cosmosPatchOperations, CosmosBulkPatchItemRequestOptions requestOptions, TContext context)
      Instantiate an operation for a patch in Bulk execution.
      Type Parameters:
      TContext - The type of context to be used.
      Parameters:
      id - the item id.
      partitionKey - the partition key for the operation.
      cosmosPatchOperations - Represents a container having list of operations to be sequentially applied to the referred Cosmos item.
      requestOptions - The options for the item request.
      context - The caller provided context for this operation.
      Returns:
      the bulk operation.