Package com.azure.data.cosmos.sync
Class CosmosSyncDatabase
- java.lang.Object
-
- com.azure.data.cosmos.sync.CosmosSyncDatabase
-
public class CosmosSyncDatabase extends Object
Perform read and delete databases, update database throughput, and perform operations on child resources in a synchronous way
-
-
Method Summary
-
-
-
Method Detail
-
id
public String id()
Get the id of the CosmosDatabase- Returns:
- the id of the database
-
read
public CosmosSyncDatabaseResponse read() throws CosmosClientException
Reads a database- Returns:
- the
CosmosSyncDatabaseResponse
- Throws:
CosmosClientException
- the cosmos client exception
-
read
public CosmosSyncDatabaseResponse read(CosmosDatabaseRequestOptions options) throws CosmosClientException
Reads a database.- Parameters:
options
- theCosmosDatabaseRequestOptions
request options.- Returns:
- the
CosmosSyncDatabaseResponse
- Throws:
CosmosClientException
- the cosmos client exception
-
delete
public CosmosSyncDatabaseResponse delete() throws CosmosClientException
Delete a database.- Returns:
- the
CosmosSyncDatabaseResponse
- Throws:
CosmosClientException
- the cosmos client exception
-
delete
public CosmosSyncDatabaseResponse delete(CosmosDatabaseRequestOptions options) throws CosmosClientException
Delete a database.- Parameters:
options
- theCosmosDatabaseRequestOptions
request options.- Returns:
- the
CosmosSyncDatabaseResponse
- Throws:
CosmosClientException
- the cosmos client exception
-
createContainer
public CosmosSyncContainerResponse createContainer(CosmosContainerProperties containerProperties) throws CosmosClientException
Creates a cosmos container.- Parameters:
containerProperties
- theCosmosContainerProperties
- Returns:
- the
CosmosSyncContainerResponse
with the created container. - Throws:
CosmosClientException
- the cosmos client exception
-
createContainer
public CosmosSyncContainerResponse createContainer(CosmosContainerProperties containerProperties, int throughput) throws CosmosClientException
Creates a cosmos container.- Parameters:
containerProperties
- theCosmosContainerProperties
throughput
- the throughput- Returns:
- the
CosmosSyncContainerResponse
with the created container. - Throws:
CosmosClientException
- the cosmos client exception
-
createContainer
public CosmosSyncContainerResponse createContainer(CosmosContainerProperties containerProperties, CosmosContainerRequestOptions options) throws CosmosClientException
Creates a cosmos container.- Parameters:
containerProperties
- theCosmosContainerProperties
options
- theCosmosContainerProperties
- Returns:
- the
CosmosSyncContainerResponse
with the created container. - Throws:
CosmosClientException
- the cosmos client exception
-
createContainer
public CosmosSyncContainerResponse createContainer(CosmosContainerProperties containerProperties, int throughput, CosmosContainerRequestOptions options) throws CosmosClientException
Creates a cosmos container.- Parameters:
containerProperties
- theCosmosContainerProperties
throughput
- the throughputoptions
- theCosmosContainerProperties
- Returns:
- the
CosmosSyncContainerResponse
with the created container. - Throws:
CosmosClientException
- the cosmos client exception
-
createContainer
public CosmosSyncContainerResponse createContainer(String id, String partitionKeyPath) throws CosmosClientException
Create container cosmos sync container response.- Parameters:
id
- the idpartitionKeyPath
- the partition key path- Returns:
- the cosmos sync container response
- Throws:
CosmosClientException
- the cosmos client exception
-
createContainer
public CosmosSyncContainerResponse createContainer(String id, String partitionKeyPath, int throughput) throws CosmosClientException
Create container cosmos sync container response.- Parameters:
id
- the idpartitionKeyPath
- the partition key paththroughput
- the throughput- Returns:
- the cosmos sync container response
- Throws:
CosmosClientException
- the cosmos client exception
-
createContainerIfNotExists
public CosmosSyncContainerResponse createContainerIfNotExists(CosmosContainerProperties containerProperties) throws CosmosClientException
Create container if not exists cosmos sync container response.- Parameters:
containerProperties
- the container properties- Returns:
- the cosmos sync container response
- Throws:
CosmosClientException
- the cosmos client exception
-
createContainerIfNotExists
public CosmosSyncContainerResponse createContainerIfNotExists(CosmosContainerProperties containerProperties, int throughput) throws CosmosClientException
Create container if not exists cosmos sync container response.- Parameters:
containerProperties
- the container propertiesthroughput
- the throughput- Returns:
- the cosmos sync container response
- Throws:
CosmosClientException
- the cosmos client exception
-
createContainerIfNotExists
public CosmosSyncContainerResponse createContainerIfNotExists(String id, String partitionKeyPath) throws CosmosClientException
Create container if not exists cosmos sync container response.- Parameters:
id
- the idpartitionKeyPath
- the partition key path- Returns:
- the cosmos sync container response
- Throws:
CosmosClientException
- the cosmos client exception
-
createContainerIfNotExists
public CosmosSyncContainerResponse createContainerIfNotExists(String id, String partitionKeyPath, int throughput) throws CosmosClientException
Create container if not exists cosmos sync container response.- Parameters:
id
- the idpartitionKeyPath
- the partition key paththroughput
- the throughput- Returns:
- the cosmos sync container response
- Throws:
CosmosClientException
- the cosmos client exception
-
readAllContainers
public Iterator<FeedResponse<CosmosContainerProperties>> readAllContainers(FeedOptions options)
Read all containers iterator.- Parameters:
options
- the options- Returns:
- the iterator
-
readAllContainers
public Iterator<FeedResponse<CosmosContainerProperties>> readAllContainers()
Read all containers iterator.- Returns:
- the iterator
-
queryContainers
public Iterator<FeedResponse<CosmosContainerProperties>> queryContainers(String query)
Query containers iterator.- Parameters:
query
- the query- Returns:
- the iterator
-
queryContainers
public Iterator<FeedResponse<CosmosContainerProperties>> queryContainers(String query, FeedOptions options)
Query containers iterator.- Parameters:
query
- the queryoptions
- the options- Returns:
- the iterator
-
queryContainers
public Iterator<FeedResponse<CosmosContainerProperties>> queryContainers(SqlQuerySpec querySpec)
Query containers iterator.- Parameters:
querySpec
- the query spec- Returns:
- the iterator
-
queryContainers
public Iterator<FeedResponse<CosmosContainerProperties>> queryContainers(SqlQuerySpec querySpec, FeedOptions options)
Query containers iterator.- Parameters:
querySpec
- the query specoptions
- the options- Returns:
- the iterator
-
getContainer
public CosmosSyncContainer getContainer(String id)
Gets a CosmosSyncContainer object without making a service call- Parameters:
id
- id of the container- Returns:
- Cosmos Container
-
createUser
public CosmosSyncUserResponse createUser(CosmosUserProperties settings) throws CosmosClientException
Create user cosmos sync user response.- Parameters:
settings
- the settings- Returns:
- the cosmos sync user response
- Throws:
CosmosClientException
- the cosmos client exception
-
upsertUser
public CosmosSyncUserResponse upsertUser(CosmosUserProperties settings) throws CosmosClientException
Upsert user cosmos sync user response.- Parameters:
settings
- the settings- Returns:
- the cosmos sync user response
- Throws:
CosmosClientException
- the cosmos client exception
-
readAllUsers
public Iterator<FeedResponse<CosmosUserProperties>> readAllUsers()
Read all users iterator.- Returns:
- the iterator
-
readAllUsers
public Iterator<FeedResponse<CosmosUserProperties>> readAllUsers(FeedOptions options)
Read all users iterator.- Parameters:
options
- the options- Returns:
- the iterator
-
queryUsers
public Iterator<FeedResponse<CosmosUserProperties>> queryUsers(String query)
Query users iterator.- Parameters:
query
- the query- Returns:
- the iterator
-
queryUsers
public Iterator<FeedResponse<CosmosUserProperties>> queryUsers(String query, FeedOptions options)
Query users iterator.- Parameters:
query
- the queryoptions
- the options- Returns:
- the iterator
-
queryUsers
public Iterator<FeedResponse<CosmosUserProperties>> queryUsers(SqlQuerySpec querySpec)
Query users iterator.- Parameters:
querySpec
- the query spec- Returns:
- the iterator
-
queryUsers
public Iterator<FeedResponse<CosmosUserProperties>> queryUsers(SqlQuerySpec querySpec, FeedOptions options)
Query users iterator.- Parameters:
querySpec
- the query specoptions
- the options- Returns:
- the iterator
-
getUser
public CosmosSyncUser getUser(String id)
Gets user.- Parameters:
id
- the id- Returns:
- the user
-
readProvisionedThroughput
public Integer readProvisionedThroughput() throws CosmosClientException
Read provisioned throughput integer.- Returns:
- the integer. null response indicates database doesn't have any provisioned RUs
- Throws:
CosmosClientException
- the cosmos client exception
-
replaceProvisionedThroughput
public Integer replaceProvisionedThroughput(int requestUnitsPerSecond) throws CosmosClientException
Replace provisioned throughput integer.- Parameters:
requestUnitsPerSecond
- the request units per second- Returns:
- the integer
- Throws:
CosmosClientException
- the cosmos client exception
-
-