Class ClientEncryptionKey
Provides operations for reading a specific client data encryption key (aka ClientEncryptionKey) by Id. See Database for operations to create and enumerate client encryption keys. See https://aka.ms/CosmosClientEncryption for more information on client-side encryption support in Azure Cosmos DB.
public abstract class ClientEncryptionKey
- Inheritance
-
ClientEncryptionKey
- Inherited Members
- Extension Methods
Constructors
ClientEncryptionKey()
protected ClientEncryptionKey()
Properties
Id
The unique identifier of the client encryption key.
public abstract string Id { get; }
Property Value
Methods
ReadAsync(RequestOptions, CancellationToken)
Reads the properties of a client encryption key from the Azure Cosmos service as an asynchronous operation. This method is not meant to be invoked directly. Please see https://aka.ms/CosmosClientEncryption in order to use client-side encryption.
public abstract Task<ClientEncryptionKeyResponse> ReadAsync(RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
Parameters
requestOptions
RequestOptions(Optional) The options for the request.
cancellationToken
CancellationToken(Optional) Token representing request cancellation.
Returns
- Task<ClientEncryptionKeyResponse>
An awaitable response which wraps a ClientEncryptionKeyProperties containing details of the client encryption key that was read.
Exceptions
- CosmosException
This exception can encapsulate many different types of errors. To determine the specific error always look at the StatusCode property. Some common codes you may get when reading a client encryption key are:
StatusCode Reason for exception 404 NotFound - This means the resource or parent resource you tried to read did not exist. 429 TooManyRequests - This means you have exceeded the number of request units per second. Consult the CosmosException.RetryAfter value to see how long you should wait before retrying this operation.
ReplaceAsync(ClientEncryptionKeyProperties, RequestOptions, CancellationToken)
Replace a ClientEncryptionKeyProperties from the Azure Cosmos service as an asynchronous operation. This method is not meant to be invoked directly. Please see https://aka.ms/CosmosClientEncryption in order to use client-side encryption.
public abstract Task<ClientEncryptionKeyResponse> ReplaceAsync(ClientEncryptionKeyProperties clientEncryptionKeyProperties, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
Parameters
clientEncryptionKeyProperties
ClientEncryptionKeyPropertiesThe ClientEncryptionKeyProperties object.
requestOptions
RequestOptions(Optional) The options for the request.
cancellationToken
CancellationToken(Optional) CancellationToken representing request cancellation.
Returns
- Task<ClientEncryptionKeyResponse>
A Task containing a ClientEncryptionKeyResponse which wraps a ClientEncryptionKeyProperties containing the replace resource record.