Database class
Operations for reading or deleting an existing database.
See Databases for creating new databases, and reading/querying all databases; use client.databases
.
Note: all these operations make calls against a fixed budget.
You should design your system such that these calls scale sublinearly with your application.
For instance, do not call database.read()
before every single item.read()
call, to ensure the database exists;
do this once on application start up.
Properties
client | |
containers | Used for creating new containers, or querying/reading all containers. Use Example Create a new container
|
id | |
url | Returns a reference URL to the resource. Used for linking in Permissions. |
users | Used for creating new users, or querying/reading all users. Use |
Methods
container(string) | Used to read, replace, or delete a specific, existing Database by id. Use Example Delete a container
|
create |
Create Encryption key for database account |
delete(Request |
Delete the given Database. |
read(Request |
Read the definition of the given Database. |
read |
Read Encryption key for database account |
read |
Gets offer on database. If none exists, returns an OfferResponse with undefined. |
rewrap |
rewraps a client encryption key with new key encryption key |
user(string) | Used to read, replace, or delete a specific, existing User by id. Use |
Property Details
client
containers
Used for creating new containers, or querying/reading all containers.
Use .database(id)
to read, replace, or delete a specific, existing Database by id.
Example
Create a new container
const {body: containerDefinition, container} = await client.database("<db id>").containers.create({id: "<container id>"});
containers: Containers
Property Value
id
id: string
Property Value
string
url
Returns a reference URL to the resource. Used for linking in Permissions.
string url
Property Value
string
users
Method Details
container(string)
Used to read, replace, or delete a specific, existing Database by id.
Use .containers
creating new containers, or querying/reading all containers.
Example
Delete a container
await client.database("<db id>").container("<container id>").delete();
function container(id: string): Container
Parameters
- id
-
string
Returns
createClientEncryptionKey(string, AEAD_AES_256_CBC_HMAC_SHA256, EncryptionKeyWrapMetadata)
Create Encryption key for database account
function createClientEncryptionKey(clientEncryptionKeyId: string, encryptionAlgorithm: AEAD_AES_256_CBC_HMAC_SHA256, keyWrapMetadata: EncryptionKeyWrapMetadata): Promise<ClientEncryptionKeyResponse>
Parameters
- clientEncryptionKeyId
-
string
- encryptionAlgorithm
- AEAD_AES_256_CBC_HMAC_SHA256
- keyWrapMetadata
- EncryptionKeyWrapMetadata
Returns
Promise<ClientEncryptionKeyResponse>
delete(RequestOptions)
Delete the given Database.
function delete(options?: RequestOptions): Promise<DatabaseResponse>
Parameters
- options
- RequestOptions
Returns
Promise<DatabaseResponse>
read(RequestOptions)
Read the definition of the given Database.
function read(options?: RequestOptions): Promise<DatabaseResponse>
Parameters
- options
- RequestOptions
Returns
Promise<DatabaseResponse>
readClientEncryptionKey(string)
Read Encryption key for database account
function readClientEncryptionKey(clientEncryptionKeyId: string): Promise<ClientEncryptionKeyResponse>
Parameters
- clientEncryptionKeyId
-
string
Returns
Promise<ClientEncryptionKeyResponse>
readOffer(RequestOptions)
Gets offer on database. If none exists, returns an OfferResponse with undefined.
function readOffer(options?: RequestOptions): Promise<OfferResponse>
Parameters
- options
- RequestOptions
Returns
Promise<OfferResponse>
rewrapClientEncryptionKey(string, EncryptionKeyWrapMetadata)
rewraps a client encryption key with new key encryption key
function rewrapClientEncryptionKey(clientEncryptionKeyId: string, newKeyWrapMetadata: EncryptionKeyWrapMetadata): Promise<ClientEncryptionKeyResponse>
Parameters
- clientEncryptionKeyId
-
string
- newKeyWrapMetadata
- EncryptionKeyWrapMetadata
new encryption key wrap metadata
Returns
Promise<ClientEncryptionKeyResponse>
rewrapped client encryption key with new customer managed key