public final class KeyEncryptionKeyClientBuilder extends Object implements com.azure.core.cryptography.KeyEncryptionKeyResolver, com.azure.core.cryptography.AsyncKeyEncryptionKeyResolver
KeyEncryptionKey async client
and
KeyEncryptionKey sync client
, by calling
KeyEncryptionKeyClientBuilder.buildAsyncKeyEncryptionKey(String)
and
KeyEncryptionKeyClientBuilder.buildKeyEncryptionKey(String)
respectively. It constructs an instance of the
desired client.
The minimal configuration options required by KeyEncryptionKeyClientBuilder
to build
AsyncKeyEncryptionKey
are jsonWebKey
or Azure Key Vault key identifier
and credential
.
The log detail level
, multiple custom policies
and custom
http client
can be optionally configured in the KeyEncryptionKeyClientBuilder
.
Alternatively, a custom http pipeline
with custom HttpPipelinePolicy
policies
can be specified. It provides finer control over the construction of AsyncKeyEncryptionKey
and
KeyEncryptionKey
The minimal configuration options required by keyEncryptionKeyClientBuilder
to build KeyEncryptionKey
are jsonWebKey
or
Azure Key Vault key identifier
and credential
.
Constructor and Description |
---|
KeyEncryptionKeyClientBuilder()
The constructor with defaults.
|
Modifier and Type | Method and Description |
---|---|
KeyEncryptionKeyClientBuilder |
addPolicy(com.azure.core.http.policy.HttpPipelinePolicy policy)
Adds a policy to the set of existing policies that are executed after the client required policies.
|
Mono<? extends com.azure.core.cryptography.AsyncKeyEncryptionKey> |
buildAsyncKeyEncryptionKey(JsonWebKey key)
Creates a local
KeyEncryptionKeyAsyncClient based on options set in the builder. |
Mono<? extends com.azure.core.cryptography.AsyncKeyEncryptionKey> |
buildAsyncKeyEncryptionKey(String keyId)
Creates a
KeyEncryptionKeyAsyncClient based on options set in the builder. |
com.azure.core.cryptography.KeyEncryptionKey |
buildKeyEncryptionKey(JsonWebKey key)
Creates a local
KeyEncryptionKeyClient for a given JSON Web Key. |
com.azure.core.cryptography.KeyEncryptionKey |
buildKeyEncryptionKey(String keyId)
Creates a
KeyEncryptionKey based on options set in the builder. |
KeyEncryptionKeyClientBuilder |
clientOptions(com.azure.core.util.ClientOptions clientOptions)
Sets the
ClientOptions which enables various options to be set on the client. |
KeyEncryptionKeyClientBuilder |
configuration(com.azure.core.util.Configuration configuration)
Sets the configuration store that is used during construction of the service client.
|
KeyEncryptionKeyClientBuilder |
credential(com.azure.core.credential.TokenCredential credential)
Sets the credential to use when authenticating HTTP requests.
|
KeyEncryptionKeyClientBuilder |
httpClient(com.azure.core.http.HttpClient client)
Sets the HTTP client to use for sending and receiving requests to and from the service.
|
KeyEncryptionKeyClientBuilder |
httpLogOptions(com.azure.core.http.policy.HttpLogOptions logOptions)
Sets the logging configuration for HTTP requests and responses.
|
KeyEncryptionKeyClientBuilder |
pipeline(com.azure.core.http.HttpPipeline pipeline)
Sets the HTTP pipeline to use for the service client.
|
KeyEncryptionKeyClientBuilder |
retryPolicy(com.azure.core.http.policy.RetryPolicy retryPolicy)
Sets the
RetryPolicy that is used when each request is sent. |
KeyEncryptionKeyClientBuilder |
serviceVersion(CryptographyServiceVersion version)
Sets the
CryptographyServiceVersion that is used when making API requests. |
public KeyEncryptionKeyClientBuilder()
public com.azure.core.cryptography.KeyEncryptionKey buildKeyEncryptionKey(String keyId)
KeyEncryptionKey
based on options set in the builder. Every time
buildKeyEncryptionKey(String)
is called, a new instance of KeyEncryptionKey
is created.
If pipeline
is set, then the pipeline
and keyId
are used to create the client
. All other builder settings are
ignored. If pipeline
is not set, then an
Azure Key Vault credential
and keyId
are required to build the client
.
buildKeyEncryptionKey
in interface com.azure.core.cryptography.KeyEncryptionKeyResolver
KeyEncryptionKeyClient
with the options set from the builder.IllegalStateException
- If KeyEncryptionKeyClientBuilder.credential(TokenCredential)
or
keyId
have not been set.public com.azure.core.cryptography.KeyEncryptionKey buildKeyEncryptionKey(JsonWebKey key)
KeyEncryptionKeyClient
for a given JSON Web Key. Every time
buildKeyEncryptionKey(JsonWebKey)
is called, a new instance of KeyEncryptionKey
is created.
For local clients, all other builder settings are ignored.
The key
is required to build the client
.
key
- The JsonWebKey
to be used for cryptography operations.KeyEncryptionKeyClient
with the options set from the builder.IllegalStateException
- If {key
is not set.public Mono<? extends com.azure.core.cryptography.AsyncKeyEncryptionKey> buildAsyncKeyEncryptionKey(String keyId)
KeyEncryptionKeyAsyncClient
based on options set in the builder. Every time
buildAsyncKeyEncryptionKey(String)
is called, a new instance of KeyEncryptionKeyAsyncClient
is
created.
If pipeline
is set, then the pipeline
and keyId
are used to create the async client
. All other builder
settings are ignored. If pipeline
is not set, then an
Azure Key Vault credentials
and
keyId
are required to build the async client
.
buildAsyncKeyEncryptionKey
in interface com.azure.core.cryptography.AsyncKeyEncryptionKeyResolver
KeyEncryptionKeyAsyncClient
with the options set from the builder.IllegalStateException
- If KeyEncryptionKeyClientBuilder.credential(TokenCredential)
is
null
or keyId
is empty or null
.public Mono<? extends com.azure.core.cryptography.AsyncKeyEncryptionKey> buildAsyncKeyEncryptionKey(JsonWebKey key)
KeyEncryptionKeyAsyncClient
based on options set in the builder. Every time
buildAsyncKeyEncryptionKey(String)
is called, a new instance of
KeyEncryptionKeyAsyncClient
is created. For local clients, all other builder settings are ignored.
The key
is required to build the client
.
key
- The key to be used for cryptography operations.KeyEncryptionKeyAsyncClient
with the options set from the builder.IllegalArgumentException
- If key
has no id.IllegalStateException
- If key
is null
.public KeyEncryptionKeyClientBuilder credential(com.azure.core.credential.TokenCredential credential)
credential
- The credential to use for authenticating HTTP requests.KeyEncryptionKeyClientBuilder
object.NullPointerException
- If credential
is null
.public KeyEncryptionKeyClientBuilder httpLogOptions(com.azure.core.http.policy.HttpLogOptions logOptions)
If logLevel is not provided, default value of HttpLogDetailLevel.NONE
is set.
logOptions
- The logging configuration to use when sending and receiving HTTP requests/responses.KeyEncryptionKeyClientBuilder
object.public KeyEncryptionKeyClientBuilder addPolicy(com.azure.core.http.policy.HttpPipelinePolicy policy)
policy
- The policy
to be added.KeyEncryptionKeyClientBuilder
object.NullPointerException
- If policy
is null
.public KeyEncryptionKeyClientBuilder httpClient(com.azure.core.http.HttpClient client)
client
- The HTTP client to use for requests.KeyEncryptionKeyClientBuilder
object.public KeyEncryptionKeyClientBuilder pipeline(com.azure.core.http.HttpPipeline pipeline)
pipeline
is set, all other settings are ignored, aside from jsonWebKey identifier
or jsonWebKey to build the clients.pipeline
- The HTTP pipeline to use for sending service requests and receiving responses.KeyEncryptionKeyClientBuilder
object.public KeyEncryptionKeyClientBuilder configuration(com.azure.core.util.Configuration configuration)
global configuration store
, use Configuration.NONE
to
bypass using configuration settings during construction.configuration
- The configuration store used to get configuration details.KeyEncryptionKeyClientBuilder
object.public KeyEncryptionKeyClientBuilder serviceVersion(CryptographyServiceVersion version)
CryptographyServiceVersion
that is used when making API requests.
If a service version is not provided, the service version that will be used will be the latest known service version based on the version of the client library being used. If no service version is specified, updating to a newer version the client library will have the result of potentially moving to a newer service version.
version
- CryptographyServiceVersion
of the service to be used when making requests.KeyEncryptionKeyClientBuilder
object.public KeyEncryptionKeyClientBuilder retryPolicy(com.azure.core.http.policy.RetryPolicy retryPolicy)
RetryPolicy
that is used when each request is sent. The default retry policy will be used in
the pipeline, if not provided.retryPolicy
- User's retry policy applied to each request.KeyEncryptionKeyClientBuilder
object.public KeyEncryptionKeyClientBuilder clientOptions(com.azure.core.util.ClientOptions clientOptions)
ClientOptions
which enables various options to be set on the client. For example setting an
applicationId
using ClientOptions.setApplicationId(String)
to configure the
UserAgentPolicy
for telemetry/monitoring purposes.
More About Azure Core: Telemetry policy
clientOptions
- The ClientOptions
to be set on the client.KeyEncryptionKeyClientBuilder
object.Copyright © 2021 Microsoft Corporation. All rights reserved.