io.github.carousell.testrails.services.AWSDynamoService Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of testrail-maven-plugin Show documentation
Show all versions of testrail-maven-plugin Show documentation
Creates a new test run or update an existed test run for a given test plan and returns its id as a parameter for subsequent plugin executions
The newest version!
package io.github.carousell.testrails.services;
import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.AWSCredentialsProvider;
import com.amazonaws.auth.AWSStaticCredentialsProvider;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.services.dynamodbv2.AmazonDynamoDB;
import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClientBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Service class to interact with AWS Dynamo DB, basically a wrapper around {@link AmazonDynamoDB}.
*/
public class AWSDynamoService {
private static final Logger LOG = LoggerFactory.getLogger(AWSDynamoService.class);
private AmazonDynamoDB awsDynamoDB;
/**
* Constructor
*
* @param awsAccessKey the AWS access key
* @param awsSecretKey the AWS secret key
* @param awsRegion the AWS region
*/
public AWSDynamoService(String awsAccessKey, String awsSecretKey, String awsRegion) {
awsDynamoDB = buildDynamoClient(awsAccessKey, awsSecretKey, awsRegion);
}
/** @return {@link AmazonDynamoDB} */
public AmazonDynamoDB getAwsDynamo() {
return awsDynamoDB;
}
private AmazonDynamoDB buildDynamoClient(String awsAccessKey, String awsSecretKey, String awsRegion) {
LOG.debug("[buildDynamoClient] Building AWS Device Farm client");
LOG.debug("[buildDynamoClient] awsAccessKey={}", awsAccessKey);
LOG.debug("[buildDynamoClient] awsSecretKey={}", awsSecretKey);
LOG.debug("[buildDynamoClient] awsRegion={}", awsRegion);
AWSCredentials awsCredentials = new BasicAWSCredentials(awsAccessKey, awsSecretKey);
AWSCredentialsProvider awsCredentialsProvider = new AWSStaticCredentialsProvider(awsCredentials);
AmazonDynamoDB dynamoDBClient = AmazonDynamoDBClientBuilder
.standard()
.withCredentials(awsCredentialsProvider)
.withRegion(awsRegion)
.build();
return dynamoDBClient;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy