List of usage examples for com.amazonaws.auth.profile ProfileCredentialsProvider ProfileCredentialsProvider
public ProfileCredentialsProvider()
From source file:com.zhang.aws.s3.S3TransferProgressSample.java
License:Open Source License
public static void main(String[] args) throws Exception { /*//from www . j a va 2 s .com * The ProfileCredentialsProvider will return your [default] * credential profile by reading from the credentials file located at * (~/.aws/credentials). * * TransferManager manages a pool of threads, so we create a * single instance and share it throughout our application. */ try { credentials = new ProfileCredentialsProvider().getCredentials(); } catch (Exception e) { throw new AmazonClientException("Cannot load the credentials from the credential profiles file. " + "Please make sure that your credentials file is at the correct " + "location (~/.aws/credentials), and is in valid format.", e); } AmazonS3 s3 = new AmazonS3Client(credentials); Region usWest2 = Region.getRegion(Regions.US_WEST_2); s3.setRegion(usWest2); tx = new TransferManager(s3); bucketName = "s3-upload-sdk-sample-" + credentials.getAWSAccessKeyId().toLowerCase(); new S3TransferProgressSample(); }
From source file:controllers.s3locationmodify.java
License:Open Source License
private static long calculateregionload(String regionname) { AmazonS3 s3 = new AmazonS3Client(credentials); long size = 0; AmazonS3 s3client = new AmazonS3Client(new ProfileCredentialsProvider()); //try {/*from ww w.j a va2s .c o m*/ ListObjectsRequest listObjectsRequest = new ListObjectsRequest().withBucketName(regionname); ObjectListing objectListing; do { objectListing = s3client.listObjects(listObjectsRequest); for (S3ObjectSummary objectSummary : objectListing.getObjectSummaries()) { size = objectSummary.getSize(); } listObjectsRequest.setMarker(objectListing.getNextMarker()); } while (objectListing.isTruncated()); return size; }
From source file:Database.CustomerData.java
License:Open Source License
/** * * * @see com.amazonaws.auth.BasicAWSCredentials * @see com.amazonaws.auth.ProfilesConfigFile * @see com.amazonaws.ClientConfiguration *///from www .ja v a 2 s .c om private static void init() throws Exception { AWSCredentials credentials = null; try { credentials = new ProfileCredentialsProvider().getCredentials(); } catch (Exception e) { throw new AmazonClientException("Cannot load the credentials from the credential profiles file. " + "Please make sure that your credentials file is at the correct " + "location (~/.aws/credentials), and is in valid format.", e); } dynamoDB = new AmazonDynamoDBClient(credentials); Region usWest2 = Region.getRegion(Regions.US_WEST_2); dynamoDB.setRegion(usWest2); dynamoDB.setEndpoint("http://localhost:8000"); }
From source file:edu.iit.credentials.Credentials.java
/** * * @return/*from ww w.j a v a 2 s .c o m*/ */ public static AWSCredentials getCreds() { AWSCredentials credentials; try { credentials = new ProfileCredentialsProvider().getCredentials(); } catch (Exception e) { credentials = new InstanceProfileCredentialsProvider().getCredentials(); } return credentials; }
From source file:edu.utn.frba.grupo5303.serverenviolibre.repository.CalificacionDAODynamo.java
public CalificacionDAODynamo() { String regionName = "us-west-2"; Region region = Region.getRegion(Regions.fromName(regionName)); ClientConfiguration clientConfiguration = new ClientConfiguration().withMaxErrorRetry(20); ddb = new AmazonDynamoDBClient(new ProfileCredentialsProvider(), clientConfiguration); ddb.setRegion(region);/*from w w w .ja v a 2 s . co m*/ mapper = new DynamoDBMapper(ddb); }
From source file:edu.utn.frba.grupo5303.serverenviolibre.repository.FacturasDAODynamo.java
public FacturasDAODynamo() { String regionName = "us-west-2"; Region region = Region.getRegion(Regions.fromName(regionName)); ClientConfiguration clientConfiguration = new ClientConfiguration().withMaxErrorRetry(20); ddb = new AmazonDynamoDBClient(new ProfileCredentialsProvider(), clientConfiguration); ddb.setRegion(region);// w w w .java2 s . c o m mapper = new DynamoDBMapper(ddb); }
From source file:edu.utn.frba.grupo5303.serverenviolibre.repository.ImagenUsuarioDAODynamo.java
public ImagenUsuarioDAODynamo() { String regionName = "us-west-2"; Region region = Region.getRegion(Regions.fromName(regionName)); ClientConfiguration clientConfiguration = new ClientConfiguration().withMaxErrorRetry(20); ddb = new AmazonDynamoDBClient(new ProfileCredentialsProvider(), clientConfiguration); ddb.setRegion(region);/*from ww w. j a v a2 s .c o m*/ mapper = new DynamoDBMapper(ddb); }
From source file:edu.utn.frba.grupo5303.serverenviolibre.services.GeoPosicionamientoPublicacionesService.java
private void setupGeoDataManager() { String tableName = "Posicion"; String regionName = "us-west-2"; Region region = Region.getRegion(Regions.fromName(regionName)); ClientConfiguration clientConfiguration = new ClientConfiguration().withMaxErrorRetry(20); AmazonDynamoDBClient ddb = new AmazonDynamoDBClient(new ProfileCredentialsProvider(), clientConfiguration); ddb.setRegion(region);/*from ww w . j av a2 s .c om*/ config = new GeoDataManagerConfiguration(ddb, tableName); geoDataManager = new GeoDataManager(config); }
From source file:edu.utn.frba.grupo5303.serverenviolibre.services.GeoPosicionamientoUsuariosService.java
private void setupGeoDataManager() { String tableName = "PosicionUsuarios"; String regionName = "us-west-2"; Region region = Region.getRegion(Regions.fromName(regionName)); ClientConfiguration clientConfiguration = new ClientConfiguration().withMaxErrorRetry(20); AmazonDynamoDBClient ddb = new AmazonDynamoDBClient(new ProfileCredentialsProvider(), clientConfiguration); ddb.setRegion(region);//from w w w.j a va 2s . c o m config = new GeoDataManagerConfiguration(ddb, tableName); geoDataManager = new GeoDataManager(config); }
From source file:edu.utn.frba.grupo5303.serverenviolibre.services.NotificacionesPushService.java
public NotificacionesPushService() { snsClient = new AmazonSNSClient(new ProfileCredentialsProvider()); }