com.amazonaws.services.devicefarm.AWSDeviceFarmClient Java Examples

The following examples show how to use com.amazonaws.services.devicefarm.AWSDeviceFarmClient. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DeviceFarmClientFactory.java    From aws-device-farm-gradle-plugin with Apache License 2.0 6 votes vote down vote up
public AWSDeviceFarmClient initializeApiClient(final DeviceFarmExtension extension) {

        final String roleArn = extension.getAuthentication().getRoleArn();

        AWSCredentials credentials = extension.getAuthentication();

        if (roleArn != null) {
            final STSAssumeRoleSessionCredentialsProvider sts = new STSAssumeRoleSessionCredentialsProvider
                    .Builder(roleArn, RandomStringUtils.randomAlphanumeric(8))
                    .build();
            credentials = sts.getCredentials();
        }

        final ClientConfiguration clientConfiguration = new ClientConfiguration()
                .withUserAgent(String.format(extension.getUserAgent(), pluginVersion));

        AWSDeviceFarmClient apiClient = new AWSDeviceFarmClient(credentials, clientConfiguration);
        apiClient.setServiceNameIntern("devicefarm");
        if (extension.getEndpointOverride() != null) {
            apiClient.setEndpoint(extension.getEndpointOverride());
        }

        return apiClient;

    }
 
Example #2
Source File: DeviceFarmServer.java    From aws-device-farm-gradle-plugin with Apache License 2.0 5 votes vote down vote up
public DeviceFarmServer(final DeviceFarmExtension extension,
                        final Logger logger, final AWSDeviceFarmClient deviceFarmClient) throws IOException {

    this(extension, logger, deviceFarmClient,
            new DeviceFarmUploader(deviceFarmClient, logger),
            new DeviceFarmUtils(deviceFarmClient, extension));
}
 
Example #3
Source File: AWSDeviceFarm.java    From aws-device-farm-jenkins-plugin with Apache License 2.0 5 votes vote down vote up
/**
 * 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))
                .withRoleSessionDurationSeconds(MAX_ROLE_SESSION_TIMEOUT)
                .build();
        creds = sts.getCredentials();
    }

    ClientConfiguration clientConfiguration = new ClientConfiguration().withUserAgent("AWS Device Farm - Jenkins v1.0");
    api = new AWSDeviceFarmClient(creds, clientConfiguration);
    api.setServiceNameIntern("devicefarm");
}
 
Example #4
Source File: AWSService.java    From justtestlah with Apache License 2.0 4 votes vote down vote up
private AWSDeviceFarm buildClient(String awsAccessKey, String awsSecretKey, String awsRegion) {
  LOG.debug("Building AWS Device Farm client");
  LOG.debug("awsAccessKey={}", awsAccessKey);
  LOG.debug("awsSecretKey={}", awsSecretKey);
  LOG.debug("awsRegion={}", awsRegion);
  return AWSDeviceFarmClient.builder()
      .withCredentials(
          new AWSStaticCredentialsProvider(new BasicAWSCredentials(awsAccessKey, awsSecretKey)))
      .withRegion(awsRegion)
      .build();
}
 
Example #5
Source File: DeviceFarmUploader.java    From aws-device-farm-gradle-plugin with Apache License 2.0 4 votes vote down vote up
public DeviceFarmUploader(final AWSDeviceFarmClient api, final Logger logger) {
    this.api = api;
    this.logger = logger;
    this.uploadExecutor = Executors.newCachedThreadPool();
}