Class CosmosAsyncClient
- All Implemented Interfaces:
Closeable
,AutoCloseable
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close thisCosmosAsyncClient
instance and cleans up the resources.createDatabase
(CosmosDatabaseProperties databaseProperties) Creates a database.createDatabase
(CosmosDatabaseProperties databaseProperties, CosmosDatabaseRequestOptions options) Creates a database.createDatabase
(CosmosDatabaseProperties databaseProperties, ThroughputProperties throughputProperties) Creates a database.createDatabase
(CosmosDatabaseProperties databaseProperties, ThroughputProperties throughputProperties, CosmosDatabaseRequestOptions options) Creates a database.createDatabase
(String id) Creates a database.createDatabase
(String id, ThroughputProperties throughputProperties) Creates a database.createDatabaseIfNotExists
(CosmosDatabaseProperties databaseProperties) CREATE a Database if it does not already exist on the service.Create a Database if it does not already exist on the service.createDatabaseIfNotExists
(String id, ThroughputProperties throughputProperties) Create a Database if it does not already exist on the service.createGlobalThroughputControlConfigBuilder
(String databaseId, String containerId) Create global throughput control config builder which will be used to buildGlobalThroughputControlConfig
.getDatabase
(String id) Gets a database object without making a service call.queryDatabases
(SqlQuerySpec querySpec, CosmosQueryRequestOptions options) Query for databases.queryDatabases
(String query, CosmosQueryRequestOptions options) Query for databases.Reads all databases.
-
Method Details
-
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
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, CosmosDatabaseRequestOptions options) 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 theMono
will error.- Parameters:
databaseProperties
-CosmosDatabaseProperties
.options
-CosmosDatabaseRequestOptions
.- Returns:
- an
Mono
containing the single cosmos database response with the created database or an error.
-
createDatabase
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 theMono
will error.- Parameters:
databaseProperties
-CosmosDatabaseProperties
.- Returns:
- an
Mono
containing the single cosmos database response with the created database or an error.
-
createDatabase
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 theMono
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, CosmosDatabaseRequestOptions options) 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 theMono
will error.- Parameters:
databaseProperties
-CosmosDatabaseProperties
.throughputProperties
- the throughput properties for the database.options
-CosmosDatabaseRequestOptions
.- Returns:
- an
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 theMono
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.
-
createDatabase
public Mono<CosmosDatabaseResponse> createDatabase(String id, ThroughputProperties throughputProperties) Creates a database.- Parameters:
id
- the id.throughputProperties
- the throughputProperties.- Returns:
- the mono.
-
readAllDatabases
Reads all databases.After subscription the operation will be performed. The
CosmosPagedFlux
will contain one or several feed response of the read databases. In case of failure theCosmosPagedFlux
will error.- Returns:
- a
CosmosPagedFlux
containing one or several feed response pages of read databases or an error.
-
queryDatabases
public CosmosPagedFlux<CosmosDatabaseProperties> queryDatabases(String query, CosmosQueryRequestOptions options) Query for databases.After subscription the operation will be performed. The
CosmosPagedFlux
will contain one or several feed response of the read databases. In case of failure theCosmosPagedFlux
will error.- Parameters:
query
- the query.options
- the feed options.- Returns:
- a
CosmosPagedFlux
containing one or several feed response pages of read databases or an error.
-
queryDatabases
public CosmosPagedFlux<CosmosDatabaseProperties> queryDatabases(SqlQuerySpec querySpec, CosmosQueryRequestOptions options) Query for databases.After subscription the operation will be performed. The
CosmosPagedFlux
will contain one or several feed response of the read databases. In case of failure theCosmosPagedFlux
will error.- Parameters:
querySpec
- the SQL query specification.options
- the feed options.- Returns:
- a
CosmosPagedFlux
containing one or several feed response pages of read databases or an error.
-
getDatabase
Gets a database object without making a service call.- Parameters:
id
- name of the database.- Returns:
CosmosAsyncDatabase
.
-
close
public void close()Close thisCosmosAsyncClient
instance and cleans up the resources.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
createGlobalThroughputControlConfigBuilder
@Beta(value=V4_13_0, warningText="Preview API - subject to change in non-backwards compatible way") public GlobalThroughputControlConfigBuilder createGlobalThroughputControlConfigBuilder(String databaseId, String containerId) Create global throughput control config builder which will be used to buildGlobalThroughputControlConfig
.- Parameters:
databaseId
- The database id of the control container.containerId
- The container id of the control container.- Returns:
- A
GlobalThroughputControlConfigBuilder
.
-