ClientOptions Class
- java.
lang. Object - com.
azure. core. util. ClientOptions
- com.
public class ClientOptions
General configuration options for clients.
Constructor Summary
Constructor | Description |
---|---|
ClientOptions() |
Creates a new instance of ClientOptions. |
Method Summary
Modifier and Type | Method and Description |
---|---|
String |
getApplicationId()
Gets the application ID. |
Iterable<Header> |
getHeaders()
Gets the Header. |
Metrics |
getMetricsOptions()
Gets MetricsOptions |
Tracing |
getTracingOptions()
Gets TracingOptions |
Client |
setApplicationId(String applicationId)
Sets the application ID. |
Client |
setHeaders(Iterable<Header> headers)
Sets the Header. |
Client |
setMetricsOptions(MetricsOptions metricsOptions)
Sets MetricsOptions that are applied to each metric reported by the client. |
Client |
setTracingOptions(TracingOptions tracingOptions)
Sets TracingOptions that are applied to each tracing reported by the client. |
Methods inherited from java.lang.Object
Constructor Details
ClientOptions
public ClientOptions()
Creates a new instance of ClientOptions.
Method Details
getApplicationId
public String getApplicationId()
Gets the application ID.
Returns:
getHeaders
getMetricsOptions
public MetricsOptions getMetricsOptions()
Gets MetricsOptions
Returns:
null
is returned.getTracingOptions
public TracingOptions getTracingOptions()
Gets TracingOptions
Returns:
null
is returned.setApplicationId
public ClientOptions setApplicationId(String applicationId)
Sets the application ID.
The applicationId
is used to configure UserAgentPolicy for telemetry/monitoring purposes.
See Azure Core: Telemetry policy for additional information.
Code Samples
Create ClientOptions with application ID 'myApplicationId'
ClientOptions clientOptions = new ClientOptions()
.setApplicationId("myApplicationId");
Parameters:
Returns:
setHeaders
public ClientOptions setHeaders(Iterable
Sets the Header.
The passed headers are applied to each request sent with the client.
This overwrites all previously set headers.
Code Samples
Create ClientOptions with Header 'myCustomHeader':'myStaticValue'
ClientOptions clientOptions = new ClientOptions()
.setHeaders(Collections.singletonList(new Header("myCustomHeader", "myStaticValue")));
Parameters:
Returns:
setMetricsOptions
public ClientOptions setMetricsOptions(MetricsOptions metricsOptions)
Sets MetricsOptions that are applied to each metric reported by the client. Use metrics options to enable and disable metrics or pass implementation-specific configuration.
Parameters:
Returns:
setTracingOptions
public ClientOptions setTracingOptions(TracingOptions tracingOptions)
Sets TracingOptions that are applied to each tracing reported by the client. Use tracing options to enable and disable tracing or pass implementation-specific configuration.
Parameters:
Returns:
Applies to
Azure SDK for Java