Class CosmosContainer


  • public class CosmosContainer
    extends Object
    Provides methods for reading, deleting, and replacing existing Containers. Provides methods for interacting with child resources (Items, Scripts, Conflicts)
    • Method Detail

      • read

        public Mono<CosmosContainerResponse> read()
        Reads the document container After subscription the operation will be performed. The Mono upon successful completion will contain a single cosmos container response with the read container. In case of failure the Mono will error.
        Returns:
        an Mono containing the single cosmos container response with the read container or an error.
      • read

        public Mono<CosmosContainerResponse> read​(CosmosContainerRequestOptions options)
        Reads the document container by the container link. After subscription the operation will be performed. The Mono upon successful completion will contain a single cosmos container response with the read container. In case of failure the Mono will error.
        Parameters:
        options - The cosmos container request options.
        Returns:
        an Mono containing the single cosmos container response with the read container or an error.
      • delete

        public Mono<CosmosContainerResponse> delete​(CosmosContainerRequestOptions options)
        Deletes the item container After subscription the operation will be performed. The Mono upon successful completion will contain a single cosmos container response for the deleted database. In case of failure the Mono will error.
        Parameters:
        options - the request options.
        Returns:
        an Mono containing the single cosmos container response for the deleted database or an error.
      • delete

        public Mono<CosmosContainerResponse> delete()
        Deletes the item container After subscription the operation will be performed. The Mono upon successful completion will contain a single cosmos container response for the deleted container. In case of failure the Mono will error.
        Returns:
        an Mono containing the single cosmos container response for the deleted container or an error.
      • replace

        public Mono<CosmosContainerResponse> replace​(CosmosContainerProperties containerSettings)
        Replaces a document container. After subscription the operation will be performed. The Mono upon successful completion will contain a single cosmos container response with the replaced document container. In case of failure the Mono will error.
        Parameters:
        containerSettings - the item container properties
        Returns:
        an Mono containing the single cosmos container response with the replaced document container or an error.
      • replace

        public Mono<CosmosContainerResponse> replace​(CosmosContainerProperties containerSettings,
                                                     CosmosContainerRequestOptions options)
        Replaces a document container. After subscription the operation will be performed. The Mono upon successful completion will contain a single cosmos container response with the replaced document container. In case of failure the Mono will error.
        Parameters:
        containerSettings - the item container properties
        options - the cosmos container request options.
        Returns:
        an Mono containing the single cosmos container response with the replaced document container or an error.
      • createItem

        public Mono<CosmosItemResponse> createItem​(Object item)
        Creates a cosmos item. After subscription the operation will be performed. The Mono upon successful completion will contain a single resource response with the created cosmos item. In case of failure the Mono will error.
        Parameters:
        item - the cosmos item represented as a POJO or cosmos item object.
        Returns:
        an Mono containing the single resource response with the created cosmos item or an error.
      • createItem

        public Mono<CosmosItemResponse> createItem​(Object item,
                                                   CosmosItemRequestOptions options)
        Creates a cosmos item. After subscription the operation will be performed. The Mono upon successful completion will contain a single resource response with the created cosmos item. In case of failure the Mono will error.
        Parameters:
        item - the cosmos item represented as a POJO or cosmos item object.
        options - the request options.
        Returns:
        an Mono containing the single resource response with the created cosmos item or an error.
      • upsertItem

        public Mono<CosmosItemResponse> upsertItem​(Object item)
        Upserts an item. After subscription the operation will be performed. The Mono upon successful completion will contain a single resource response with the upserted item. In case of failure the Mono will error.
        Parameters:
        item - the item represented as a POJO or Item object to upsert.
        Returns:
        an Mono containing the single resource response with the upserted document or an error.
      • upsertItem

        public Mono<CosmosItemResponse> upsertItem​(Object item,
                                                   CosmosItemRequestOptions options)
        Upserts a cosmos item. After subscription the operation will be performed. The Mono upon successful completion will contain a single resource response with the upserted item. In case of failure the Mono will error.
        Parameters:
        item - the item represented as a POJO or Item object to upsert.
        options - the request options.
        Returns:
        an Mono containing the single resource response with the upserted document or an error.
      • readAllItems

        public Flux<FeedResponse<CosmosItemProperties>> readAllItems()
        Reads all cosmos items in the container. After subscription the operation will be performed. The Flux will contain one or several feed response of the read cosmos items. In case of failure the Flux will error.
        Returns:
        an Flux containing one or several feed response pages of the read cosmos items or an error.
      • readAllItems

        public Flux<FeedResponse<CosmosItemProperties>> readAllItems​(FeedOptions options)
        Reads all cosmos items in a container. After subscription the operation will be performed. The Flux will contain one or several feed response of the read cosmos items. In case of failure the Flux will error.
        Parameters:
        options - the feed options.
        Returns:
        an Flux containing one or several feed response pages of the read cosmos items or an error.
      • queryItems

        public Flux<FeedResponse<CosmosItemProperties>> queryItems​(String query)
        Query for documents in a items in a container After subscription the operation will be performed. The Flux will contain one or several feed response of the obtained items. In case of failure the Flux will error.
        Parameters:
        query - the query.
        Returns:
        an Flux containing one or several feed response pages of the obtained items or an error.
      • queryItems

        public Flux<FeedResponse<CosmosItemProperties>> queryItems​(String query,
                                                                   FeedOptions options)
        Query for documents in a items in a container After subscription the operation will be performed. The Flux will contain one or several feed response of the obtained items. In case of failure the Flux will error.
        Parameters:
        query - the query.
        options - the feed options.
        Returns:
        an Flux containing one or several feed response pages of the obtained items or an error.
      • queryItems

        public Flux<FeedResponse<CosmosItemProperties>> queryItems​(SqlQuerySpec querySpec)
        Query for documents in a items in a container After subscription the operation will be performed. The Flux will contain one or several feed response of the obtained items. In case of failure the Flux will error.
        Parameters:
        querySpec - the SQL query specification.
        Returns:
        an Flux containing one or several feed response pages of the obtained items or an error.
      • queryItems

        public Flux<FeedResponse<CosmosItemProperties>> queryItems​(SqlQuerySpec querySpec,
                                                                   FeedOptions options)
        Query for documents in a items in a container After subscription the operation will be performed. The Flux will contain one or several feed response of the obtained items. In case of failure the Flux will error.
        Parameters:
        querySpec - the SQL query specification.
        options - the feed options.
        Returns:
        an Flux containing one or several feed response pages of the obtained items or an error.
      • queryChangeFeedItems

        public Flux<FeedResponse<CosmosItemProperties>> queryChangeFeedItems​(ChangeFeedOptions changeFeedOptions)
        Query for documents in a items in a container After subscription the operation will be performed. The Flux will contain one or several feed response of the obtained items. In case of failure the Flux will error.
        Parameters:
        changeFeedOptions - the feed options.
        Returns:
        an Flux containing one or several feed response pages of the obtained items or an error.
      • getItem

        public CosmosItem getItem​(String id,
                                  Object partitionKey)
        Gets a CosmosItem object without making a service call
        Parameters:
        id - id of the item
        partitionKey - the partition key
        Returns:
        a cosmos item
      • readAllConflicts

        public Flux<FeedResponse<CosmosConflictProperties>> readAllConflicts​(FeedOptions options)
        Lists all the conflicts in the container
        Parameters:
        options - the feed options
        Returns:
        a Flux containing one or several feed response pages of the obtained conflicts or an error.
      • queryConflicts

        public Flux<FeedResponse<CosmosConflictProperties>> queryConflicts​(String query)
        Queries all the conflicts in the container
        Parameters:
        query - the query
        Returns:
        a Flux containing one or several feed response pages of the obtained conflicts or an error.
      • queryConflicts

        public Flux<FeedResponse<CosmosConflictProperties>> queryConflicts​(String query,
                                                                           FeedOptions options)
        Queries all the conflicts in the container
        Parameters:
        query - the query
        options - the feed options
        Returns:
        a Flux containing one or several feed response pages of the obtained conflicts or an error.
      • getConflict

        public CosmosConflict getConflict​(String id)
        Gets a CosmosConflict object without making a service call
        Parameters:
        id - id of the cosmos conflict
        Returns:
        a cosmos conflict
      • readProvisionedThroughput

        public Mono<Integer> readProvisionedThroughput()
        Gets the throughput of the container
        Returns:
        a Mono containing throughput or an error.
      • replaceProvisionedThroughput

        public Mono<Integer> replaceProvisionedThroughput​(int requestUnitsPerSecond)
        Sets throughput provisioned for a container in measurement of Requests-per-Unit in the Azure Cosmos service.
        Parameters:
        requestUnitsPerSecond - the cosmos container throughput, expressed in Request Units per second
        Returns:
        a Mono containing throughput or an error.