Class ClientOptions

  • Direct Known Subclasses:
    HttpClientOptions

    public class ClientOptions
    extends Object
    General configuration options for clients.
    • Constructor Detail

      • ClientOptions

        public ClientOptions()
    • 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 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:
        applicationId - The application ID.
        Returns:
        The updated ClientOptions object.
        Throws:
        IllegalArgumentException - If applicationId contains spaces or is larger than 24 characters in length.
      • setHeaders

        public ClientOptions setHeaders​(Iterable<Header> headers)
        Sets the Headers.

        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.
      • getHeaders

        public Iterable<Header> getHeaders()
        Gets the Headers.
        Returns:
        The Headers, if headers weren't set previously an empty list is returned.