public final class ConfigurationClientBuilder extends Object
ConfigurationClient,
calling build constructs an instance of the client.
The client needs the service endpoint of the Azure App Configuration store and access credentials.
ConfigurationClientCredentials gives the builder the service endpoint and access credentials it requires to
construct a client, set the ConfigurationClientCredentials with this.
ConfigurationAsyncClient client = ConfigurationAsyncClient.builder()
.credentials(new ConfigurationClientCredentials(connectionString))
.build();
Another way to construct the client is using a HttpPipeline. The pipeline gives the client an authenticated
way to communicate with the service but it doesn't contain the service endpoint. Set the pipeline with
this, additionally set the service endpoint with
this. Using a pipeline requires additional setup but
allows for finer control on how the ConfigurationClient it built.
ConfigurationAsyncClient.builder()
.pipeline(new HttpPipeline(policies))
.serviceEndpoint(serviceEndpoint)
.build();
| Modifier and Type | Method and Description |
|---|---|
ConfigurationClientBuilder |
addPolicy(HttpPipelinePolicy policy)
Adds a policy to the set of existing policies that are executed after
ConfigurationClient required policies. |
ConfigurationClient |
build()
Creates a
ConfigurationClient based on options set in the Builder. |
ConfigurationClientBuilder |
configuration(Configuration configuration)
Sets the configuration store that is used during construction of the service client.
|
ConfigurationClientBuilder |
credentials(ConfigurationClientCredentials credentials)
Sets the credentials to use when authenticating HTTP requests.
|
ConfigurationClientBuilder |
httpClient(HttpClient client)
Sets the HTTP client to use for sending and receiving requests to and from the service.
|
ConfigurationClientBuilder |
httpLogDetailLevel(HttpLogDetailLevel logLevel)
Sets the logging level for HTTP requests and responses.
|
ConfigurationClientBuilder |
pipeline(HttpPipeline pipeline)
Sets the HTTP pipeline to use for the service client.
|
ConfigurationClientBuilder |
serviceEndpoint(String serviceEndpoint)
Sets the service endpoint for the Azure App Configuration instance.
|
public ConfigurationClient build()
ConfigurationClient based on options set in the Builder. Every time build() is
called, a new instance of ConfigurationClient is created.
If pipeline is set, then the pipeline and
serviceEndpoint are used to create the
client. All other builder settings are ignored.
NullPointerException - If serviceEndpoint has not been set. This setting is automatically set when
credentials are set through
the builder. Or can be set explicitly by calling ConfigurationClientBuilder.serviceEndpoint(String).IllegalStateException - If ConfigurationClientBuilder.credentials(ConfigurationClientCredentials)
has not been set.public ConfigurationClientBuilder serviceEndpoint(String serviceEndpoint) throws MalformedURLException
serviceEndpoint - The URL of the Azure App Configuration instance to send ConfigurationSetting
service requests to and receive responses from.MalformedURLException - if serviceEndpoint is null or it cannot be parsed into a valid URL.public ConfigurationClientBuilder credentials(ConfigurationClientCredentials credentials)
serviceEndpoint for this ConfigurationClientBuilder.credentials - The credentials to use for authenticating HTTP requests.NullPointerException - If credentials is null.public ConfigurationClientBuilder httpLogDetailLevel(HttpLogDetailLevel logLevel)
logLevel - The amount of logging output when sending and receiving HTTP requests/responses.public ConfigurationClientBuilder addPolicy(HttpPipelinePolicy policy)
ConfigurationClient required policies.policy - The retry policy for service requests.NullPointerException - If policy is null.public ConfigurationClientBuilder httpClient(HttpClient client)
client - The HTTP client to use for requests.NullPointerException - If client is null.public ConfigurationClientBuilder pipeline(HttpPipeline pipeline)
pipeline is set, all other settings are ignored, aside from
serviceEndpoint to build ConfigurationClient.pipeline - The HTTP pipeline to use for sending service requests and receiving responses.public ConfigurationClientBuilder configuration(Configuration configuration)
Configuration.NONE to bypass using configuration settings during construction.configuration - The configuration store used toCopyright © 2019 Microsoft Corporation. All rights reserved.