Class Configuration

  • All Implemented Interfaces:
    Cloneable

    public class Configuration
    extends Object
    implements Cloneable
    Contains configuration information that is used during construction of client libraries.
    • Field Detail

      • PROPERTY_HTTP_PROXY

        public static final String PROPERTY_HTTP_PROXY
        URL of the proxy for HTTP connections.
        See Also:
        Constant Field Values
      • PROPERTY_HTTPS_PROXY

        public static final String PROPERTY_HTTPS_PROXY
        URL of the proxy for HTTPS connections.
        See Also:
        Constant Field Values
      • PROPERTY_IDENTITY_ENDPOINT

        public static final String PROPERTY_IDENTITY_ENDPOINT
        Endpoint to connect to when using Azure Active Directory managed service identity (MSI).
        See Also:
        Constant Field Values
      • PROPERTY_IDENTITY_HEADER

        public static final String PROPERTY_IDENTITY_HEADER
        Header when connecting to Azure Active Directory using managed service identity (MSI).
        See Also:
        Constant Field Values
      • PROPERTY_NO_PROXY

        public static final String PROPERTY_NO_PROXY
        A list of hosts or CIDR to not use proxy HTTP/HTTPS connections through.
        See Also:
        Constant Field Values
      • PROPERTY_MSI_ENDPOINT

        public static final String PROPERTY_MSI_ENDPOINT
        Endpoint to connect to when using Azure Active Directory managed service identity (MSI).
        See Also:
        Constant Field Values
      • PROPERTY_MSI_SECRET

        public static final String PROPERTY_MSI_SECRET
        Secret when connecting to Azure Active Directory using managed service identity (MSI).
        See Also:
        Constant Field Values
      • PROPERTY_AZURE_SUBSCRIPTION_ID

        public static final String PROPERTY_AZURE_SUBSCRIPTION_ID
        Subscription id to use when connecting to Azure resources.
        See Also:
        Constant Field Values
      • PROPERTY_AZURE_USERNAME

        public static final String PROPERTY_AZURE_USERNAME
        Username to use when performing username/password authentication with Azure.
        See Also:
        Constant Field Values
      • PROPERTY_AZURE_PASSWORD

        public static final String PROPERTY_AZURE_PASSWORD
        Username to use when performing username/password authentication with Azure.
        See Also:
        Constant Field Values
      • PROPERTY_AZURE_CLIENT_ID

        public static final String PROPERTY_AZURE_CLIENT_ID
        Client id to use when performing service principal authentication with Azure.
        See Also:
        Constant Field Values
      • PROPERTY_AZURE_CLIENT_SECRET

        public static final String PROPERTY_AZURE_CLIENT_SECRET
        Client secret to use when performing service principal authentication with Azure.
        See Also:
        Constant Field Values
      • PROPERTY_AZURE_TENANT_ID

        public static final String PROPERTY_AZURE_TENANT_ID
        Tenant id for the Azure resources.
        See Also:
        Constant Field Values
      • PROPERTY_AZURE_CLIENT_CERTIFICATE_PATH

        public static final String PROPERTY_AZURE_CLIENT_CERTIFICATE_PATH
        Path of a PEM certificate file to use when performing service principal authentication with Azure.
        See Also:
        Constant Field Values
      • PROPERTY_AZURE_IDENTITY_DISABLE_CP1

        public static final String PROPERTY_AZURE_IDENTITY_DISABLE_CP1
        Flag to disable the CP1 client capabilities in Azure Identity Token credentials.
        See Also:
        Constant Field Values
      • PROPERTY_AZURE_POD_IDENTITY_TOKEN_URL

        public static final String PROPERTY_AZURE_POD_IDENTITY_TOKEN_URL
        URL used by Bridge To Kubernetes to redirect IMDS calls in the development environment.
        See Also:
        Constant Field Values
      • PROPERTY_AZURE_REGIONAL_AUTHORITY_NAME

        public static final String PROPERTY_AZURE_REGIONAL_AUTHORITY_NAME
        Name of Azure AAD regional authority.
        See Also:
        Constant Field Values
      • PROPERTY_AZURE_RESOURCE_GROUP

        public static final String PROPERTY_AZURE_RESOURCE_GROUP
        Name of the Azure resource group.
        See Also:
        Constant Field Values
      • PROPERTY_AZURE_CLOUD

        public static final String PROPERTY_AZURE_CLOUD
        Name of the Azure cloud to connect to.
        See Also:
        Constant Field Values
      • PROPERTY_AZURE_AUTHORITY_HOST

        public static final String PROPERTY_AZURE_AUTHORITY_HOST
        The Azure Active Directory endpoint to connect to.
        See Also:
        Constant Field Values
      • PROPERTY_AZURE_TELEMETRY_DISABLED

        public static final String PROPERTY_AZURE_TELEMETRY_DISABLED
        Disables telemetry collection.
        See Also:
        Constant Field Values
      • PROPERTY_AZURE_LOG_LEVEL

        public static final String PROPERTY_AZURE_LOG_LEVEL
        Enables logging by setting a log level.
        See Also:
        Constant Field Values
      • PROPERTY_AZURE_HTTP_LOG_DETAIL_LEVEL

        public static final String PROPERTY_AZURE_HTTP_LOG_DETAIL_LEVEL
        Enables HTTP request/response logging by setting an HTTP log detail level.
        See Also:
        Constant Field Values
      • PROPERTY_AZURE_TRACING_DISABLED

        public static final String PROPERTY_AZURE_TRACING_DISABLED
        Disables tracing.
        See Also:
        Constant Field Values
      • PROPERTY_AZURE_REQUEST_RETRY_COUNT

        public static final String PROPERTY_AZURE_REQUEST_RETRY_COUNT
        Sets the default number of times a request will be retried, if it passes the conditions for retrying, before it fails.
        See Also:
        Constant Field Values
      • PROPERTY_AZURE_REQUEST_CONNECT_TIMEOUT

        public static final String PROPERTY_AZURE_REQUEST_CONNECT_TIMEOUT
        Sets the default timeout, in milliseconds, for a request to connect to the remote host.

        If the configured value is equal to or less than 0 no timeout will be applied.

        See Also:
        Constant Field Values
      • PROPERTY_AZURE_REQUEST_WRITE_TIMEOUT

        public static final String PROPERTY_AZURE_REQUEST_WRITE_TIMEOUT
        Sets the default timeout interval, in milliseconds, allowed between each byte written by a request.

        If the configured value is equal to or less than 0 no timeout will be applied.

        See Also:
        Constant Field Values
      • PROPERTY_AZURE_REQUEST_RESPONSE_TIMEOUT

        public static final String PROPERTY_AZURE_REQUEST_RESPONSE_TIMEOUT
        Sets the default timeout, in milliseconds, for a request to receive a response from the remote host.

        If the configured value is equal to or less than 0 no timeout will be applied.

        See Also:
        Constant Field Values
      • PROPERTY_AZURE_REQUEST_READ_TIMEOUT

        public static final String PROPERTY_AZURE_REQUEST_READ_TIMEOUT
        Sets the default timeout interval, in milliseconds, allowed between each byte read in a response.

        If the configured value is equal to or less than 0 no timeout will be applied.

        See Also:
        Constant Field Values
      • NONE

        public static final Configuration NONE
        No-op Configuration object used to opt out of using global configurations when constructing client libraries.
    • Constructor Detail

      • Configuration

        public Configuration()
        Constructs a configuration containing the known Azure properties constants.
    • Method Detail

      • getGlobalConfiguration

        public static Configuration getGlobalConfiguration()
        Gets the global configuration store shared by all client libraries.
        Returns:
        The global configuration store.
      • get

        public String get​(String name)
        Gets the value of the configuration.

        This method first checks the values previously loaded from the environment, if the configuration is found there it will be returned. Otherwise, this will attempt to load the value from the environment.

        Parameters:
        name - Name of the configuration.
        Returns:
        Value of the configuration if found, otherwise null.
      • get

        public <T> T get​(String name,
                         T defaultValue)
        Gets the value of the configuration converted to T.

        This method first checks the values previously loaded from the environment, if the configuration is found there it will be returned. Otherwise, this will attempt to load the value from the environment.

        If no configuration is found, the defaultValue is returned.

        Type Parameters:
        T - Type that the configuration is converted to if found.
        Parameters:
        name - Name of the configuration.
        defaultValue - Value to return if the configuration isn't found.
        Returns:
        The converted configuration if found, otherwise the default value is returned.
      • get

        public <T> T get​(String name,
                         Function<String,​T> converter)
        Gets the value of the configuration and converts it with the converter.

        This method first checks the values previously loaded from the environment, if the configuration is found there it will be returned. Otherwise, this will attempt to load the value from the environment.

        If no configuration is found the converter won't be called and null will be returned.

        Type Parameters:
        T - Type that the configuration is converted to if found.
        Parameters:
        name - Name of the configuration.
        converter - Converter used to map the configuration to T.
        Returns:
        The converted configuration if found, otherwise null.
      • put

        public Configuration put​(String name,
                                 String value)
        Adds a configuration with the given value.

        This will overwrite the previous configuration value if it existed.

        Parameters:
        name - Name of the configuration.
        value - Value of the configuration.
        Returns:
        The updated Configuration object.
      • remove

        public String remove​(String name)
        Removes the configuration.

        This returns the value of the configuration if it previously existed.

        Parameters:
        name - Name of the configuration.
        Returns:
        The configuration if it previously existed, otherwise null.
      • contains

        public boolean contains​(String name)
        Determines if the configuration exists.

        This only checks against values previously loaded into the Configuration object, this won't inspect the environment for containing the value.

        Parameters:
        name - Name of the configuration.
        Returns:
        True if the configuration exists, otherwise false.
      • clone

        public Configuration clone()
        Clones this Configuration object.
        Overrides:
        clone in class Object
        Returns:
        A clone of the Configuration object.