Class KeyVaultBackupClientBuilder
- java.lang.Object
-
- com.azure.security.keyvault.administration.KeyVaultBackupClientBuilder
-
public final class KeyVaultBackupClientBuilder extends Object
This class provides a fluent builder API to help aid the configuration and instantiation of theKeyVaultBackupAsyncClient
andKeyVaultBackupClient
, by callingbuildAsyncClient()
andbuildClient()
respectively. It constructs an instance of the desired client.The minimal configuration options required by
KeyVaultBackupClientBuilder
to build an anKeyVaultBackupAsyncClient
arevaultUrl
andcredential
.Samples to construct a sync client
KeyVaultBackupClient keyVaultBackupClient = new KeyVaultBackupClientBuilder() .vaultUrl("https://myaccount.managedhsm.azure.net/") .credential(new DefaultAzureCredentialBuilder().build()) .buildClient();
Samples to construct an async client
KeyVaultBackupAsyncClient keyVaultBackupAsyncClient = new KeyVaultBackupClientBuilder() .vaultUrl("https://myaccount.managedhsm.azure.net/") .credential(new DefaultAzureCredentialBuilder().build()) .buildAsyncClient();
- See Also:
KeyVaultBackupClient
,KeyVaultBackupAsyncClient
-
-
Constructor Summary
Constructors Constructor Description KeyVaultBackupClientBuilder()
Creates aKeyVaultBackupClientBuilder
instance that is able to configure and construct instances ofKeyVaultBackupClient
andKeyVaultBackupAsyncClient
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description KeyVaultBackupClientBuilder
addPolicy(com.azure.core.http.policy.HttpPipelinePolicy policy)
Adds a policy to the set of existing policies that are executed after andKeyVaultBackupClient
KeyVaultBackupAsyncClient
required policies.KeyVaultBackupAsyncClient
buildAsyncClient()
Creates aKeyVaultBackupAsyncClient
based on options set in the Builder.KeyVaultBackupClient
buildClient()
Creates anKeyVaultBackupClient
based on options set in the Builder.KeyVaultBackupClientBuilder
clientOptions(com.azure.core.util.ClientOptions clientOptions)
Sets theClientOptions
which enables various options to be set on the client.KeyVaultBackupClientBuilder
configuration(com.azure.core.util.Configuration configuration)
Sets the configuration store that is used during construction of the service client.KeyVaultBackupClientBuilder
credential(com.azure.core.credential.TokenCredential credential)
Sets the credential to use when authenticating HTTP requests.KeyVaultBackupClientBuilder
httpClient(com.azure.core.http.HttpClient client)
Sets the HTTP client to use for sending and receiving requests to and from the service.KeyVaultBackupClientBuilder
httpLogOptions(com.azure.core.http.policy.HttpLogOptions logOptions)
Sets the logging configuration for HTTP requests and responses.KeyVaultBackupClientBuilder
pipeline(com.azure.core.http.HttpPipeline pipeline)
Sets the HTTP pipeline to use for the service client.KeyVaultBackupClientBuilder
retryPolicy(com.azure.core.http.policy.RetryPolicy retryPolicy)
Sets theRetryPolicy
that is used when each request is sent.KeyVaultBackupClientBuilder
serviceVersion(KeyVaultAdministrationServiceVersion serviceVersion)
Sets theKeyVaultAdministrationServiceVersion
that is used when making API requests.KeyVaultBackupClientBuilder
vaultUrl(String vaultUrl)
Sets the URL to the Key Vault on which the client operates.
-
-
-
Constructor Detail
-
KeyVaultBackupClientBuilder
public KeyVaultBackupClientBuilder()
Creates aKeyVaultBackupClientBuilder
instance that is able to configure and construct instances ofKeyVaultBackupClient
andKeyVaultBackupAsyncClient
.
-
-
Method Detail
-
buildClient
public KeyVaultBackupClient buildClient()
Creates anKeyVaultBackupClient
based on options set in the Builder. Every timebuildClient()
is called a new instance ofKeyVaultBackupClient
is created.If
pipeline
is set, then only thepipeline
andvaultUrl
are used to create theclient
. All other builder settings are ignored.- Returns:
- A
KeyVaultBackupClient
with the options set from the builder. - Throws:
NullPointerException
- IfvaultUrl
isnull
.
-
buildAsyncClient
public KeyVaultBackupAsyncClient buildAsyncClient()
Creates aKeyVaultBackupAsyncClient
based on options set in the Builder. Every timebuildAsyncClient()
is called a new instance ofKeyVaultBackupAsyncClient
is created.If
pipeline
is set, then only thepipeline
andendpoint
are used to create theclient
. All other builder settings are ignored.- Returns:
- A
KeyVaultBackupAsyncClient
with the options set from the builder. - Throws:
NullPointerException
- IfvaultUrl
isnull
.
-
vaultUrl
public KeyVaultBackupClientBuilder vaultUrl(String vaultUrl)
Sets the URL to the Key Vault on which the client operates. Appears as "DNS Name" in the Azure portal.- Parameters:
vaultUrl
- The vault URL is used as destination on Azure to send requests to.- Returns:
- The updated
KeyVaultBackupClientBuilder
object. - Throws:
IllegalArgumentException
- IfvaultUrl
is null or it cannot be parsed into a valid URL.NullPointerException
- Ifcredential
isnull
.
-
credential
public KeyVaultBackupClientBuilder 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
KeyVaultBackupClientBuilder
object. - Throws:
NullPointerException
- Ifcredential
isnull
.
-
httpLogOptions
public KeyVaultBackupClientBuilder 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
KeyVaultBackupClientBuilder
object.
-
addPolicy
public KeyVaultBackupClientBuilder addPolicy(com.azure.core.http.policy.HttpPipelinePolicy policy)
Adds a policy to the set of existing policies that are executed after andKeyVaultBackupClient
KeyVaultBackupAsyncClient
required policies.- Parameters:
policy
- Thepolicy
to be added.- Returns:
- The updated
KeyVaultBackupClientBuilder
object. - Throws:
NullPointerException
- Ifpolicy
isnull
.
-
httpClient
public KeyVaultBackupClientBuilder 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
KeyVaultBackupClientBuilder
object.
-
pipeline
public KeyVaultBackupClientBuilder pipeline(com.azure.core.http.HttpPipeline pipeline)
Sets the HTTP pipeline to use for the service client.If
pipeline
is set, all other settings are ignored, aside fromvaultUrl
to buildKeyVaultBackupClient
orKeyVaultBackupAsyncClient
.- Parameters:
pipeline
- The HTTP pipeline to use for sending service requests and receiving responses.- Returns:
- The updated
KeyVaultBackupClientBuilder
object.
-
configuration
public KeyVaultBackupClientBuilder 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 the
global configuration store
, useConfiguration.NONE
to bypass using configuration settings during construction.- Parameters:
configuration
- The configuration store used to get configuration details.- Returns:
- The updated
KeyVaultBackupClientBuilder
object.
-
retryPolicy
public KeyVaultBackupClientBuilder 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
KeyVaultBackupClientBuilder
object.
-
clientOptions
public KeyVaultBackupClientBuilder 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
KeyVaultBackupClientBuilder
object.
-
serviceVersion
public KeyVaultBackupClientBuilder serviceVersion(KeyVaultAdministrationServiceVersion serviceVersion)
Sets theKeyVaultAdministrationServiceVersion
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:
serviceVersion
-KeyVaultAdministrationServiceVersion
of the service API used when making requests.- Returns:
- The updated
KeyVaultBackupClientBuilder
object.
-
-