Class LogsIngestionClientBuilder
java.lang.Object
com.azure.monitor.ingestion.LogsIngestionClientBuilder
- All Implemented Interfaces:
com.azure.core.client.traits.ConfigurationTrait<LogsIngestionClientBuilder>, com.azure.core.client.traits.EndpointTrait<LogsIngestionClientBuilder>, com.azure.core.client.traits.HttpTrait<LogsIngestionClientBuilder>, com.azure.core.client.traits.TokenCredentialTrait<LogsIngestionClientBuilder>
public final class LogsIngestionClientBuilder
extends Object
implements com.azure.core.client.traits.ConfigurationTrait<LogsIngestionClientBuilder>, com.azure.core.client.traits.HttpTrait<LogsIngestionClientBuilder>, com.azure.core.client.traits.EndpointTrait<LogsIngestionClientBuilder>, com.azure.core.client.traits.TokenCredentialTrait<LogsIngestionClientBuilder>
Fluent builder for creating instances of
LogsIngestionClient and LogsIngestionAsyncClient. The
builder provides various options to customize the client as per your requirements.
There are two required properties that should be set to build a client:
endpoint- The data collection endpoint. Seeendpointmethod for more details.credential- The AAD authentication credential that has the "Monitoring Metrics Publisher" role assigned to it. Azure Identity provides a variety of AAD credential types that can be used. Seecredentialmethod for more details.
Instantiating an asynchronous Logs ingestion client
LogsIngestionAsyncClient logsIngestionAsyncClient = new LogsIngestionClientBuilder()
.credential(tokenCredential)
.endpoint("<data-collection-endpoint>")
.buildAsyncClient();
Instantiating a synchronous Logs ingestion client
LogsIngestionClient logsIngestionClient = new LogsIngestionClientBuilder()
.credential(tokenCredential)
.endpoint("<data-collection-endpoint>")
.buildClient();
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddPolicy(com.azure.core.http.policy.HttpPipelinePolicy customPolicy) audience(LogsIngestionAudience audience) Sets the audience for the authorization scope of log ingestion clients.Creates an asynchronous client with the configured options in this builder.Creates a synchronous client with the configured options in this builder.clientOptions(com.azure.core.util.ClientOptions clientOptions) configuration(com.azure.core.util.Configuration configuration) credential(com.azure.core.credential.TokenCredential tokenCredential) Sets the AAD authentication credential that has the "Monitoring Metrics Publisher" role assigned to it.Sets the data collection endpoint.httpClient(com.azure.core.http.HttpClient httpClient) httpLogOptions(com.azure.core.http.policy.HttpLogOptions httpLogOptions) pipeline(com.azure.core.http.HttpPipeline pipeline) retryOptions(com.azure.core.http.policy.RetryOptions retryOptions) retryPolicy(com.azure.core.http.policy.RetryPolicy retryPolicy) Sets The retry policy that will attempt to retry failed requests, if applicable.serviceVersion(LogsIngestionServiceVersion serviceVersion) The service version to use when creating the client.
-
Constructor Details
-
LogsIngestionClientBuilder
public LogsIngestionClientBuilder()Creates a new instance ofLogsIngestionClientBuilder.
-
-
Method Details
-
endpoint
Sets the data collection endpoint.- Specified by:
endpointin interfacecom.azure.core.client.traits.EndpointTrait<LogsIngestionClientBuilder>- Parameters:
endpoint- the data collection endpoint.- Returns:
- the updated
LogsIngestionClientBuilder.
-
pipeline
- Specified by:
pipelinein interfacecom.azure.core.client.traits.HttpTrait<LogsIngestionClientBuilder>
-
httpClient
- Specified by:
httpClientin interfacecom.azure.core.client.traits.HttpTrait<LogsIngestionClientBuilder>
-
configuration
- Specified by:
configurationin interfacecom.azure.core.client.traits.ConfigurationTrait<LogsIngestionClientBuilder>
-
httpLogOptions
public LogsIngestionClientBuilder httpLogOptions(com.azure.core.http.policy.HttpLogOptions httpLogOptions) - Specified by:
httpLogOptionsin interfacecom.azure.core.client.traits.HttpTrait<LogsIngestionClientBuilder>
-
retryPolicy
Sets The retry policy that will attempt to retry failed requests, if applicable.- Parameters:
retryPolicy- the retryPolicy value.- Returns:
- the updated
LogsIngestionClientBuilder.
-
addPolicy
public LogsIngestionClientBuilder addPolicy(com.azure.core.http.policy.HttpPipelinePolicy customPolicy) - Specified by:
addPolicyin interfacecom.azure.core.client.traits.HttpTrait<LogsIngestionClientBuilder>
-
retryOptions
public LogsIngestionClientBuilder retryOptions(com.azure.core.http.policy.RetryOptions retryOptions) - Specified by:
retryOptionsin interfacecom.azure.core.client.traits.HttpTrait<LogsIngestionClientBuilder>
-
credential
public LogsIngestionClientBuilder credential(com.azure.core.credential.TokenCredential tokenCredential) Sets the AAD authentication credential that has the "Monitoring Metrics Publisher" role assigned to it. Azure Identity provides a variety of AAD credential types that can be used.- Specified by:
credentialin interfacecom.azure.core.client.traits.TokenCredentialTrait<LogsIngestionClientBuilder>- Parameters:
tokenCredential- the tokenCredential value.- Returns:
- the updated
LogsIngestionClientBuilder.
-
audience
Sets the audience for the authorization scope of log ingestion clients. If this value is not set, the default audience will be the azure public cloud.- Parameters:
audience- the audience value.- Returns:
- the updated
LogsIngestionClientBuilder.
-
clientOptions
- Specified by:
clientOptionsin interfacecom.azure.core.client.traits.HttpTrait<LogsIngestionClientBuilder>
-
serviceVersion
The service version to use when creating the client. By default, the latest service version is used. This is the value returned by thegetLatestmethod.- Parameters:
serviceVersion- TheLogsIngestionServiceVersion.- Returns:
- the updated
LogsIngestionClientBuilder.
-
buildClient
Creates a synchronous client with the configured options in this builder.- Returns:
- A synchronous
LogsIngestionClient.
-
buildAsyncClient
Creates an asynchronous client with the configured options in this builder.- Returns:
- An asynchronous
LogsIngestionAsyncClient.
-