CosmosEncryptionClientBuilder Class
- java.
lang. Object - com.
azure. cosmos. encryption. CosmosEncryptionClientBuilder
- com.
public class CosmosEncryptionClientBuilder
Helper class to build CosmosEncryptionAsyncClient and CosmosEncryptionClient instances as logical representation of the Azure Cosmos database service.
When building client, cosmosAsyncClient()/cosmosClient(), keyEncryptionKeyResolver() and keyEncryptionKeyResolverName() are mandatory APIs, without these the initialization will fail.
Building Cosmos Encryption Async Client APIs.
If Azure key vault is used in , we can input in
CosmosEncryptionAsyncClient cosmosEncryptionAsyncClient = new CosmosEncryptionClientBuilder()
.cosmosAsyncClient(cosmosAsyncClient)
.keyEncryptionKeyResolver(keyEncryptionKeyResolver)
.keyEncryptionKeyResolverName(keyEncryptionKeyResolverName)
.buildAsyncClient();
Building Cosmos Encryption Sync Client minimal APIs
If Azure key vault is used in , we can input in
*
CosmosEncryptionClient client = new CosmosEncryptionClientBuilder()
.cosmosClient(cosmosClient)
.keyEncryptionKeyResolver(keyEncryptionKeyResolver)
.keyEncryptionKeyResolverName(keyEncryptionKeyResolverName)
.buildClient();
Field Summary
Modifier and Type | Field and Description |
---|---|
static final String |
KEY_RESOLVER_NAME_AZURE_KEY_VAULT
Key |
Constructor Summary
Constructor | Description |
---|---|
CosmosEncryptionClientBuilder() |
Instantiates a new Cosmos encryption client builder. |
Method Summary
Modifier and Type | Method and Description |
---|---|
Cosmos |
buildAsyncClient()
Builds a cosmos encryption async client. |
Cosmos |
buildClient()
Builds a cosmos encryption async client. |
Cosmos |
cosmosAsyncClient(CosmosAsyncClient cosmosAsyncClient)
Sets the cosmos core async client to be used. |
Cosmos |
cosmosClient(CosmosClient cosmosClient)
Sets the cosmos core sync client to be used. |
Cosmos |
keyEncryptionKeyResolver(KeyEncryptionKeyResolver keyEncryptionKeyResolver)
Sets the key wrap provider |
Cosmos |
keyEncryptionKeyResolverName(String keyEncryptionKeyResolverName)
Sets the key encryption key resolver name |
Methods inherited from java.lang.Object
Field Details
KEY_RESOLVER_NAME_AZURE_KEY_VAULT
public static final String KEY_RESOLVER_NAME_AZURE_KEY_VAULT
KeyEncryptionKeyResolver name for keyEncryptionKeyResolverName(String keyEncryptionKeyResolverName) if Azure key vault resolver is being used in keyEncryptionKeyResolver(KeyEncryptionKeyResolver keyEncryptionKeyResolver).
Constructor Details
CosmosEncryptionClientBuilder
public CosmosEncryptionClientBuilder()
Instantiates a new Cosmos encryption client builder.
Method Details
buildAsyncClient
public CosmosEncryptionAsyncClient buildAsyncClient()
Builds a cosmos encryption async client.
Returns:
buildClient
public CosmosEncryptionClient buildClient()
Builds a cosmos encryption async client.
Returns:
cosmosAsyncClient
public CosmosEncryptionClientBuilder cosmosAsyncClient(CosmosAsyncClient cosmosAsyncClient)
Sets the cosmos core async client to be used.
Parameters:
Returns:
cosmosClient
public CosmosEncryptionClientBuilder cosmosClient(CosmosClient cosmosClient)
Sets the cosmos core sync client to be used.
Parameters:
Returns:
keyEncryptionKeyResolver
public CosmosEncryptionClientBuilder keyEncryptionKeyResolver(KeyEncryptionKeyResolver keyEncryptionKeyResolver)
Sets the key wrap provider
Parameters:
Returns:
keyEncryptionKeyResolverName
public CosmosEncryptionClientBuilder keyEncryptionKeyResolverName(String keyEncryptionKeyResolverName)
Sets the key encryption key resolver name
Parameters:
Returns:
Applies to
Azure SDK for Java