List of usage examples for com.amazonaws.auth BasicAWSCredentials BasicAWSCredentials
public BasicAWSCredentials(String accessKey, String secretKey)
From source file:com.netflix.bdp.s3mper.alert.impl.CloudWatchAlertDispatcher.java
License:Apache License
private void initCloudWatch(String keyId, String keySecret) { log.debug("Initializing CloudWatch Client"); cloudWatch = new AmazonCloudWatchAsyncClient(new BasicAWSCredentials(keyId, keySecret)); }
From source file:com.netflix.bdp.s3mper.alert.impl.CloudWatchAlertDispatcher.java
License:Apache License
private void initSqs(String keyId, String keySecret) { log.debug("Initializing SQS Client"); sqs = new AmazonSQSClient(new BasicAWSCredentials(keyId, keySecret)); //SQS Consistency Queue consistencyQueue = conf.get("s3mper.alert.sqs.queue", consistencyQueue); consistencyQueueUrl = sqs.getQueueUrl(new GetQueueUrlRequest(consistencyQueue)).getQueueUrl(); //SQS Timeout Queue timeoutQueue = conf.get("s3mper.timeout.sqs.queue", timeoutQueue); timeoutQueueUrl = sqs.getQueueUrl(new GetQueueUrlRequest(timeoutQueue)).getQueueUrl(); //SQS Notification Queue notificationQueue = conf.get("s3mper.notification.sqs.queue", notificationQueue); notificationQueueUrl = sqs.getQueueUrl(new GetQueueUrlRequest(notificationQueue)).getQueueUrl(); //Disable reporting (Testing purposes mostly) reportingDisabled = conf.getBoolean("s3mper.reporting.disabled", reportingDisabled); }
From source file:com.netflix.bdp.s3mper.cli.FileSystemVerifyCommand.java
License:Apache License
@Override public void execute(Configuration conf, String[] args) throws Exception { CmdLineParser parser = new CmdLineParser(this); String keyId = conf.get("fs.s3n.awsAccessKeyId"); String keySecret = conf.get("fs.s3n.awsSecretAccessKey"); s3 = new AmazonS3Client(new BasicAWSCredentials(keyId, keySecret)); try {//from w w w. j a va2 s. c om parser.parseArgument(args); ExecutorService executor = Executors.newFixedThreadPool(threads); List<Future> futures = new ArrayList<Future>(); BufferedReader fin = new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF8")); try { for (String line = fin.readLine(); line != null; line = fin.readLine()) { futures.add(executor.submit(new FileCheckTask(new Path(line.trim())))); } } finally { fin.close(); } for (Future f : futures) { f.get(); } executor.shutdown(); } catch (CmdLineException e) { System.err.println(e.getMessage()); System.err.println("s3mper fs verify [options]"); // print the list of available options parser.printUsage(System.err); System.err.println(); System.err.println(" Example: s3mper fs verify " + parser.printExample(OptionHandlerFilter.ALL)); } }
From source file:com.netflix.bdp.s3mper.metastore.impl.DynamoDBMetastore.java
License:Apache License
/** * Creates the metastore table in DynamoDB if it doesn't exist with the configured * read and write units.// w w w .ja va 2 s.c o m * * @param uri * @param conf * @throws Exception */ @Override public void initalize(URI uri, Configuration conf) throws Exception { scheme = uri.getScheme(); String keyId = conf.get("fs." + uri.getScheme() + ".awsAccessKeyId"); String keySecret = conf.get("fs." + uri.getScheme() + ".awsSecretAccessKey"); //An override option for accessing across accounts keyId = conf.get("s3mper.override.awsAccessKeyId", keyId); keySecret = conf.get("s3mper.override.awsSecretAccessKey", keySecret); db = new AmazonDynamoDBClient(new BasicAWSCredentials(keyId, keySecret)); readUnits = conf.getLong("s3mper.metastore.read.units", readUnits); writeUnits = conf.getLong("s3mper.metastore.write.units", writeUnits); retryCount = conf.getInt("s3mper.metastore.retry", retryCount); timeout = conf.getInt("s3mper.metastore.timeout", timeout); tableName = conf.get("s3mper.metastore.name", tableName); deleteMarkerEnabled = conf.getBoolean("s3mper.metastore.deleteMarker.enabled", false); boolean checkTableExists = conf.getBoolean("s3mper.metastore.create", false); if (checkTableExists) { ListTablesResult tables = db.listTables(); if (!tables.getTableNames().contains(tableName)) { createTable(); } } }
From source file:com.netflix.bdp.s3mper.metastore.impl.MetastoreJanitor.java
License:Apache License
public void initalize(URI uri, Configuration conf) throws Exception { String keyId = conf.get("fs." + uri.getScheme() + ".awsAccessKeyId"); String keySecret = conf.get("fs." + uri.getScheme() + ".awsSecretAccessKey"); //An override option for accessing across accounts keyId = conf.get("s3mper.override.awsAccessKeyId", keyId); keySecret = conf.get("s3mper.override.awsSecretAccessKey", keySecret); db = new AmazonDynamoDBClient(new BasicAWSCredentials(keyId, keySecret)); tableName = conf.get("s3mper.metastore.name", tableName); metastore = new DynamoDBMetastore(); metastore.initalize(uri, conf);//from w w w .ja v a 2s . com }
From source file:com.netflix.dynomitemanager.sidecore.aws.ClearCredential.java
License:Apache License
public AWSCredentials getCredentials() { return new BasicAWSCredentials(getAccessKeyId(), getSecretAccessKey()); }
From source file:com.netflix.eureka.aws.AwsAsgUtil.java
License:Apache License
private AmazonAutoScaling getAmazonAutoScalingClient() { String aWSAccessId = serverConfig.getAWSAccessId(); String aWSSecretKey = serverConfig.getAWSSecretKey(); ClientConfiguration clientConfiguration = new ClientConfiguration() .withConnectionTimeout(serverConfig.getASGQueryTimeoutMs()); if (null != aWSAccessId && !"".equals(aWSAccessId) && null != aWSSecretKey && !"".equals(aWSSecretKey)) { return new AmazonAutoScalingClient(new BasicAWSCredentials(aWSAccessId, aWSSecretKey), clientConfiguration);/*w w w. j a v a2s. co m*/ } else { return new AmazonAutoScalingClient(new InstanceProfileCredentialsProvider(), clientConfiguration); } }
From source file:com.netflix.eureka.aws.EIPManager.java
License:Apache License
/** * Gets the EC2 service object to call AWS APIs. * * @return the EC2 service object to call AWS APIs. *//*from ww w .ja va2 s. c o m*/ private AmazonEC2 getEC2Service() { String aWSAccessId = serverConfig.getAWSAccessId(); String aWSSecretKey = serverConfig.getAWSSecretKey(); AmazonEC2 ec2Service; if (null != aWSAccessId && !"".equals(aWSAccessId) && null != aWSSecretKey && !"".equals(aWSSecretKey)) { ec2Service = new AmazonEC2Client(new BasicAWSCredentials(aWSAccessId, aWSSecretKey)); } else { ec2Service = new AmazonEC2Client(new InstanceProfileCredentialsProvider()); } String region = clientConfig.getRegion(); region = region.trim().toLowerCase(); ec2Service.setEndpoint("ec2." + region + ".amazonaws.com"); return ec2Service; }
From source file:com.netflix.eureka.util.AwsAsgUtil.java
License:Apache License
private static AmazonAutoScaling getAmazonAutoScalingClient() { String aWSAccessId = eurekaConfig.getAWSAccessId(); String aWSSecretKey = eurekaConfig.getAWSSecretKey(); ClientConfiguration clientConfiguration = new ClientConfiguration() .withConnectionTimeout(eurekaConfig.getASGQueryTimeoutMs()); if (null != aWSAccessId && !"".equals(aWSAccessId) && null != aWSSecretKey && !"".equals(aWSSecretKey)) { return new AmazonAutoScalingClient(new BasicAWSCredentials(aWSAccessId, aWSSecretKey), clientConfiguration);//from w w w . j a v a 2 s . c o m } else { return new AmazonAutoScalingClient(new InstanceProfileCredentialsProvider(), clientConfiguration); } }
From source file:com.netflix.eureka.util.EIPManager.java
License:Apache License
/** * Gets the EC2 service object to call AWS APIs. * * @return the EC2 service object to call AWS APIs. *///from www . j av a2s .c o m private AmazonEC2 getEC2Service() { eurekaConfig = EurekaServerConfigurationManager.getInstance().getConfiguration(); String aWSAccessId = eurekaConfig.getAWSAccessId(); String aWSSecretKey = eurekaConfig.getAWSSecretKey(); AmazonEC2 ec2Service; if (null != aWSAccessId && !"".equals(aWSAccessId) && null != aWSSecretKey && !"".equals(aWSSecretKey)) { ec2Service = new AmazonEC2Client(new BasicAWSCredentials(aWSAccessId, aWSSecretKey)); } else { ec2Service = new AmazonEC2Client(new InstanceProfileCredentialsProvider()); } String region = DiscoveryManager.getInstance().getEurekaClientConfig().getRegion(); region = region.trim().toLowerCase(); ec2Service.setEndpoint("ec2." + region + ".amazonaws.com"); return ec2Service; }