Class 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 Detail

      • CosmosContainerProperties

        public CosmosContainerProperties​(String id,
                                         String partitionKeyPath)
        Constructor
        Parameters:
        id - id of the Container
        partitionKeyPath - partition key path
    • Method Detail

      • indexingPolicy

        public IndexingPolicy indexingPolicy()
        Gets the container's indexing policy.
        Returns:
        the indexing policy.
      • 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.