Example usage for com.amazonaws SDKGlobalConfiguration ALTERNATE_ACCESS_KEY_ENV_VAR

List of usage examples for com.amazonaws SDKGlobalConfiguration ALTERNATE_ACCESS_KEY_ENV_VAR

Introduction

In this page you can find the example usage for com.amazonaws SDKGlobalConfiguration ALTERNATE_ACCESS_KEY_ENV_VAR.

Prototype

String ALTERNATE_ACCESS_KEY_ENV_VAR

To view the source code for com.amazonaws SDKGlobalConfiguration ALTERNATE_ACCESS_KEY_ENV_VAR.

Click Source Link

Document

Alternate environment variable name for the AWS access key ID

Usage

From source file:org.apache.usergrid.persistence.queue.impl.UsergridAwsCredentials.java

License:Apache License

@Override
public String getAWSAccessKeyId() {
    String accessKey = System.getProperty(SDKGlobalConfiguration.ACCESS_KEY_ENV_VAR);
    if (StringUtils.isEmpty(accessKey)) {
        accessKey = System.getProperty(SDKGlobalConfiguration.ALTERNATE_ACCESS_KEY_ENV_VAR);
    }/*w w  w .j  ava2 s . c o m*/
    return StringUtils.trim(accessKey);
}

From source file:org.apache.usergrid.persistence.queue.impl.UsergridAwsCredentials.java

License:Apache License

public String getAWSAccessKeyIdJson(Map<String, Object> jsonObject) {
    String accessKey = (String) jsonObject.get(SDKGlobalConfiguration.ACCESS_KEY_ENV_VAR);
    if (StringUtils.isEmpty(accessKey)) {
        accessKey = (String) jsonObject.get(SDKGlobalConfiguration.ALTERNATE_ACCESS_KEY_ENV_VAR);
    }//from   w ww.  j  a  va  2  s.  c o  m

    if (StringUtils.isEmpty(accessKey)) {
        throw new AmazonClientException("Could not get aws access key from json object.");
    }

    return StringUtils.trim(accessKey);
}