Class KeyEncryptionKeyClientBuilder
- java.lang.Object
-
- com.azure.security.keyvault.keys.cryptography.KeyEncryptionKeyClientBuilder
-
- All Implemented Interfaces:
com.azure.core.cryptography.AsyncKeyEncryptionKeyResolver
,com.azure.core.cryptography.KeyEncryptionKeyResolver
public final class KeyEncryptionKeyClientBuilder extends Object implements com.azure.core.cryptography.KeyEncryptionKeyResolver, com.azure.core.cryptography.AsyncKeyEncryptionKeyResolver
This class provides a fluent builder API to help aid the configuration and instantiation of theKeyEncryptionKey async client
andKeyEncryptionKey sync client
, by callingbuildAsyncKeyEncryptionKey(String)
andbuildKeyEncryptionKey(String)
respectively. It constructs an instance of the desired client.The minimal configuration options required by
KeyEncryptionKeyClientBuilder
to buildAsyncKeyEncryptionKey
arejsonWebKey
orAzure Key Vault key identifier
andcredential
.The
log detail level
, multiple custompolicies
and customhttp client
can be optionally configured in theKeyEncryptionKeyClientBuilder
.Alternatively, a custom
http pipeline
with customHttpPipelinePolicy
policies can be specified. It provides finer control over the construction ofAsyncKeyEncryptionKey
andKeyEncryptionKey
The minimal configuration options required by
keyEncryptionKeyClientBuilder
to buildKeyEncryptionKey
arejsonWebKey
orAzure Key Vault key identifier
andcredential
.
-
-
Constructor Summary
Constructors Constructor Description KeyEncryptionKeyClientBuilder()
The constructor with defaults.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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 localKeyEncryptionKeyAsyncClient
based on options set in the builder.Mono<? extends com.azure.core.cryptography.AsyncKeyEncryptionKey>
buildAsyncKeyEncryptionKey(String keyId)
Creates aKeyEncryptionKeyAsyncClient
based on options set in the builder.com.azure.core.cryptography.KeyEncryptionKey
buildKeyEncryptionKey(JsonWebKey key)
Creates a localKeyEncryptionKeyClient
for a given JSON Web Key.com.azure.core.cryptography.KeyEncryptionKey
buildKeyEncryptionKey(String keyId)
Creates aKeyEncryptionKey
based on options set in the builder.KeyEncryptionKeyClientBuilder
clientOptions(com.azure.core.util.ClientOptions clientOptions)
Sets theClientOptions
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 theRetryPolicy
that is used when each request is sent.KeyEncryptionKeyClientBuilder
serviceVersion(CryptographyServiceVersion version)
Sets theCryptographyServiceVersion
that is used when making API requests.
-
-
-
Method Detail
-
buildKeyEncryptionKey
public com.azure.core.cryptography.KeyEncryptionKey buildKeyEncryptionKey(String keyId)
Creates aKeyEncryptionKey
based on options set in the builder. Every timebuildKeyEncryptionKey(String)
is called, a new instance ofKeyEncryptionKey
is created.If
pipeline
is set, then thepipeline
andkeyId
are used to create theclient
. All other builder settings are ignored. Ifpipeline
is not set, then anAzure Key Vault credential
andkeyId
are required to build theclient
.- Specified by:
buildKeyEncryptionKey
in interfacecom.azure.core.cryptography.KeyEncryptionKeyResolver
- Returns:
- A
KeyEncryptionKeyClient
with the options set from the builder. - Throws:
IllegalStateException
- Ifcredential(TokenCredential)
orkeyId
have not been set.
-
buildKeyEncryptionKey
public com.azure.core.cryptography.KeyEncryptionKey buildKeyEncryptionKey(JsonWebKey key)
Creates a localKeyEncryptionKeyClient
for a given JSON Web Key. Every timebuildKeyEncryptionKey(JsonWebKey)
is called, a new instance ofKeyEncryptionKey
is created. For local clients, all other builder settings are ignored.The
key
is required to build theclient
.- Parameters:
key
- TheJsonWebKey
to be used for cryptography operations.- Returns:
- A
KeyEncryptionKeyClient
with the options set from the builder. - Throws:
IllegalStateException
- If {key
is not set.
-
buildAsyncKeyEncryptionKey
public Mono<? extends com.azure.core.cryptography.AsyncKeyEncryptionKey> buildAsyncKeyEncryptionKey(String keyId)
Creates aKeyEncryptionKeyAsyncClient
based on options set in the builder. Every timebuildAsyncKeyEncryptionKey(String)
is called, a new instance ofKeyEncryptionKeyAsyncClient
is created.If
pipeline
is set, then thepipeline
andkeyId
are used to create theasync client
. All other builder settings are ignored. Ifpipeline
is not set, then anAzure Key Vault credentials
andkeyId
are required to build theasync client
.- Specified by:
buildAsyncKeyEncryptionKey
in interfacecom.azure.core.cryptography.AsyncKeyEncryptionKeyResolver
- Returns:
- A
KeyEncryptionKeyAsyncClient
with the options set from the builder. - Throws:
IllegalStateException
- Ifcredential(TokenCredential)
isnull
orkeyId
is empty ornull
.
-
buildAsyncKeyEncryptionKey
public Mono<? extends com.azure.core.cryptography.AsyncKeyEncryptionKey> buildAsyncKeyEncryptionKey(JsonWebKey key)
Creates a localKeyEncryptionKeyAsyncClient
based on options set in the builder. Every timebuildAsyncKeyEncryptionKey(String)
is called, a new instance ofKeyEncryptionKeyAsyncClient
is created. For local clients, all other builder settings are ignored.The
key
is required to build theclient
.- Parameters:
key
- The key to be used for cryptography operations.- Returns:
- A
KeyEncryptionKeyAsyncClient
with the options set from the builder. - Throws:
IllegalArgumentException
- Ifkey
has no id.IllegalStateException
- Ifkey
isnull
.
-
credential
public KeyEncryptionKeyClientBuilder credential(com.azure.core.credential.TokenCredential credential)
Sets the credential to use when authenticating HTTP requests.- Parameters:
credential
- The credential to use for authenticating HTTP requests.- Returns:
- The updated
KeyEncryptionKeyClientBuilder
object. - Throws:
NullPointerException
- Ifcredential
isnull
.
-
httpLogOptions
public KeyEncryptionKeyClientBuilder httpLogOptions(com.azure.core.http.policy.HttpLogOptions logOptions)
Sets the logging configuration for HTTP requests and responses.If logLevel is not provided, default value of
HttpLogDetailLevel.NONE
is set.- Parameters:
logOptions
- The logging configuration to use when sending and receiving HTTP requests/responses.- Returns:
- The updated
KeyEncryptionKeyClientBuilder
object.
-
addPolicy
public 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.- Parameters:
policy
- Thepolicy
to be added.- Returns:
- The updated
KeyEncryptionKeyClientBuilder
object. - Throws:
NullPointerException
- Ifpolicy
isnull
.
-
httpClient
public KeyEncryptionKeyClientBuilder httpClient(com.azure.core.http.HttpClient client)
Sets the HTTP client to use for sending and receiving requests to and from the service.- Parameters:
client
- The HTTP client to use for requests.- Returns:
- The updated
KeyEncryptionKeyClientBuilder
object.
-
pipeline
public KeyEncryptionKeyClientBuilder pipeline(com.azure.core.http.HttpPipeline pipeline)
Sets the HTTP pipeline to use for the service client. Ifpipeline
is set, all other settings are ignored, aside from jsonWebKey identifier or jsonWebKey to build the clients.- Parameters:
pipeline
- The HTTP pipeline to use for sending service requests and receiving responses.- Returns:
- The updated
KeyEncryptionKeyClientBuilder
object.
-
configuration
public KeyEncryptionKeyClientBuilder configuration(com.azure.core.util.Configuration configuration)
Sets the configuration store that is used during construction of the service client. The default configuration store is a clone of theglobal configuration store
, useConfiguration.NONE
to bypass using configuration settings during construction.- Parameters:
configuration
- The configuration store used to get configuration details.- Returns:
- The updated
KeyEncryptionKeyClientBuilder
object.
-
serviceVersion
public KeyEncryptionKeyClientBuilder serviceVersion(CryptographyServiceVersion version)
Sets theCryptographyServiceVersion
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.
- Parameters:
version
-CryptographyServiceVersion
of the service to be used when making requests.- Returns:
- The updated
KeyEncryptionKeyClientBuilder
object.
-
retryPolicy
public KeyEncryptionKeyClientBuilder retryPolicy(com.azure.core.http.policy.RetryPolicy retryPolicy)
Sets theRetryPolicy
that is used when each request is sent. The default retry policy will be used in the pipeline, if not provided.- Parameters:
retryPolicy
- User's retry policy applied to each request.- Returns:
- The updated
KeyEncryptionKeyClientBuilder
object.
-
clientOptions
public KeyEncryptionKeyClientBuilder clientOptions(com.azure.core.util.ClientOptions clientOptions)
Sets theClientOptions
which enables various options to be set on the client. For example setting anapplicationId
usingClientOptions.setApplicationId(String)
to configure theUserAgentPolicy
for telemetry/monitoring purposes.More About Azure Core: Telemetry policy
- Parameters:
clientOptions
- TheClientOptions
to be set on the client.- Returns:
- The updated
KeyEncryptionKeyClientBuilder
object.
-
-