public class CosmosContainerProperties extends Resource
A database may contain zero or more named containers and each container consists of zero or more JSON items. Being schema-free, the items in a container do not need to share the same structure or fields. Since containers are application resources, they can be authorized using either the master key or resource keys.
Constructor and Description |
---|
CosmosContainerProperties(String id,
PartitionKeyDefinition partitionKeyDefinition)
Constructor
|
CosmosContainerProperties(String id,
String partitionKeyPath)
Constructor
|
Modifier and Type | Method and Description |
---|---|
ConflictResolutionPolicy |
getConflictResolutionPolicy()
Gets the conflictResolutionPolicy that is used for resolving conflicting writes
on documents in different regions, in a collection in the Azure Cosmos DB service.
|
Integer |
getDefaultTimeToLiveInSeconds()
Gets the collection's default time-to-live value.
|
IndexingPolicy |
getIndexingPolicy()
Gets the container's indexing policy.
|
PartitionKeyDefinition |
getPartitionKeyDefinition()
Gets the containers's partition key definition.
|
UniqueKeyPolicy |
getUniqueKeyPolicy()
Gets the containers unique key policy
|
CosmosContainerProperties |
setConflictResolutionPolicy(ConflictResolutionPolicy value)
Sets the conflictResolutionPolicy that is used for resolving conflicting writes
on documents in different regions, in a collection in the Azure Cosmos DB service.
|
void |
setDefaultTimeToLiveInSeconds(Integer timeToLive)
Sets the collection's default time-to-live value.
|
CosmosContainerProperties |
setIndexingPolicy(IndexingPolicy indexingPolicy)
Sets the container's indexing policy
|
CosmosContainerProperties |
setPartitionKeyDefinition(PartitionKeyDefinition partitionKeyDefinition)
Sets the containers's partition key definition.
|
CosmosContainerProperties |
setUniqueKeyPolicy(UniqueKeyPolicy uniqueKeyPolicy)
Sets the Containers unique key policy
|
getETag, getId, getResourceId, getSelfLink, getTimestamp, setId, setResourceId
get, getBoolean, getCollection, getDouble, getInt, getList, getLogger, getLong, getMap, getObject, getObjectByPath, getString, has, toJson, toJson, toObject, toString
public CosmosContainerProperties(String id, String partitionKeyPath)
id
- id of the ContainerpartitionKeyPath
- partition key pathpublic CosmosContainerProperties(String id, PartitionKeyDefinition partitionKeyDefinition)
id
- id of the containerpartitionKeyDefinition
- the PartitionKeyDefinition
public IndexingPolicy getIndexingPolicy()
public CosmosContainerProperties setIndexingPolicy(IndexingPolicy indexingPolicy)
indexingPolicy
- IndexingPolicy
the indexing policyIllegalArgumentException
- the cosmos client exceptionpublic UniqueKeyPolicy getUniqueKeyPolicy()
public CosmosContainerProperties setUniqueKeyPolicy(UniqueKeyPolicy uniqueKeyPolicy)
uniqueKeyPolicy
- the unique key policyIllegalArgumentException
- the cosmos client exceptionpublic PartitionKeyDefinition getPartitionKeyDefinition()
public CosmosContainerProperties setPartitionKeyDefinition(PartitionKeyDefinition partitionKeyDefinition)
partitionKeyDefinition
- the partition key definition.IllegalArgumentException
- the cosmos client exceptionpublic ConflictResolutionPolicy getConflictResolutionPolicy()
public CosmosContainerProperties setConflictResolutionPolicy(ConflictResolutionPolicy value)
value
- ConflictResolutionPolicy to be used.IllegalArgumentException
- the cosmos client exceptionpublic Integer getDefaultTimeToLiveInSeconds()
public void setDefaultTimeToLiveInSeconds(Integer timeToLive)
The default time-to-live value on a collection is an optional property. If set, the documents within the collection expires after the specified number of seconds since their last write time. The value of this property should be one of the following:
null - indicates evaluation of time-to-live is disabled and documents within the collection will never expire, regardless whether individual documents have their time-to-live set.
nonzero positive integer - indicates the default time-to-live value for all documents within the collection. This value can be overridden by individual documents' time-to-live value.
-1 - indicates by default all documents within the collection never expire. This value can be overridden by individual documents' time-to-live value.
timeToLive
- the default time-to-live value in seconds.Copyright © 2020 Microsoft Corporation. All rights reserved.