public final class CosmosAsyncClient extends Object implements Closeable
public Mono<CosmosDatabaseResponse> createDatabaseIfNotExists(CosmosDatabaseProperties databaseProperties)
The Mono
upon successful completion will contain a single cosmos database response with the
created or existing database.
databaseProperties
- CosmosDatabaseProperties.Mono
containing the cosmos database response with the created or existing database or
an error.public Mono<CosmosDatabaseResponse> createDatabaseIfNotExists(String id)
The Mono
upon successful completion will contain a single cosmos database response with the
created or existing database.
id
- the id of the database.Mono
containing the cosmos database response with the created or existing database or
an error.public Mono<CosmosDatabaseResponse> createDatabaseIfNotExists(String id, ThroughputProperties throughputProperties)
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.
id
- the id.throughputProperties
- the throughputProperties.public Mono<CosmosDatabaseResponse> createDatabase(CosmosDatabaseProperties databaseProperties, CosmosDatabaseRequestOptions options)
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.
databaseProperties
- CosmosDatabaseProperties
.options
- CosmosDatabaseRequestOptions
.Mono
containing the single cosmos database response with the created database or an error.public Mono<CosmosDatabaseResponse> createDatabase(CosmosDatabaseProperties databaseProperties)
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.
databaseProperties
- CosmosDatabaseProperties
.Mono
containing the single cosmos database response with the created database or an error.public Mono<CosmosDatabaseResponse> createDatabase(String id)
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.
id
- id of the database.Mono
containing the single cosmos database response with the created database or an error.public Mono<CosmosDatabaseResponse> createDatabase(CosmosDatabaseProperties databaseProperties, ThroughputProperties throughputProperties, CosmosDatabaseRequestOptions options)
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.
databaseProperties
- CosmosDatabaseProperties
.throughputProperties
- the throughput properties for the database.options
- CosmosDatabaseRequestOptions
.Mono
containing the single cosmos database response with the created database or an error.public Mono<CosmosDatabaseResponse> createDatabase(CosmosDatabaseProperties databaseProperties, ThroughputProperties throughputProperties)
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.
databaseProperties
- CosmosDatabaseProperties
.throughputProperties
- the throughput properties for the database.Mono
containing the single cosmos database response with the created database or an error.public Mono<CosmosDatabaseResponse> createDatabase(String id, ThroughputProperties throughputProperties)
id
- the id.throughputProperties
- the throughputProperties.public CosmosPagedFlux<CosmosDatabaseProperties> readAllDatabases()
After subscription the operation will be performed.
The CosmosPagedFlux
will contain one or several feed response of the read databases.
In case of failure the CosmosPagedFlux
will error.
CosmosPagedFlux
containing one or several feed response pages of read databases or an error.public CosmosPagedFlux<CosmosDatabaseProperties> queryDatabases(String query, CosmosQueryRequestOptions options)
After subscription the operation will be performed.
The CosmosPagedFlux
will contain one or several feed response of the read databases.
In case of failure the CosmosPagedFlux
will error.
query
- the query.options
- the feed options.CosmosPagedFlux
containing one or several feed response pages of read databases or an error.public CosmosPagedFlux<CosmosDatabaseProperties> queryDatabases(SqlQuerySpec querySpec, CosmosQueryRequestOptions options)
After subscription the operation will be performed.
The CosmosPagedFlux
will contain one or several feed response of the read databases.
In case of failure the CosmosPagedFlux
will error.
querySpec
- the SQL query specification.options
- the feed options.CosmosPagedFlux
containing one or several feed response pages of read databases or an error.public CosmosAsyncDatabase getDatabase(String id)
id
- name of the database.CosmosAsyncDatabase
.public void close()
CosmosAsyncClient
instance and cleans up the resources.close
in interface Closeable
close
in interface AutoCloseable
@Beta(value=V4_13_0, warningText="Preview API - subject to change in non-backwards compatible way") public GlobalThroughputControlConfigBuilder createGlobalThroughputControlConfigBuilder(String databaseId, String containerId)
GlobalThroughputControlConfig
.databaseId
- The database id of the control container.containerId
- The container id of the control container.GlobalThroughputControlConfigBuilder
.Copyright © 2021 Microsoft Corporation. All rights reserved.