/** * Private AWSDeviceFarm constructor. Uses the roleArn to generate STS creds if the roleArn isn't null; otherwise * just uses the AWSCredentials creds. * * @param creds AWSCredentials creds to use for authentication. * @param roleArn Role ARN to use for authentication. */ private AWSDeviceFarm(AWSCredentials creds, String roleArn) { if (roleArn != null) { STSAssumeRoleSessionCredentialsProvider sts = new STSAssumeRoleSessionCredentialsProvider .Builder(roleArn, RandomStringUtils.randomAlphanumeric(8)) .build(); creds = sts.getCredentials(); } ClientConfiguration clientConfiguration = new ClientConfiguration().withUserAgent("AWS Device Farm - Jenkins v1.0"); api = new AWSDeviceFarmClient(creds, clientConfiguration); api.setServiceNameIntern("devicefarm"); }