Example usage for com.amazonaws.auth BasicAWSCredentials BasicAWSCredentials

List of usage examples for com.amazonaws.auth BasicAWSCredentials BasicAWSCredentials

Introduction

In this page you can find the example usage for com.amazonaws.auth BasicAWSCredentials BasicAWSCredentials.

Prototype

public BasicAWSCredentials(String accessKey, String secretKey) 

Source Link

Document

Constructs a new BasicAWSCredentials object, with the specified AWS access key and AWS secret key.

Usage

From source file:com.tracermedia.maven.plugins.AbstractBeanstalkMojo.java

License:Open Source License

protected AmazonS3Client getS3Client() {
    if (_s3Client == null) {
        AWSCredentials cred = new BasicAWSCredentials(accessKey, secretKey);
        _s3Client = new AmazonS3Client(cred);
    }//from w  ww.  j  a v a 2s  . c o m
    return _s3Client;
}

From source file:com.travoca.app.utils.amazon.UploadService.java

License:Apache License

@Override
public void onCreate() {
    super.onCreate();
    //      android.os.Debug.waitForDebugger();
    s3Client = new AmazonS3Client(
            new BasicAWSCredentials(getString(R.string.s3_access_key), getString(R.string.s3_secret)));
    nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);

    IntentFilter f = new IntentFilter();
    f.addAction(UPLOAD_CANCELLED_ACTION);
    registerReceiver(uploadCancelReceiver, f);
}

From source file:com.treasure_data.td_import.source.S3Source.java

License:Apache License

static AmazonS3Client createAmazonS3Client(SourceDesc desc) {
    String accessKey = desc.getUser();
    if (accessKey == null || accessKey.isEmpty()) {
        throw new IllegalArgumentException("S3 AccessKey is null or empty.");
    }/*from  w  ww  . j  a v  a2 s .co  m*/
    String secretAccessKey = desc.getPassword();
    if (secretAccessKey == null || secretAccessKey.isEmpty()) {
        throw new IllegalArgumentException("S3 SecretAccessKey is null or empty.");
    }
    AWSCredentials credentials = new BasicAWSCredentials(accessKey, secretAccessKey);

    ClientConfiguration conf = new ClientConfiguration();
    conf.setProtocol(Configuration.BI_PREPARE_S3_PROTOCOL);
    conf.setMaxConnections(Configuration.BI_PREPARE_S3_MAX_CONNECTIONS);
    conf.setMaxErrorRetry(Configuration.BI_PREPARE_S3_MAX_ERRORRETRY);
    conf.setSocketTimeout(Configuration.BI_PREPARE_S3_SOCKET_TIMEOUT);

    return new AmazonS3Client(credentials, conf);
}

From source file:com.tremolosecurity.provisioning.core.providers.AmazonSimpleDBProvider.java

License:Apache License

@Override
public void init(Map<String, Attribute> cfg, ConfigManager cfgMgr, String name) throws ProvisioningException {

    this.name = name;

    this.cfgMgr = cfgMgr;
    this.userDomain = cfg.get("userDomain").getValues().get(0);
    this.groupDomain = cfg.get("groupDomain").getValues().get(0);

    this.accessKey = cfg.get("accessKey").getValues().get(0);
    this.secretKey = cfg.get("secretKey").getValues().get(0);
    this.uidAttrName = cfg.get("uidAttributeName").getValues().get(0);

    sdb = new AmazonSimpleDBClient(new BasicAWSCredentials(accessKey, secretKey));

}

From source file:com.tremolosecurity.provisioning.jms.providers.AwsSqsConnectionFactory.java

License:Apache License

@Override
public Connection createConnection() throws JMSException {
    Builder builder = null;/* ww  w.j  a  v a 2 s  .c o  m*/

    if (this.accessKey == null || this.accessKey.isEmpty()) {
        builder = SQSConnectionFactory.builder();
    } else {
        builder = SQSConnectionFactory.builder().withAWSCredentialsProvider(
                new StaticCredentialsProvider(new BasicAWSCredentials(this.accessKey, this.secretKey)));
    }

    if (this.regionName != null && !this.regionName.isEmpty()) {
        builder = builder.withRegionName(regionName);
    }

    this.factory = builder.build();

    return factory.createConnection();
}

From source file:com.tremolosecurity.proxy.myvd.inserts.amazon.AmazonDynamoDB.java

License:Apache License

@Override
public void configure(String name, Properties props, NameSpace ns) throws LDAPException {
    this.name = name;
    this.accessKey = props.getProperty("accessKey");
    this.secretKey = props.getProperty("secretKey");
    this.userTable = props.getProperty("userTable");
    this.groupTable = props.getProperty("groupTable");

    this.userDN = new DN("ou=users," + ns.getBase().getDN().toString());
    this.groupDN = new DN("ou=groups," + ns.getBase().getDN().toString());
    this.baseDN = new DN(ns.getBase().getDN().toString());

    this.db = new AmazonDynamoDBClient(new BasicAWSCredentials(accessKey, secretKey));

}

From source file:com.tremolosecurity.proxy.myvd.inserts.amazon.AmazonSimpleDB.java

License:Apache License

@Override
public void configure(String name, Properties props, NameSpace ns) throws LDAPException {
    this.name = name;
    this.accessKey = props.getProperty("accessKey");
    this.secretKey = props.getProperty("secretKey");
    this.userDomain = props.getProperty("userDomain");
    this.groupDomain = props.getProperty("groupDomain");

    this.userDN = new DN("ou=users," + ns.getBase().getDN().toString());
    this.groupDN = new DN("ou=groups," + ns.getBase().getDN().toString());
    this.baseDN = new DN(ns.getBase().getDN().toString());

    this.sdb = new AmazonSimpleDBClient(new BasicAWSCredentials(accessKey, secretKey));

}

From source file:com.tremolosecurity.unison.proxy.filters.s3.AwsS3Proxy.java

License:Apache License

@Override
public void initFilter(HttpFilterConfig config) throws Exception {
    this.accessKey = this.getConfigAttr(config, "accessKey");
    logger.info("Access Key : ************");
    this.secretKey = this.getConfigAttr(config, "secretKey");
    logger.info("Secret Key : *************");
    this.topBucket = "/" + this.getConfigAttr(config, "topBucket") + "/";
    logger.info("Top Bucket : '" + this.topBucket + "'");

    this.s3Client = new AmazonS3Client(new BasicAWSCredentials(this.accessKey, this.secretKey));
}

From source file:com.tuprofe.api.SQSConfig.java

@Bean
public BasicAWSCredentials basicAWSCredentials() {
    return new BasicAWSCredentials(amazonAWSAccessKey, amazonAWSSecretKey);
}

From source file:com.tvarit.plugin.AutoScalingMojo.java

License:Open Source License

@Override
public void execute() throws MojoExecutionException, MojoFailureException {
    getLog().debug("Starting " + this.getClass().getSimpleName() + " execution ");
    final BasicAWSCredentials awsCredentials = new BasicAWSCredentials(accessKey, secretKey);
    AmazonS3Client amazonS3Client = new AmazonS3Client(awsCredentials);
    final MavenProject project = (MavenProject) this.getPluginContext().getOrDefault("project", null);
    String lambdaCodeS3Bucket = this.bucketName;
    if (lambdaCodeS3Key == null) {
        lambdaCodeS3Key = new LambdaS3BucketKeyMaker().makeKey(project);
        lambdaCodeS3Bucket = "tvarit";
    }//ww w .  j a  v  a2  s .  co  m
    AmazonCloudFormationClient amazonCloudFormationClient = new AmazonCloudFormationClient(awsCredentials);
    AmazonEC2Client amazonEC2Client = new AmazonEC2Client(awsCredentials);
    List<com.amazonaws.services.cloudformation.model.Parameter> allParams = new AsgParameterMaker().make(
            amazonEC2Client, amazonCloudFormationClient, project, projectName, lambdaCodeS3Key,
            lambdaCodeS3Bucket);
    final String stackName = projectName + "-asg";
    if (templateUrl == null)
        try {
            templateUrl = new TemplateUrlMaker().makeUrl(project, "autoscaling.template").toString();
        } catch (MalformedURLException e) {
            throw new MojoExecutionException(
                    "Could not create default url for templates. Please open an issue on github.", e);
        }
    final CreateStackRequest createStackRequest = new CreateStackRequest()
            .withCapabilities(Capability.CAPABILITY_IAM).withStackName(stackName).withParameters(allParams)
            .withTemplateURL(templateUrl);
    final Stack stack = new StackMaker().makeStack(createStackRequest, amazonCloudFormationClient, getLog());
    new S3WarUploadEventToInvokeLambdaMaker().make(amazonS3Client, bucketName, stack);
    getLog().info("Finished completing stack");

}