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 - CosmosQueryRequestOptionsthe 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 Closeableclose in interface AutoCloseableCopyright © 2020 Microsoft Corporation. All rights reserved.