Skip to content

2.11 SDK configuration

jwebs1 edited this page Jul 6, 2015 · 2 revisions

SDK configuration

To use the SDK, you need to provide valid CenturyLink credentials.

Credential providers

You can select from several possible credential providers.

  • DefaultCredentialsProvider is a wrapper for other providers. It is used by default if the SDK default constructor is called.
  • EnvironmentVariableCredentialsProvider loads credentials from environment variables. The default property keys for the username and password are CLC_USERNAME and CLC_PASSWORD.
  • PropertiesFileCredentialsProvider loads user-credentials from a properties file located in the application's classpath. The default name of the classpath file is centurylink-cloud.properties.
  • StaticCredentialsProvider loads credentials directly through the constructor.
  • SystemVariableCredentialsProvider loads credentials from Java VM variables. The default property keys for the username and password are clc.username and clc.password.

Here is an example:

ClcSdk sdk = 
    new ClcSdk(
        new StaticCredentialsProvider("username", "password"),
        SdkConfiguration.builder()
            .maxRetries(10)
            .proxyHost("localhost")
            .proxyPort(8081)
            .proxyScheme("http")
            .proxyUsername("proxyUser")
            .proxyPassword("proxyPassword")
            .socketTimeout(5000)
            .build()
    );

SDK configuration properties

Additionally, you can provide the following configuration properties:

Name Type Description Required
maxRetries int The maximum allowed number of re-tries No
proxyHost String The proxy host name No
proxyPort int The proxy port. If it is specified, proxyHost must be specified too. No
proxyScheme String The proxy scheme (e.g. "http" or "https"). If it is specified, proxyHost must be specified too. The default value is "http". No
proxyUsername String The proxy user name No
proxyPassword String The proxy password No
socketTimeout long The socket timeout in milliseconds No