Package com.azure.core.util
Class ClientOptions
- java.lang.Object
-
- com.azure.core.util.ClientOptions
-
- Direct Known Subclasses:
HttpClientOptions
public class ClientOptions extends Object
General configuration options for clients.
-
-
Constructor Summary
Constructors Constructor Description ClientOptions()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getApplicationId()
Gets the application ID.Iterable<Header>
getHeaders()
Gets theHeaders
.ClientOptions
setApplicationId(String applicationId)
Sets the application ID.ClientOptions
setHeaders(Iterable<Header> headers)
Sets theHeaders
.
-
-
-
Method Detail
-
getApplicationId
public String getApplicationId()
Gets the application ID.- Returns:
- The application ID.
-
setApplicationId
public ClientOptions setApplicationId(String applicationId)
Sets the application ID.The
applicationId
is used to configureUserAgentPolicy
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:
applicationId
- The application ID.- Returns:
- The updated ClientOptions object.
- Throws:
IllegalArgumentException
- IfapplicationId
contains spaces or is larger than 24 characters in length.
-
setHeaders
public ClientOptions setHeaders(Iterable<Header> headers)
Sets theHeaders
.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:
headers
- The headers.- Returns:
- The updated ClientOptions object.
-
-