public final class CertificateClientBuilder extends Object
certificate async client
and certificate sync client
,
by calling buildAsyncClient
and buildClient
respectively
It constructs an instance of the desired client.
The minimal configuration options required by CertificateClientBuilder
to build CertificateAsyncClient
are vaultUrl
and credential
.
CertificateAsyncClient certificateAsyncClient = new CertificateClientBuilder() .credential(new DefaultAzureCredentialBuilder().build()) .vaultUrl("https://myvault.vault.azure.net/") .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS)) .buildAsyncClient();
The log detail level
, multiple custom policies
and custom
http client
can be optionally configured in the CertificateClientBuilder
.
CertificateAsyncClient certificateAsyncClient = new CertificateClientBuilder() .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS)) .vaultUrl("https://myvault.azure.net/") .credential(new DefaultAzureCredentialBuilder().build()) .httpClient(HttpClient.createDefault()) .buildAsyncClient();
Alternatively, custom http pipeline
with custom HttpPipelinePolicy
policies and
vaultUrl
can be specified. It provides finer control over the construction of CertificateAsyncClient
and CertificateClient
HttpPipeline pipeline = new HttpPipelineBuilder() .policies(new KeyVaultCredentialPolicy(new DefaultAzureCredentialBuilder().build()), new RetryPolicy()) .build(); CertificateAsyncClient certificateAsyncClient = new CertificateClientBuilder() .pipeline(pipeline) .vaultUrl("https://myvault.azure.net/") .buildAsyncClient();
The minimal configuration options required by certificateClientBuilder
to build
CertificateClient
are vaultUrl
and credential
.
CertificateClient certificateClient = new CertificateClientBuilder() .credential(new DefaultAzureCredentialBuilder().build()) .vaultUrl("https://myvault.vault.azure.net/") .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS)) .buildClient();
CertificateAsyncClient
,
CertificateClient
Constructor and Description |
---|
CertificateClientBuilder()
The constructor with defaults.
|
Modifier and Type | Method and Description |
---|---|
CertificateClientBuilder |
addPolicy(com.azure.core.http.policy.HttpPipelinePolicy policy)
Adds a policy to the set of existing policies that are executed after
CertificateAsyncClient and CertificateClient required policies. |
CertificateAsyncClient |
buildAsyncClient()
Creates a
CertificateAsyncClient based on options set in the builder. |
CertificateClient |
buildClient()
Creates a
CertificateClient based on options set in the builder. |
CertificateClientBuilder |
clientOptions(com.azure.core.util.ClientOptions clientOptions)
Sets the
ClientOptions which enables various options to be set on the client. |
CertificateClientBuilder |
configuration(com.azure.core.util.Configuration configuration)
Sets the configuration store that is used during construction of the service client.
|
CertificateClientBuilder |
credential(com.azure.core.credential.TokenCredential credential)
Sets the credential to use when authenticating HTTP requests.
|
CertificateClientBuilder |
httpClient(com.azure.core.http.HttpClient client)
Sets the HTTP client to use for sending and receiving requests to and from the service.
|
CertificateClientBuilder |
httpLogOptions(com.azure.core.http.policy.HttpLogOptions logOptions)
Sets the logging configuration for HTTP requests and responses.
|
CertificateClientBuilder |
pipeline(com.azure.core.http.HttpPipeline pipeline)
Sets the HTTP pipeline to use for the service client.
|
CertificateClientBuilder |
retryPolicy(com.azure.core.http.policy.RetryPolicy retryPolicy)
Sets the
RetryPolicy that is used when each request is sent. |
CertificateClientBuilder |
serviceVersion(CertificateServiceVersion version)
Sets the
CertificateServiceVersion that is used when making API requests. |
CertificateClientBuilder |
vaultUrl(String vaultUrl)
Sets the vault endpoint URL to send HTTP requests to.
|
public CertificateClientBuilder()
public CertificateClient buildClient()
CertificateClient
based on options set in the builder.
Every time buildClient()
is called, a new instance of CertificateClient
is created.
If pipeline
is set, then the pipeline
and
serviceEndpoint
are used to create the
client
. All other builder settings are ignored. If pipeline
is not set,
then key vault credential
and
key vault url
are required to build the client
.
CertificateClient
with the options set from the builder.IllegalStateException
- If CertificateClientBuilder.credential(TokenCredential)
or
CertificateClientBuilder.vaultUrl(String)
have not been set.public CertificateAsyncClient buildAsyncClient()
CertificateAsyncClient
based on options set in the builder. Every time
CertificateClientBuilder.buildAsyncClient()
is called, a new instance of CertificateAsyncClient
is created.
If pipeline
is set, then the pipeline
and
serviceEndpoint
are used to create the client
. All other builder settings are ignored. If pipeline
is not set, then
key vault credential and {@link
CertificateClientBuilder#vaultUrl(String)} key vault url are required to build the {@link CertificateAsyncClient
client}.
CertificateAsyncClient
with the options set from the builder.IllegalStateException
- If CertificateClientBuilder.credential(TokenCredential)
or CertificateClientBuilder.vaultUrl(String)
have not been set.public CertificateClientBuilder vaultUrl(String vaultUrl)
vaultUrl
- The vault endpoint url is used as destination on Azure to send requests to. If you have a
certificate identifier, create a new KeyVaultCertificateIdentifier
to parse it and obtain the
vaultUrl
and other information.CertificateClientBuilder
object.IllegalArgumentException
- if vaultUrl
is null or it cannot be parsed into a valid URL.public CertificateClientBuilder credential(com.azure.core.credential.TokenCredential credential)
credential
- The credential to use for authenticating HTTP requests.CertificateClientBuilder
object.NullPointerException
- If credential
is null
.public CertificateClientBuilder 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.CertificateClientBuilder
object.public CertificateClientBuilder addPolicy(com.azure.core.http.policy.HttpPipelinePolicy policy)
CertificateAsyncClient
and CertificateClient
required policies.policy
- The policy
to be added.CertificateClientBuilder
object.NullPointerException
- If policy
is null
.public CertificateClientBuilder httpClient(com.azure.core.http.HttpClient client)
client
- The HTTP client to use for requests.CertificateClientBuilder
object.public CertificateClientBuilder pipeline(com.azure.core.http.HttpPipeline pipeline)
pipeline
is set, all other settings are ignored, aside from
vaultUrl
to build CertificateClient
or CertificateAsyncClient
.pipeline
- The HTTP pipeline to use for sending service requests and receiving responses.CertificateClientBuilder
object.public CertificateClientBuilder 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.CertificateClientBuilder
object.public CertificateClientBuilder serviceVersion(CertificateServiceVersion version)
CertificateServiceVersion
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
- CertificateServiceVersion
of the service to be used when making requests.CertificateClientBuilder
object.public CertificateClientBuilder 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.CertificateClientBuilder
object.public CertificateClientBuilder 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.CertificateClientBuilder
object.Copyright © 2021 Microsoft Corporation. All rights reserved.