Class CosmosContainerProperties
- java.lang.Object
-
- com.azure.data.cosmos.JsonSerializable
-
- com.azure.data.cosmos.Resource
-
- com.azure.data.cosmos.CosmosContainerProperties
-
public class CosmosContainerProperties extends Resource
Represents a item container in the Azure Cosmos DB database service. A cosmos container is a named logical container for cosmos items.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 Summary
Constructors Constructor Description CosmosContainerProperties(String id, PartitionKeyDefinition partitionKeyDefinition)
ConstructorCosmosContainerProperties(String id, String partitionKeyPath)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConflictResolutionPolicy
conflictResolutionPolicy()
Gets the conflictResolutionPolicy that is used for resolving conflicting writes on documents in different regions, in a collection in the Azure Cosmos DB service.CosmosContainerProperties
conflictResolutionPolicy(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.Integer
defaultTimeToLive()
Gets the collection's default time-to-live value.void
defaultTimeToLive(Integer timeToLive)
Sets the collection's default time-to-live value.IndexingPolicy
indexingPolicy()
Gets the container's indexing policy.CosmosContainerProperties
indexingPolicy(IndexingPolicy indexingPolicy)
Sets the container's indexing policyPartitionKeyDefinition
partitionKeyDefinition()
Gets the containers's partition key definition.CosmosContainerProperties
partitionKeyDefinition(PartitionKeyDefinition partitionKeyDefinition)
Sets the containers's partition key definition.UniqueKeyPolicy
uniqueKeyPolicy()
Gets the containers unique key policyCosmosContainerProperties
uniqueKeyPolicy(UniqueKeyPolicy uniqueKeyPolicy)
Sets the Containers unique key policy-
Methods inherited from class com.azure.data.cosmos.Resource
etag, id, id, resourceId, resourceId, selfLink, timestamp
-
Methods inherited from class com.azure.data.cosmos.JsonSerializable
get, getBoolean, getCollection, getDouble, getInt, getList, getLogger, getLong, getMap, getObject, getObjectByPath, getString, has, toJson, toJson, toObject, toString
-
-
-
-
Constructor Detail
-
CosmosContainerProperties
public CosmosContainerProperties(String id, String partitionKeyPath)
Constructor- Parameters:
id
- id of the ContainerpartitionKeyPath
- partition key path
-
CosmosContainerProperties
public CosmosContainerProperties(String id, PartitionKeyDefinition partitionKeyDefinition)
Constructor- Parameters:
id
- id of the containerpartitionKeyDefinition
- thePartitionKeyDefinition
-
-
Method Detail
-
indexingPolicy
public IndexingPolicy indexingPolicy()
Gets the container's indexing policy.- Returns:
- the indexing policy.
-
indexingPolicy
public CosmosContainerProperties indexingPolicy(IndexingPolicy indexingPolicy)
Sets the container's indexing policy- Parameters:
indexingPolicy
-IndexingPolicy
the indexing policy- Returns:
- the CosmosContainerProperties.
-
uniqueKeyPolicy
public UniqueKeyPolicy uniqueKeyPolicy()
Gets the containers unique key policy- Returns:
- the unique key policy
-
uniqueKeyPolicy
public CosmosContainerProperties uniqueKeyPolicy(UniqueKeyPolicy uniqueKeyPolicy)
Sets the Containers unique key policy- Parameters:
uniqueKeyPolicy
- the unique key policy- Returns:
- the CosmosContainerProperties.
-
partitionKeyDefinition
public PartitionKeyDefinition partitionKeyDefinition()
Gets the containers's partition key definition.- Returns:
- the partition key definition.
-
partitionKeyDefinition
public CosmosContainerProperties partitionKeyDefinition(PartitionKeyDefinition partitionKeyDefinition)
Sets the containers's partition key definition.- Parameters:
partitionKeyDefinition
- the partition key definition.- Returns:
- the CosmosContainerProperties.
-
conflictResolutionPolicy
public ConflictResolutionPolicy conflictResolutionPolicy()
Gets the conflictResolutionPolicy that is used for resolving conflicting writes on documents in different regions, in a collection in the Azure Cosmos DB service.- Returns:
- ConflictResolutionPolicy
-
conflictResolutionPolicy
public CosmosContainerProperties conflictResolutionPolicy(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.- Parameters:
value
- ConflictResolutionPolicy to be used.- Returns:
- the CosmosContainerProperties.
-
defaultTimeToLive
public Integer defaultTimeToLive()
Gets the collection's default time-to-live value.- Returns:
- the default time-to-live value in seconds.
-
defaultTimeToLive
public void defaultTimeToLive(Integer timeToLive)
Sets the collection's default time-to-live value.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.
- Parameters:
timeToLive
- the default time-to-live value in seconds.
-
-