public class CosmosContainer 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 options)
Creates a new item synchronously and returns its respective Cosmos item response
while specifying additional options.
|
CosmosContainerResponse |
delete()
Deletes the current cosmos container.
|
CosmosContainerResponse |
delete(CosmosContainerRequestOptions options)
Deletes the current Cosmos container while specifying additional options such as If-Match.
|
CosmosItemResponse<Object> |
deleteItem(String itemId,
PartitionKey partitionKey,
CosmosItemRequestOptions options)
Deletes an item in the current container.
|
String |
getId()
Gets the current container id.
|
CosmosScripts |
getScripts()
Gets the Cosmos scripts using the current container as context.
|
<T> CosmosPagedIterable<T> |
queryItems(SqlQuerySpec querySpec,
CosmosQueryRequestOptions options,
Class<T> classType)
Query items in the current container returning the results as
CosmosPagedIterable . |
<T> CosmosPagedIterable<T> |
queryItems(String query,
CosmosQueryRequestOptions options,
Class<T> classType)
Query items in the current container returning the results as
CosmosPagedIterable . |
CosmosContainerResponse |
read()
Reads the current container.
|
CosmosContainerResponse |
read(CosmosContainerRequestOptions options)
Reads the current container while specifying additional options such as If-Match.
|
<T> CosmosItemResponse<T> |
readItem(String itemId,
PartitionKey partitionKey,
Class<T> itemType)
Reads an item in the current container.
|
<T> CosmosItemResponse<T> |
readItem(String itemId,
PartitionKey partitionKey,
CosmosItemRequestOptions options,
Class<T> itemType)
Reads an item in the current container while specifying additional options.
|
ThroughputResponse |
readThroughput()
Gets the throughput for the current container.
|
CosmosContainerResponse |
replace(CosmosContainerProperties containerProperties)
Replaces the current container properties.
|
CosmosContainerResponse |
replace(CosmosContainerProperties containerProperties,
CosmosContainerRequestOptions options)
Replaces the current container properties while specifying additional options such as If-Match.
|
<T> CosmosItemResponse<T> |
replaceItem(T item,
String itemId,
PartitionKey partitionKey,
CosmosItemRequestOptions options)
Replaces an item in the current container.
|
ThroughputResponse |
replaceThroughput(ThroughputProperties throughputProperties)
Sets the throughput for 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 options)
Upserts a item Cosmos sync item while specifying additional options.
|
public String getId()
public CosmosContainerResponse read()
public CosmosContainerResponse read(CosmosContainerRequestOptions options)
options
- the options.public CosmosContainerResponse delete(CosmosContainerRequestOptions options)
options
- the options.public CosmosContainerResponse delete()
public CosmosContainerResponse replace(CosmosContainerProperties containerProperties)
containerProperties
- the container properties.public CosmosContainerResponse replace(CosmosContainerProperties containerProperties, CosmosContainerRequestOptions options)
containerProperties
- the container properties.options
- the options.public ThroughputResponse replaceThroughput(ThroughputProperties throughputProperties)
throughputProperties
- the throughput properties.public ThroughputResponse readThroughput()
public <T> CosmosItemResponse<T> createItem(T item)
T
- the type parameteritem
- the itempublic <T> CosmosItemResponse<T> createItem(T item, PartitionKey partitionKey, CosmosItemRequestOptions options)
T
- the type parameter.item
- the item.partitionKey
- the partition key.options
- the options.public <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> 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 options)
T
- the type parameter.item
- the item.partitionKey
- the partitionKey.options
- the options.public <T> CosmosPagedIterable<T> queryItems(String query, CosmosQueryRequestOptions options, Class<T> classType)
CosmosPagedIterable
.T
- the type parameter.query
- the query.options
- the options.classType
- the class type.CosmosPagedIterable
.public <T> CosmosPagedIterable<T> queryItems(SqlQuerySpec querySpec, CosmosQueryRequestOptions options, Class<T> classType)
CosmosPagedIterable
.T
- the type parameter.querySpec
- the query spec.options
- the options.classType
- the class type.CosmosPagedIterable
.public <T> CosmosItemResponse<T> readItem(String itemId, PartitionKey partitionKey, Class<T> itemType)
T
- the type parameter.itemId
- the item id.partitionKey
- the partition key.itemType
- the class type of item.public <T> CosmosItemResponse<T> readItem(String itemId, PartitionKey partitionKey, CosmosItemRequestOptions options, Class<T> itemType)
T
- the type parameter.itemId
- the item id.partitionKey
- the partition key.options
- the options.itemType
- the class type of item.public <T> CosmosItemResponse<T> replaceItem(T item, String itemId, PartitionKey partitionKey, CosmosItemRequestOptions options)
T
- the type parameter.item
- the item.itemId
- the item id.partitionKey
- the partition key.options
- the options.public CosmosItemResponse<Object> deleteItem(String itemId, PartitionKey partitionKey, CosmosItemRequestOptions options)
itemId
- the item id.partitionKey
- the partition key.options
- the options.public CosmosScripts getScripts()
Copyright © 2020 Microsoft Corporation. All rights reserved.