Class CosmosContainerProperties
- java.lang.Object
-
- com.azure.cosmos.models.CosmosContainerProperties
-
public final class CosmosContainerProperties extends Object
Represents a 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 Integer
getAnalyticalStoreTimeToLiveInSeconds()
Gets the analytical store time to live in seconds for items in a container from the Azure Cosmos DB service.ChangeFeedPolicy
getChangeFeedPolicy()
Gets the changeFeedPolicy for this container in the Azure Cosmos DB service.ClientEncryptionPolicy
getClientEncryptionPolicy()
Gets the ClientEncryptionPolicy that is used for encrypting item fieldsConflictResolutionPolicy
getConflictResolutionPolicy()
Gets the conflictResolutionPolicy that is used for resolving conflicting writes on items in different regions, in a container in the Azure Cosmos DB service.Integer
getDefaultTimeToLiveInSeconds()
Gets the container's default time-to-live value.String
getETag()
Get the entity tag associated with the resource.String
getId()
Gets the name of the resource.IndexingPolicy
getIndexingPolicy()
Gets the container's indexing policy.PartitionKeyDefinition
getPartitionKeyDefinition()
Gets the containers's partition key definition.String
getResourceId()
Gets the ID associated with the resource.Instant
getTimestamp()
Get the last modified timestamp associated with the resource.UniqueKeyPolicy
getUniqueKeyPolicy()
Gets the containers unique key policyCosmosContainerProperties
setAnalyticalStoreTimeToLiveInSeconds(Integer timeToLive)
Sets the analytical store time to live in seconds for items in a container from the Azure Cosmos DB service.CosmosContainerProperties
setChangeFeedPolicy(ChangeFeedPolicy value)
Sets the changeFeedPolicy for this container in the Azure Cosmos DB service.CosmosContainerProperties
setClientEncryptionPolicy(ClientEncryptionPolicy value)
Sets the ClientEncryptionPolicy that is used for encrypting item fieldsCosmosContainerProperties
setConflictResolutionPolicy(ConflictResolutionPolicy value)
Sets the conflictResolutionPolicy that is used for resolving conflicting writes on items in different regions, in a container in the Azure Cosmos DB service.CosmosContainerProperties
setDefaultTimeToLiveInSeconds(Integer timeToLive)
Sets the container's default time-to-live value.CosmosContainerProperties
setId(String id)
Sets the name of the resource.CosmosContainerProperties
setIndexingPolicy(IndexingPolicy indexingPolicy)
Sets the container's indexing policyCosmosContainerProperties
setPartitionKeyDefinition(PartitionKeyDefinition partitionKeyDefinition)
Sets the containers's partition key definition.CosmosContainerProperties
setUniqueKeyPolicy(UniqueKeyPolicy uniqueKeyPolicy)
Sets the Containers unique key policy
-
-
-
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
-
getIndexingPolicy
public IndexingPolicy getIndexingPolicy()
Gets the container's indexing policy.- Returns:
- the indexing policy.
-
setIndexingPolicy
public CosmosContainerProperties setIndexingPolicy(IndexingPolicy indexingPolicy)
Sets the container's indexing policy- Parameters:
indexingPolicy
-IndexingPolicy
the indexing policy- Returns:
- the CosmosContainerProperties.
-
getUniqueKeyPolicy
public UniqueKeyPolicy getUniqueKeyPolicy()
Gets the containers unique key policy- Returns:
- the unique key policy
-
setUniqueKeyPolicy
public CosmosContainerProperties setUniqueKeyPolicy(UniqueKeyPolicy uniqueKeyPolicy)
Sets the Containers unique key policy- Parameters:
uniqueKeyPolicy
- the unique key policy- Returns:
- the CosmosContainerProperties.
-
getPartitionKeyDefinition
public PartitionKeyDefinition getPartitionKeyDefinition()
Gets the containers's partition key definition.- Returns:
- the partition key definition.
-
setPartitionKeyDefinition
public CosmosContainerProperties setPartitionKeyDefinition(PartitionKeyDefinition partitionKeyDefinition)
Sets the containers's partition key definition.- Parameters:
partitionKeyDefinition
- the partition key definition.- Returns:
- the CosmosContainerProperties.
-
getConflictResolutionPolicy
public ConflictResolutionPolicy getConflictResolutionPolicy()
Gets the conflictResolutionPolicy that is used for resolving conflicting writes on items in different regions, in a container in the Azure Cosmos DB service.- Returns:
- ConflictResolutionPolicy
-
setConflictResolutionPolicy
public CosmosContainerProperties setConflictResolutionPolicy(ConflictResolutionPolicy value)
Sets the conflictResolutionPolicy that is used for resolving conflicting writes on items in different regions, in a container in the Azure Cosmos DB service.- Parameters:
value
- ConflictResolutionPolicy to be used.- Returns:
- the CosmosContainerProperties.
-
getChangeFeedPolicy
@Beta(value=V4_12_0, warningText="Preview API - subject to change in non-backwards compatible way") public ChangeFeedPolicy getChangeFeedPolicy()
Gets the changeFeedPolicy for this container in the Azure Cosmos DB service.- Returns:
- ChangeFeedPolicy
-
setChangeFeedPolicy
@Beta(value=V4_12_0, warningText="Preview API - subject to change in non-backwards compatible way") public CosmosContainerProperties setChangeFeedPolicy(ChangeFeedPolicy value)
Sets the changeFeedPolicy for this container in the Azure Cosmos DB service.- Parameters:
value
- ChangeFeedPolicy to be used.- Returns:
- the CosmosContainerProperties.
-
getDefaultTimeToLiveInSeconds
public Integer getDefaultTimeToLiveInSeconds()
Gets the container's default time-to-live value.- Returns:
- the default time-to-live value in seconds.
-
setDefaultTimeToLiveInSeconds
public CosmosContainerProperties setDefaultTimeToLiveInSeconds(Integer timeToLive)
Sets the container's default time-to-live value.The default time-to-live value on a container is an optional property. If set, the items within the container 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 items within the container will never expire, regardless whether individual items have their time-to-live set.
nonzero positive integer - indicates the default time-to-live value for all items within the container. This value can be overridden by individual items time-to-live value.
-1 - indicates by default all items within the container never expire. This value can be overridden by individual items time-to-live value.
- Parameters:
timeToLive
- the default time-to-live value in seconds.- Returns:
- the CosmosContainerProperties.
-
setAnalyticalStoreTimeToLiveInSeconds
public CosmosContainerProperties setAnalyticalStoreTimeToLiveInSeconds(Integer timeToLive)
Sets the analytical store time to live in seconds for items in a container from the Azure Cosmos DB service. It is an optional property. A valid value must be either a nonzero positive integer, '-1', or 0. By default, AnalyticalStoreTimeToLive is set to 0 meaning the analytical store is turned off for the container; -1 means items in analytical store never expire. The unit of measurement is seconds. The maximum allowed value is 2147483647.- Parameters:
timeToLive
- the analytical store time to live in seconds.- Returns:
- the CosmosContainerProperties.
-
getAnalyticalStoreTimeToLiveInSeconds
public Integer getAnalyticalStoreTimeToLiveInSeconds()
Gets the analytical store time to live in seconds for items in a container from the Azure Cosmos DB service. It is an optional property. A valid value must be either a nonzero positive integer, '-1', or 0. By default, AnalyticalStoreTimeToLive is set to 0 meaning the analytical store is turned off for the container; -1 means items in analytical store never expire. The unit of measurement is seconds. The maximum allowed value is 2147483647.- Returns:
- analytical ttl
-
getId
public String getId()
Gets the name of the resource.- Returns:
- the name of the resource.
-
setId
public CosmosContainerProperties setId(String id)
Sets the name of the resource.- Parameters:
id
- the name of the resource.- Returns:
- the current instance of
CosmosContainerProperties
.
-
getResourceId
public String getResourceId()
Gets the ID associated with the resource.- Returns:
- the ID associated with the resource.
-
getTimestamp
public Instant getTimestamp()
Get the last modified timestamp associated with the resource. This is only relevant when getting response from the server.- Returns:
- the timestamp.
-
getETag
public String getETag()
Get the entity tag associated with the resource. This is only relevant when getting response from the server.- Returns:
- the e tag.
-
getClientEncryptionPolicy
@Beta(value=V4_14_0, warningText="Preview API - subject to change in non-backwards compatible way") public ClientEncryptionPolicy getClientEncryptionPolicy()
Gets the ClientEncryptionPolicy that is used for encrypting item fields- Returns:
- ClientEncryptionPolicy
-
setClientEncryptionPolicy
@Beta(value=V4_14_0, warningText="Preview API - subject to change in non-backwards compatible way") public CosmosContainerProperties setClientEncryptionPolicy(ClientEncryptionPolicy value)
Sets the ClientEncryptionPolicy that is used for encrypting item fields- Parameters:
value
- ClientEncryptionPolicy to be used.- Returns:
- the CosmosContainerProperties.
-
-