CompletableFuture<CloudBlobMetadata> upsertMetadataAsync(CloudBlobMetadata blobMetadata) {

    Timer.Context operationTime = azureMetrics.documentCreateTime.time();
    return cosmosAsyncContainer.upsertItem(blobMetadata, new PartitionKey(blobMetadata.getPartitionId()),
        new CosmosItemRequestOptions()).toFuture().handle((response, throwable) -> {
      operationTime.stop();
      if (throwable != null) {
        throw throwable instanceof CompletionException ? (CompletionException) throwable
            : new CompletionException(throwable);
      }
      return response.getItem();
    });
  }
Upsert the blob metadata document in the CosmosDB container asynchronously.
@param blobMetadata the blob metadata document.
@return a {@link CompletableFuture} that will eventually contain either the upserted {@link CloudBlobMetadata} if
        successful or {@link CosmosException} exception if an error occurred.
ambry-cloud/src/main/java/com/github/ambry/cloud/azure/CosmosDataAccessor.java