public class CosmosDatabase extends Object
Modifier and Type | Method and Description |
---|---|
CosmosContainerResponse |
createContainer(CosmosContainerProperties containerProperties)
Creates a Cosmos container.
|
CosmosContainerResponse |
createContainer(CosmosContainerProperties containerProperties,
CosmosContainerRequestOptions options)
Creates a Cosmos container while passing additional request options.
|
CosmosContainerResponse |
createContainer(CosmosContainerProperties containerProperties,
ThroughputProperties throughputProperties)
Creates a Cosmos container with custom throughput setting.
|
CosmosContainerResponse |
createContainer(CosmosContainerProperties containerProperties,
ThroughputProperties throughputProperties,
CosmosContainerRequestOptions options)
Creates a Cosmos container.
|
CosmosContainerResponse |
createContainer(String id,
String partitionKeyPath)
Create a Cosmos container.
|
CosmosContainerResponse |
createContainer(String id,
String partitionKeyPath,
ThroughputProperties throughputProperties)
Create a Cosmos container.
|
CosmosContainerResponse |
createContainerIfNotExists(CosmosContainerProperties containerProperties)
Create container if one matching the id in the properties object does not exist.
|
CosmosContainerResponse |
createContainerIfNotExists(CosmosContainerProperties containerProperties,
ThroughputProperties throughputProperties)
Creates a Cosmos container if one matching the id in the properties object does not exist.
|
CosmosContainerResponse |
createContainerIfNotExists(String id,
String partitionKeyPath)
Creates a Cosmos container if one matching the id does not exist.
|
CosmosContainerResponse |
createContainerIfNotExists(String id,
String partitionKeyPath,
ThroughputProperties throughputProperties)
Creates a Cosmos container if one matching the id does not exist.
|
CosmosUserResponse |
createUser(CosmosUserProperties userProperties)
Create Cosmos user instance without making a service call.
|
CosmosDatabaseResponse |
delete()
Deletes the current Cosmos database.
|
CosmosDatabaseResponse |
delete(CosmosDatabaseRequestOptions options)
Delete the current Cosmos database while specifying additional request options.
|
CosmosClientEncryptionKey |
getClientEncryptionKey(String id)
Gets a CosmosClientEncryptionKey object without making a service call
|
CosmosContainer |
getContainer(String id)
Gets a Cosmos container instance without making a service call.
|
String |
getId()
Get the id of the Cosmos database.
|
CosmosUser |
getUser(String id)
Gets a Cosmos user instance without making a service call.
|
CosmosPagedIterable<CosmosContainerProperties> |
queryContainers(SqlQuerySpec querySpec)
Query containers in the current database.
|
CosmosPagedIterable<CosmosContainerProperties> |
queryContainers(SqlQuerySpec querySpec,
CosmosQueryRequestOptions options)
Query containers in the current database.
|
CosmosPagedIterable<CosmosContainerProperties> |
queryContainers(String query)
Query containers in the current database.
|
CosmosPagedIterable<CosmosContainerProperties> |
queryContainers(String query,
CosmosQueryRequestOptions options)
Query containers iterator.
|
CosmosPagedIterable<CosmosUserProperties> |
queryUsers(SqlQuerySpec querySpec)
Query all Cosmos users for the current database.
|
CosmosPagedIterable<CosmosUserProperties> |
queryUsers(SqlQuerySpec querySpec,
CosmosQueryRequestOptions options)
Query all Cosmos users for the current database.
|
CosmosPagedIterable<CosmosUserProperties> |
queryUsers(String query)
Query all Cosmos users for the current database.
|
CosmosPagedIterable<CosmosUserProperties> |
queryUsers(String query,
CosmosQueryRequestOptions options)
Query all Cosmos users for the current database.
|
CosmosDatabaseResponse |
read()
Reads the current Cosmos database.
|
CosmosDatabaseResponse |
read(CosmosDatabaseRequestOptions options)
Reads the current Cosmos database while specifying additional request options.
|
CosmosPagedIterable<CosmosClientEncryptionKeyProperties> |
readAllClientEncryptionKeys()
Reads all cosmos client encryption keys in a database.
|
CosmosPagedIterable<CosmosContainerProperties> |
readAllContainers()
Read all containers in the current database.
|
CosmosPagedIterable<CosmosUserProperties> |
readAllUsers()
Read all Cosmos users for the current database.
|
ThroughputResponse |
readThroughput()
Gets the throughput of the database.
|
ThroughputResponse |
replaceThroughput(ThroughputProperties throughputProperties)
Sets the throughput.
|
CosmosUserResponse |
upsertUser(CosmosUserProperties userProperties)
Upserts a Cosmos user.
|
public String getId()
public CosmosDatabaseResponse read()
CosmosDatabaseResponse
.public CosmosDatabaseResponse read(CosmosDatabaseRequestOptions options)
options
- the CosmosDatabaseRequestOptions
request options.CosmosDatabaseResponse
public CosmosDatabaseResponse delete()
CosmosDatabaseResponse
.public CosmosDatabaseResponse delete(CosmosDatabaseRequestOptions options)
options
- the CosmosDatabaseRequestOptions
request options.CosmosDatabaseResponse
.public CosmosContainerResponse createContainer(CosmosContainerProperties containerProperties)
containerProperties
- the CosmosContainerProperties
.CosmosContainerResponse
with the created container.public CosmosContainerResponse createContainer(CosmosContainerProperties containerProperties, ThroughputProperties throughputProperties)
containerProperties
- the CosmosContainerProperties
.throughputProperties
- the throughput properties.CosmosContainerResponse
with the created container.public CosmosContainerResponse createContainer(CosmosContainerProperties containerProperties, CosmosContainerRequestOptions options)
containerProperties
- the CosmosContainerProperties
.options
- the CosmosContainerProperties
.CosmosContainerResponse
with the created container.public CosmosContainerResponse createContainer(CosmosContainerProperties containerProperties, ThroughputProperties throughputProperties, CosmosContainerRequestOptions options)
containerProperties
- the container properties.throughputProperties
- the throughput properties.options
- the options.public CosmosContainerResponse createContainer(String id, String partitionKeyPath)
id
- the container id.partitionKeyPath
- the partition key path.public CosmosContainerResponse createContainer(String id, String partitionKeyPath, ThroughputProperties throughputProperties)
id
- the id.partitionKeyPath
- the partition key path.throughputProperties
- the throughput properties.public CosmosContainerResponse createContainerIfNotExists(CosmosContainerProperties containerProperties)
containerProperties
- the container properties.public CosmosContainerResponse createContainerIfNotExists(CosmosContainerProperties containerProperties, ThroughputProperties throughputProperties)
The throughput properties will only be used if the specified container does not exist and therefor a new container will be created.
containerProperties
- the container properties.throughputProperties
- the throughput properties for the container.public CosmosContainerResponse createContainerIfNotExists(String id, String partitionKeyPath)
id
- the id.partitionKeyPath
- the partition key path.public CosmosContainerResponse createContainerIfNotExists(String id, String partitionKeyPath, ThroughputProperties throughputProperties)
The throughput properties will only be used if the specified container does not exist and therefor a new container will be created.
id
- the id.partitionKeyPath
- the partition key path.throughputProperties
- the throughput properties for the container.public CosmosPagedIterable<CosmosContainerProperties> readAllContainers()
CosmosPagedIterable
.public CosmosPagedIterable<CosmosContainerProperties> queryContainers(String query)
query
- the query.CosmosPagedIterable
.public CosmosPagedIterable<CosmosContainerProperties> queryContainers(String query, CosmosQueryRequestOptions options)
query
- the query.options
- the options.CosmosPagedIterable
.public CosmosPagedIterable<CosmosContainerProperties> queryContainers(SqlQuerySpec querySpec)
querySpec
- the query spec.CosmosPagedIterable
.public CosmosPagedIterable<CosmosContainerProperties> queryContainers(SqlQuerySpec querySpec, CosmosQueryRequestOptions options)
querySpec
- the query spec.options
- the options.CosmosPagedIterable
.public CosmosContainer getContainer(String id)
To get the actual object a read operation must be performed first.
id
- id of the container.public CosmosUserResponse createUser(CosmosUserProperties userProperties)
To get the actual object a read operation must be performed first.
userProperties
- the settings.public CosmosUserResponse upsertUser(CosmosUserProperties userProperties)
userProperties
- the settings.public CosmosPagedIterable<CosmosUserProperties> readAllUsers()
CosmosPagedIterable
.public CosmosPagedIterable<CosmosUserProperties> queryUsers(String query)
query
- the query.CosmosPagedIterable
.public CosmosPagedIterable<CosmosUserProperties> queryUsers(String query, CosmosQueryRequestOptions options)
query
- the query.options
- the options.CosmosPagedIterable
.public CosmosPagedIterable<CosmosUserProperties> queryUsers(SqlQuerySpec querySpec)
querySpec
- the query spec.CosmosPagedIterable
.public CosmosPagedIterable<CosmosUserProperties> queryUsers(SqlQuerySpec querySpec, CosmosQueryRequestOptions options)
querySpec
- the query spec.options
- the options.CosmosPagedIterable
.public CosmosUser getUser(String id)
To get the actual object a read operation must be performed first.
id
- the id.public ThroughputResponse replaceThroughput(ThroughputProperties throughputProperties)
throughputProperties
- the throughput properties.public ThroughputResponse readThroughput()
@Beta(value=V4_15_0, warningText="Preview API - subject to change in non-backwards compatible way") public CosmosClientEncryptionKey getClientEncryptionKey(String id)
id
- id of the clientEncryptionKey@Beta(value=V4_15_0, warningText="Preview API - subject to change in non-backwards compatible way") public CosmosPagedIterable<CosmosClientEncryptionKeyProperties> readAllClientEncryptionKeys()
CosmosPagedIterable
.Copyright © 2021 Microsoft Corporation. All rights reserved.