MetricsQueryClientBuilder Class
- java.
lang. Object - com.
azure. monitor. query. MetricsQueryClientBuilder
- com.
Implements
public final class MetricsQueryClientBuilder
implements EndpointTrait<MetricsQueryClientBuilder>, HttpTrait<MetricsQueryClientBuilder>, ConfigurationTrait<MetricsQueryClientBuilder>, TokenCredentialTrait<MetricsQueryClientBuilder>
Fluent builder for creating instances of MetricsQueryClient and MetricsQueryAsyncClient.
The MetricsQueryClientBuilder is responsible for authenticating a building instances of MetricsQueryClient and MetricsQueryAsyncClient. Customizations can be applied to clients through the builder using the various options available.
Getting Started
To create instances of the clients, sufficient authentication credentials are required. TokenCredential is a common form of authentication. The resource / workspace is not required for client creation, but the authentication credentials must have access to the resources / workspaces utilized by the client.
Client Builder Usage
The following sample shows instantiating an asynchronous Metrics query Client using Token Credential
MetricsQueryAsyncClient metricsQueryAsyncClient = new MetricsQueryClientBuilder()
.credential(tokenCredential)
.buildAsyncClient();
The following sample shows instantiating a synchronous Metrics query Client using Token Credential
MetricsQueryClient metricsQueryClient = new MetricsQueryClientBuilder()
.credential(tokenCredential)
.buildClient();
For more information about the other types of credentials that can be used to authenticate your client, please see this documentation: Azure Identity
Constructor Summary
Constructor | Description |
---|---|
MetricsQueryClientBuilder() |
Creates an instance of Metrics |
Method Summary
Methods inherited from java.lang.Object
Constructor Details
MetricsQueryClientBuilder
public MetricsQueryClientBuilder()
Creates an instance of MetricsQueryClientBuilder.
Method Details
addPolicy
public MetricsQueryClientBuilder addPolicy(HttpPipelinePolicy customPolicy)
Adds a custom Http pipeline policy.
Parameters:
Returns:
buildAsyncClient
public MetricsQueryAsyncClient buildAsyncClient()
Creates an asynchronous client with the configured options in this builder.
Returns:
buildClient
public MetricsQueryClient buildClient()
Creates a synchronous client with the configured options in this builder.
Returns:
clientOptions
public MetricsQueryClientBuilder clientOptions(ClientOptions clientOptions)
Set the ClientOptions used for creating the client.
Parameters:
Returns:
configuration
public MetricsQueryClientBuilder configuration(Configuration configuration)
Sets The configuration store that is used during construction of the service client.
Parameters:
Returns:
credential
public MetricsQueryClientBuilder credential(TokenCredential tokenCredential)
Sets The TokenCredential used for authentication.
Parameters:
Returns:
endpoint
public MetricsQueryClientBuilder endpoint(String endpoint)
Sets the metrics query endpoint.
Parameters:
Returns:
httpClient
public MetricsQueryClientBuilder httpClient(HttpClient httpClient)
Sets The HTTP client used to send the request.
Parameters:
Returns:
httpLogOptions
public MetricsQueryClientBuilder httpLogOptions(HttpLogOptions httpLogOptions)
Sets The logging configuration for HTTP requests and responses.
Parameters:
Returns:
pipeline
public MetricsQueryClientBuilder pipeline(HttpPipeline pipeline)
Sets The HTTP pipeline to send requests through.
Parameters:
Returns:
retryOptions
public MetricsQueryClientBuilder retryOptions(RetryOptions retryOptions)
Sets the RetryOptions used for creating the client.
Parameters:
Returns:
retryPolicy
public MetricsQueryClientBuilder retryPolicy(RetryPolicy retryPolicy)
Sets The retry policy that will attempt to retry failed requests, if applicable.
Parameters:
Returns:
serviceVersion
public MetricsQueryClientBuilder serviceVersion(MetricsQueryServiceVersion serviceVersion)
The service version to use when creating the client.
Parameters:
Returns: