public class CosmosEncryptionContainer extends Object
Modifier and Type | Method and Description |
---|---|
<T> CosmosItemResponse<T> |
createItem(T item)
Creates a new item synchronously and returns its respective Cosmos item response.
|
<T> CosmosItemResponse<T> |
createItem(T item,
CosmosItemRequestOptions options)
Creates a new item synchronously and returns its respective Cosmos item response
while specifying additional options.
|
<T> CosmosItemResponse<T> |
createItem(T item,
PartitionKey partitionKey,
CosmosItemRequestOptions requestOptions)
Creates a new item synchronously and returns its respective Cosmos item response
while specifying additional options.
|
CosmosItemResponse<Object> |
deleteAllItemsByPartitionKey(PartitionKey partitionKey,
CosmosItemRequestOptions options)
Deletes all items in the Container with the specified partitionKey value.
|
CosmosItemResponse<Object> |
deleteItem(String itemId,
PartitionKey partitionKey,
CosmosItemRequestOptions requestOptions)
Deletes an item in the current container.
|
<T> CosmosItemResponse<Object> |
deleteItem(T item,
CosmosItemRequestOptions options)
Deletes an item in the current container.
|
CosmosBatchResponse |
executeCosmosBatch(CosmosBatch cosmosBatch)
Executes the encrypted transactional batch.
|
CosmosBatchResponse |
executeCosmosBatch(CosmosBatch cosmosBatch,
CosmosBatchRequestOptions requestOptions)
Executes the encrypted transactional batch.
|
CosmosContainer |
getCosmosContainer()
Gets the CosmosContainer
|
<T> CosmosPagedIterable<T> |
queryChangeFeed(CosmosChangeFeedRequestOptions options,
Class<T> classType)
Query for items in the change feed of the current container using the
CosmosChangeFeedRequestOptions . |
<T> CosmosPagedIterable<T> |
queryItems(SqlQuerySpec query,
CosmosQueryRequestOptions requestOptions,
Class<T> classType)
Query items in the current container returning the results as
CosmosPagedIterable . |
<T> CosmosPagedIterable<T> |
queryItems(String query,
CosmosQueryRequestOptions requestOptions,
Class<T> classType)
Query items in the current container returning the results as
CosmosPagedIterable . |
<T> CosmosPagedIterable<T> |
queryItemsOnEncryptedProperties(SqlQuerySpecWithEncryption sqlQuerySpecWithEncryption,
CosmosQueryRequestOptions options,
Class<T> classType)
Query for items in the current container using a
SqlQuerySpecWithEncryption . |
<T> CosmosItemResponse<T> |
readItem(String id,
PartitionKey partitionKey,
Class<T> classType)
Reads an item in the current container.
|
<T> CosmosItemResponse<T> |
readItem(String id,
PartitionKey partitionKey,
CosmosItemRequestOptions requestOptions,
Class<T> classType)
Reads an item in the current container while specifying additional options.
|
<T> CosmosItemResponse<T> |
replaceItem(T item,
String itemId,
PartitionKey partitionKey,
CosmosItemRequestOptions requestOptions)
Replaces an item in the current container.
|
<T> CosmosItemResponse<T> |
upsertItem(T item)
Upserts an Cosmos item in the current container.
|
<T> CosmosItemResponse<T> |
upsertItem(T item,
CosmosItemRequestOptions options)
Upserts a item Cosmos sync item while specifying additional options.
|
<T> CosmosItemResponse<T> |
upsertItem(T item,
PartitionKey partitionKey,
CosmosItemRequestOptions requestOptions)
Upserts a item Cosmos sync item while specifying additional options.
|
public <T> CosmosItemResponse<T> createItem(T item)
T
- the type parameteritem
- the itempublic <T> CosmosItemResponse<T> createItem(T item, CosmosItemRequestOptions options)
The partition key value will be automatically extracted from the item's content.
T
- the type parameter.item
- the item.options
- the options.public <T> CosmosItemResponse<T> createItem(T item, PartitionKey partitionKey, CosmosItemRequestOptions requestOptions)
T
- the type parameter.item
- the item.partitionKey
- the partition key.requestOptions
- the options.public CosmosItemResponse<Object> deleteItem(String itemId, PartitionKey partitionKey, CosmosItemRequestOptions requestOptions)
itemId
- the item id.partitionKey
- the partition key.requestOptions
- the options.public <T> CosmosItemResponse<Object> deleteItem(T item, CosmosItemRequestOptions options)
T
- the type parameter.item
- the item to be deleted.options
- the options.@Beta(value=V1, warningText="Preview API - subject to change in non-backwards compatible way") public CosmosItemResponse<Object> deleteAllItemsByPartitionKey(PartitionKey partitionKey, CosmosItemRequestOptions options)
partitionKey
- the partition key.options
- the options.public <T> CosmosItemResponse<T> upsertItem(T item)
T
- the type parameter.item
- the item.public <T> CosmosItemResponse<T> upsertItem(T item, CosmosItemRequestOptions options)
T
- the type parameter.item
- the item.options
- the options.public <T> CosmosItemResponse<T> upsertItem(T item, PartitionKey partitionKey, CosmosItemRequestOptions requestOptions)
T
- the type parameter.item
- the item.partitionKey
- the partitionKey.requestOptions
- the options.public <T> CosmosItemResponse<T> replaceItem(T item, String itemId, PartitionKey partitionKey, CosmosItemRequestOptions requestOptions)
T
- the type parameter.item
- the item.itemId
- the item id.partitionKey
- the partition key.requestOptions
- the options.public <T> CosmosItemResponse<T> readItem(String id, PartitionKey partitionKey, Class<T> classType)
T
- the type parameter.id
- the item id.partitionKey
- the partition key.classType
- the class type of item.public <T> CosmosItemResponse<T> readItem(String id, PartitionKey partitionKey, CosmosItemRequestOptions requestOptions, Class<T> classType)
T
- the type parameter.id
- the item id.partitionKey
- the partition key.requestOptions
- the options.classType
- the class type of item.public <T> CosmosPagedIterable<T> queryItems(String query, CosmosQueryRequestOptions requestOptions, Class<T> classType)
CosmosPagedIterable
.T
- the type parameter.query
- the query.requestOptions
- the options.classType
- the class type.CosmosPagedIterable
.public <T> CosmosPagedIterable<T> queryItems(SqlQuerySpec query, CosmosQueryRequestOptions requestOptions, Class<T> classType)
CosmosPagedIterable
.T
- the type parameter.query
- the query spec.requestOptions
- the options.classType
- the class type.CosmosPagedIterable
.public <T> CosmosPagedIterable<T> queryItemsOnEncryptedProperties(SqlQuerySpecWithEncryption sqlQuerySpecWithEncryption, CosmosQueryRequestOptions options, Class<T> classType)
SqlQuerySpecWithEncryption
.T
- the type parameter.sqlQuerySpecWithEncryption
- the sqlQuerySpecWithEncryption.options
- the query request options.classType
- the class type.CosmosPagedIterable
.@Beta(value=V1, warningText="Preview API - subject to change in non-backwards compatible way") public <T> CosmosPagedIterable<T> queryChangeFeed(CosmosChangeFeedRequestOptions options, Class<T> classType)
CosmosChangeFeedRequestOptions
.
The next page can be retrieved by calling queryChangeFeed again with a new instance of
CosmosChangeFeedRequestOptions
created from the continuation token of the previously returned
FeedResponse
instance.
T
- the type parameter.options
- the change feed request options.classType
- the class type.CosmosPagedFlux
containing one feed response page@Beta(value=V1, warningText="Preview API - subject to change in non-backwards compatible way") public CosmosBatchResponse executeCosmosBatch(CosmosBatch cosmosBatch)
cosmosBatch
- Batch having list of operation and partition key which will be executed by this container.
If the transactional batch executes successfully, the value returned by CosmosBatchResponse.getStatusCode()
on the response returned will be set to 200}.
If an operation within the transactional batch fails during execution, no changes from the batch will be
committed and the status of the failing operation is made available by CosmosBatchResponse.getStatusCode()
or by the exception. To obtain information about the operations
that failed in case of some user error like conflict, not found etc, the response can be enumerated.
This returns CosmosBatchOperationResult
instances corresponding to each operation in the
transactional batch in the order they were added to the transactional batch.
For a result corresponding to an operation within the transactional batch, use
CosmosBatchOperationResult.getStatusCode()
to access the status of the operation. If the operation was not executed or it was aborted due to the failure of
another operation within the transactional batch, the value of this field will be 424;
for the operation that caused the batch to abort, the value of this field
will indicate the cause of failure.
If there are issues such as request timeouts, Gone, session not available, network failure or if the service somehow returns 5xx then this will throw an exception instead of returning a CosmosBatchResponse.
Use CosmosBatchResponse.isSuccessStatusCode()
on the response returned to ensure that the
transactional batch succeeded.
@Beta(value=V1, warningText="Preview API - subject to change in non-backwards compatible way") public CosmosBatchResponse executeCosmosBatch(CosmosBatch cosmosBatch, CosmosBatchRequestOptions requestOptions)
cosmosBatch
- Batch having list of operation and partition key which will be executed by this container.requestOptions
- Options that apply specifically to batch request.
If the transactional batch executes successfully, the value returned by CosmosBatchResponse.getStatusCode()
on the response returned will be set to 200}.
If an operation within the transactional batch fails during execution, no changes from the batch will be
committed and the status of the failing operation is made available by CosmosBatchResponse.getStatusCode()
or by the exception. To obtain information about the operations
that failed in case of some user error like conflict, not found etc, the response can be enumerated.
This returns CosmosBatchOperationResult
instances corresponding to each operation in the
transactional batch in the order they were added to the transactional batch.
For a result corresponding to an operation within the transactional batch, use
CosmosBatchOperationResult.getStatusCode()
to access the status of the operation. If the operation was not executed or it was aborted due to the failure of
another operation within the transactional batch, the value of this field will be 424;
for the operation that caused the batch to abort, the value of this field
will indicate the cause of failure.
If there are issues such as request timeouts, Gone, session not available, network failure or if the service somehow returns 5xx then this will throw an exception instead of returning a CosmosBatchResponse.
Use CosmosBatchResponse.isSuccessStatusCode()
on the response returned to ensure that the
transactional batch succeeded.
public CosmosContainer getCosmosContainer()
Visit the Azure for Java Developers site for more Java documentation, including quick starts, tutorials, and code samples.