public final class CosmosClient extends Object implements Closeable
public 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.
id
- the id of the database.throughputProperties
- the throughputProperties.CosmosDatabaseResponse
with the created database.public CosmosDatabaseResponse createDatabaseIfNotExists(String id)
id
- the id of the database.CosmosDatabaseResponse
with the created database.public CosmosDatabaseResponse createDatabase(CosmosDatabaseProperties databaseProperties, CosmosDatabaseRequestOptions options)
databaseProperties
- CosmosDatabaseProperties
the database properties.options
- the request options.CosmosDatabaseResponse
with the created database.public CosmosDatabaseResponse createDatabase(CosmosDatabaseProperties databaseProperties)
databaseProperties
- CosmosDatabaseProperties
the database properties.CosmosDatabaseResponse
with the created database.public CosmosDatabaseResponse createDatabase(String id)
id
- the id of the database.CosmosDatabaseResponse
with the created database.public CosmosDatabaseResponse createDatabase(CosmosDatabaseProperties databaseProperties, ThroughputProperties throughputProperties, CosmosDatabaseRequestOptions options)
databaseProperties
- CosmosDatabaseProperties
the database properties.throughputProperties
- the throughput properties.options
- CosmosDatabaseRequestOptions
the request options.CosmosDatabaseResponse
with the created database.public CosmosDatabaseResponse createDatabase(CosmosDatabaseProperties databaseProperties, ThroughputProperties throughputProperties)
databaseProperties
- CosmosDatabaseProperties
the database properties.throughputProperties
- the throughput properties.CosmosDatabaseResponse
with the created database.public CosmosDatabaseResponse createDatabase(String id, ThroughputProperties throughputProperties)
id
- the id of the database.throughputProperties
- the throughput properties.CosmosDatabaseResponse
with the created database.public CosmosPagedIterable<CosmosDatabaseProperties> readAllDatabases()
CosmosPagedIterable
for feed response with the read databases.public CosmosPagedIterable<CosmosDatabaseProperties> queryDatabases(String query, CosmosQueryRequestOptions options)
query
- the query.options
- CosmosQueryRequestOptions
the feed options.CosmosPagedIterable
for feed response with the obtained databases.public CosmosPagedIterable<CosmosDatabaseProperties> queryDatabases(SqlQuerySpec querySpec, CosmosQueryRequestOptions options)
querySpec
- SqlQuerySpec
the query spec.options
- the query request options.CosmosPagedIterable
for feed response with the obtained databases.public CosmosDatabase getDatabase(String id)
id
- the id of the database.CosmosDatabase
the cosmos sync database.public void close()
CosmosClient
instance.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.