Class CosmosAsyncClient

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    public final class CosmosAsyncClient
    extends Object
    implements Closeable
    Provides a client-side logical representation of the Azure Cosmos DB service. This asynchronous client is used to configure and execute requests against the service.
    • Method Detail

      • createDatabaseIfNotExists

        public Mono<CosmosDatabaseResponse> createDatabaseIfNotExists​(CosmosDatabaseProperties databaseProperties)
        CREATE a Database if it does not already exist on the service.

        The Mono upon successful completion will contain a single cosmos database response with the created or existing database.

        Parameters:
        databaseProperties - CosmosDatabaseProperties.
        Returns:
        a Mono containing the cosmos database response with the created or existing database or an error.
      • createDatabaseIfNotExists

        public Mono<CosmosDatabaseResponse> createDatabaseIfNotExists​(String id)
        Create a Database if it does not already exist on the service.

        The Mono upon successful completion will contain a single cosmos database response with the created or existing database.

        Parameters:
        id - the id of the database.
        Returns:
        a Mono containing the cosmos database response with the created or existing database or an error.
      • createDatabaseIfNotExists

        public Mono<CosmosDatabaseResponse> createDatabaseIfNotExists​(String id,
                                                                      ThroughputProperties throughputProperties)
        Create a Database if it does not already exist on the service.

        The throughputProperties will only be used if the specified database does not exist and therefor a new database will be created with throughputProperties.

        The Mono upon successful completion will contain a single cosmos database response with the created or existing database.

        Parameters:
        id - the id.
        throughputProperties - the throughputProperties.
        Returns:
        the mono.
      • createDatabase

        public Mono<CosmosDatabaseResponse> createDatabase​(CosmosDatabaseProperties databaseProperties)
        Creates a database.

        After subscription the operation will be performed. The Mono upon successful completion will contain a single resource response with the created database. In case of failure the Mono will error.

        Parameters:
        databaseProperties - CosmosDatabaseProperties.
        Returns:
        an Mono containing the single cosmos database response with the created database or an error.
      • createDatabase

        public Mono<CosmosDatabaseResponse> createDatabase​(String id)
        Creates a database.

        After subscription the operation will be performed. The Mono upon successful completion will contain a single resource response with the created database. In case of failure the Mono will error.

        Parameters:
        id - id of the database.
        Returns:
        a Mono containing the single cosmos database response with the created database or an error.
      • createDatabase

        public Mono<CosmosDatabaseResponse> createDatabase​(CosmosDatabaseProperties databaseProperties,
                                                           ThroughputProperties throughputProperties)
        Creates a database.

        After subscription the operation will be performed. The Mono upon successful completion will contain a single resource response with the created database. In case of failure the Mono will error.

        Parameters:
        databaseProperties - CosmosDatabaseProperties.
        throughputProperties - the throughput properties for the database.
        Returns:
        an Mono containing the single cosmos database response with the created database or an error.