public final class SecretAsyncClientBuilder extends Object
secret async client,
calling build constructs an instance of the client.
The minimal configuration options required by secretClientBuilder to build SecretAsyncClient
are endpoint and credential.
SecretAsyncClient.builder()
.endpoint("https://myvault.vault.azure.net/")
.credential(keyVaultAsyncCredential)
.build();
The log detail level, multiple custom policies and custom
http client can be optionally configured in the SecretAsyncClientBuilder.
SecretAsyncClient secretAsyncClient = SecretAsyncClient.builder()
.endpoint("https://myvault.vault.azure.net/")
.credential(keyVaultAsyncCredential)
.httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS)
.addPolicy(customPolicyOne)
.addPolicy(customPolicyTwo)
.httpClient(client)
.build();
Alternatively, custom http pipeline with custom HttpPipelinePolicy policies and endpoint
can be specified. It provides finer control over the construction of client
SecretAsyncClient.builder()
.pipeline(new HttpPipeline(customPoliciesList))
.endpoint("https://myvault.vault.azure.net/")
.build()
SecretAsyncClient| Modifier and Type | Method and Description |
|---|---|
SecretAsyncClientBuilder |
addPolicy(HttpPipelinePolicy policy)
Adds a policy to the set of existing policies that are executed after
SecretAsyncClient required policies. |
SecretAsyncClient |
build()
Creates a
SecretAsyncClient based on options set in the builder. |
SecretAsyncClientBuilder |
credential(TokenCredential credential)
Sets the credential to use when authenticating HTTP requests.
|
SecretAsyncClientBuilder |
endpoint(String endPoint)
Sets the vault endpoint url to send HTTP requests to.
|
SecretAsyncClientBuilder |
httpClient(HttpClient client)
Sets the HTTP client to use for sending and receiving requests to and from the service.
|
SecretAsyncClientBuilder |
httpLogDetailLevel(HttpLogDetailLevel logLevel)
Sets the logging level for HTTP requests and responses.
|
SecretAsyncClientBuilder |
pipeline(HttpPipeline pipeline)
Sets the HTTP pipeline to use for the service client.
|
public SecretAsyncClient build()
SecretAsyncClient based on options set in the builder.
Every time build() is called, a new instance of SecretAsyncClient 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 SecretAsyncClientBuilder#endpoint(String)} key vault endpoint are required to build the {@link SecretAsyncClient client}.
IllegalStateException - If SecretAsyncClientBuilder.credential(TokenCredential) or
SecretAsyncClientBuilder.endpoint(String) have not been set.public SecretAsyncClientBuilder endpoint(String endPoint)
endPoint - The vault endpoint url is used as destination on Azure to send requests to.IllegalArgumentException - if endpoint is null or it cannot be parsed into a valid URL.public SecretAsyncClientBuilder credential(TokenCredential credential)
credential - The credential to use for authenticating HTTP requests.NullPointerException - if credential is null.public SecretAsyncClientBuilder httpLogDetailLevel(HttpLogDetailLevel logLevel)
logLevel is optional. If not provided, default value of HttpLogDetailLevel.NONE is set.
logLevel - The amount of logging output when sending and receiving HTTP requests/responses.NullPointerException - if logLevel is null.public SecretAsyncClientBuilder addPolicy(HttpPipelinePolicy policy)
SecretAsyncClient required policies.policy - The policy to be added.NullPointerException - if policy is null.public SecretAsyncClientBuilder httpClient(HttpClient client)
client - The HTTP client to use for requests.NullPointerException - If client is null.public SecretAsyncClientBuilder pipeline(HttpPipeline pipeline)
pipeline is set, all other settings are ignored, aside from
endpoint to build SecretAsyncClient.pipeline - The HTTP pipeline to use for sending service requests and receiving responses.SecretAsyncClientBuilder object.Copyright © 2019 Microsoft Corporation. All rights reserved.