public class CosmosClient extends Object implements AutoCloseable
public static CosmosClientBuilder cosmosClientBuilder()
CosmosClientBuilder
public CosmosDatabaseResponse createDatabaseIfNotExists(CosmosDatabaseProperties databaseProperties) throws CosmosClientException
databaseProperties
- CosmosDatabaseProperties
the database propertiesCosmosDatabaseResponse
with the created database.CosmosClientException
- the cosmos client exception.public CosmosDatabaseResponse createDatabaseIfNotExists(String id) throws CosmosClientException
id
- the id of the databaseCosmosDatabaseResponse
with the created database.CosmosClientException
- the cosmos client exception.public CosmosDatabaseResponse createDatabase(CosmosDatabaseProperties databaseProperties, CosmosDatabaseRequestOptions options) throws CosmosClientException
databaseProperties
- CosmosDatabaseProperties
the database properties.options
- the request options.CosmosDatabaseResponse
with the created database.CosmosClientException
- the cosmos client exception.public CosmosDatabaseResponse createDatabase(CosmosDatabaseProperties databaseProperties) throws CosmosClientException
databaseProperties
- CosmosDatabaseProperties
the database properties.CosmosDatabaseResponse
with the created database.CosmosClientException
- the cosmos client exception.public CosmosDatabaseResponse createDatabase(String id) throws CosmosClientException
id
- the id of the databaseCosmosDatabaseResponse
with the created database.CosmosClientException
- the cosmos client exception.public CosmosDatabaseResponse createDatabase(CosmosDatabaseProperties databaseProperties, int throughput, CosmosDatabaseRequestOptions options) throws CosmosClientException
databaseProperties
- CosmosDatabaseProperties
the database properties.throughput
- the throughputoptions
- CosmosDatabaseRequestOptions
the request optionsCosmosDatabaseResponse
with the created database.CosmosClientException
- the cosmos client exceptionpublic CosmosDatabaseResponse createDatabase(CosmosDatabaseProperties databaseProperties, int throughput) throws CosmosClientException
databaseProperties
- CosmosDatabaseProperties
the database properties.throughput
- the throughputCosmosDatabaseResponse
with the created database.CosmosClientException
- the cosmos client exceptionpublic CosmosDatabaseResponse createDatabase(String id, int throughput) throws CosmosClientException
id
- the id of the databasethroughput
- the throughputCosmosDatabaseResponse
with the created database.CosmosClientException
- the cosmos client exceptionpublic CosmosContinuablePagedIterable<CosmosDatabaseProperties> readAllDatabases(FeedOptions options)
options
- FeedOptions
the feed options.CosmosContinuablePagedIterable
for feed response with the read databases.public CosmosContinuablePagedIterable<CosmosDatabaseProperties> readAllDatabases()
CosmosContinuablePagedIterable
for feed response with the read databases.public CosmosContinuablePagedIterable<CosmosDatabaseProperties> queryDatabases(String query, FeedOptions options)
query
- the queryoptions
- FeedOptions
the feed options.CosmosContinuablePagedIterable
for feed response with the obtained databases.public CosmosContinuablePagedIterable<CosmosDatabaseProperties> queryDatabases(SqlQuerySpec querySpec, FeedOptions options)
querySpec
- SqlQuerySpec
the query specoptions
- the queryCosmosContinuablePagedIterable
for feed response with the obtained databases.public CosmosDatabase getDatabase(String id)
id
- the id of the databaseCosmosDatabase
the cosmos sync databasepublic void close()
CosmosClient
instanceclose
in interface AutoCloseable
Copyright © 2020 Microsoft Corporation. All rights reserved.