List of usage examples for com.amazonaws.auth BasicAWSCredentials BasicAWSCredentials
public BasicAWSCredentials(String accessKey, String secretKey)
From source file:com.streamsets.datacollector.credential.aws.secrets.manager.AWSSecretsManagerCredentialStore.java
License:Apache License
protected SecretCache createSecretCache(String awsAccessKey, String awsSecretKey, String region, int cacheSize, long cacheTTL) { AWSCredentialsProvider credentials = new AWSStaticCredentialsProvider( new BasicAWSCredentials(awsAccessKey, awsSecretKey)); AWSSecretsManagerClientBuilder clientBuilder = AWSSecretsManagerClientBuilder.standard().withRegion(region) .withCredentials(credentials); SecretCacheConfiguration cacheConf = new SecretCacheConfiguration().withMaxCacheSize(cacheSize) .withCacheItemTTL(cacheTTL).withClient(clientBuilder.build()); return new SecretCache(cacheConf); }
From source file:com.streamsets.datacollector.lib.emr.S3Manager.java
License:Apache License
private AmazonS3 getS3Client() { AWSCredentialsProvider credentialsProvider = new AWSStaticCredentialsProvider( new BasicAWSCredentials(pipelineEmrConfigs.getAccessKey(), pipelineEmrConfigs.getSecretKey())); AmazonS3 s3Client = AmazonS3ClientBuilder.standard().withRegion(pipelineEmrConfigs.getUserRegion()) .withCredentials(credentialsProvider).build(); return s3Client; }
From source file:com.streamsets.pipeline.lib.aws.AwsUtil.java
License:Apache License
public static AWSCredentialsProvider getCredentialsProvider(CredentialValue accessKeyId, CredentialValue secretKey) throws StageException { AWSCredentialsProvider credentialsProvider; if (accessKeyId != null && secretKey != null && !accessKeyId.get().isEmpty() && !secretKey.get().isEmpty()) { credentialsProvider = new AWSStaticCredentialsProvider( new BasicAWSCredentials(accessKeyId.get(), secretKey.get())); } else {//from w w w.ja v a 2 s .c om credentialsProvider = new DefaultAWSCredentialsProviderChain(); } return credentialsProvider; }
From source file:com.streamsets.pipeline.lib.aws.s3.S3Accessor.java
License:Apache License
AWSCredentialsProvider createCredentialsProvider() throws StageException { return new AWSStaticCredentialsProvider(new BasicAWSCredentials(credentialConfigs.getAccessKey().get(), credentialConfigs.getSecretKey().get())); }
From source file:com.streamsets.pipeline.stage.lib.aws.AWSUtil.java
License:Apache License
public static AWSCredentialsProvider getCredentialsProvider(AWSConfig config) { AWSCredentialsProvider credentialsProvider; if (!config.awsAccessKeyId.isEmpty() && !config.awsSecretAccessKey.isEmpty()) { credentialsProvider = new StaticCredentialsProvider( new BasicAWSCredentials(config.awsAccessKeyId, config.awsSecretAccessKey)); } else {//ww w. j a v a2 s . c om credentialsProvider = new DefaultAWSCredentialsProviderChain(); } return credentialsProvider; }
From source file:com.streamsets.pipeline.stage.origin.s3.S3Config.java
License:Apache License
private void validateConnection(Stage.Context context, List<Stage.ConfigIssue> issues) { //Access Key ID - username [unique in aws] //secret access key - password AWSCredentials credentials = new BasicAWSCredentials(accessKeyId, secretAccessKey); s3Client = new AmazonS3Client(credentials, new ClientConfiguration()); s3Client.setS3ClientOptions(new S3ClientOptions().withPathStyleAccess(true)); if (endPoint != null && !endPoint.isEmpty()) { s3Client.setEndpoint(endPoint);/* w ww . j a v a 2 s.c o m*/ } else { s3Client.setRegion(Region.getRegion(region)); } try { //check if the credentials are right by trying to list buckets s3Client.listBuckets(); } catch (AmazonS3Exception e) { issues.add(context.createConfigIssue(Groups.S3.name(), "accessKeyId", Errors.S3_SPOOLDIR_20, e.toString())); } }
From source file:com.swap.aws.elb.client.AWSHelper.java
License:Apache License
public AWSHelper(String awsAccessKey, String awsSecretKey, String availabilityZone, String region) { this.awsAccessKey = awsAccessKey; this.awsSecretKey = awsSecretKey; this.availabilityZone = availabilityZone; this.region = region; awsCredentials = new BasicAWSCredentials(awsAccessKey, awsSecretKey); clientConfiguration = new ClientConfiguration(); cloudWatchClient = new AmazonCloudWatchClient(awsCredentials, clientConfiguration); }
From source file:com.swf.common.ConfigHelper.java
License:Open Source License
public AmazonElasticMapReduce createEMRClient() { AWSCredentials emrAWSCredentials = new BasicAWSCredentials(this.emrAccessId, this.emrSecretKey); AmazonElasticMapReduce client = new AmazonElasticMapReduceClient(emrAWSCredentials); return client; }
From source file:com.swf.common.ConfigHelper.java
License:Open Source License
public AmazonRedshift createRedshiftClient() { AWSCredentials redshiftAWSCredentials = new BasicAWSCredentials(this.redshiftAccessId, this.redshiftSecretKey); AmazonRedshift client = new AmazonRedshiftClient(redshiftAWSCredentials); return client; }
From source file:com.swf.common.ConfigHelper.java
License:Open Source License
public AmazonS3 createS3Client() { AWSCredentials s3AWSCredentials = new BasicAWSCredentials(this.s3AccessId, this.s3SecretKey); return createS3Client(s3AWSCredentials); }