public AWSCredentials getCredentials() { try { return new PropertiesCredentials(new File(this.credentialsFilePath)); } catch (IOException e) { throw new SdkClientException( "Unable to load AWS credentials from the " + credentialsFilePath + " file", e); } }
public AmazonSESMailer(Environment env) throws IOException { this.env = env; InputStream resource = AmazonSESMailer.class .getResourceAsStream("/AwsCredentials.properties"); PropertiesCredentials credentials = new PropertiesCredentials(resource); this.client = new AmazonSimpleEmailServiceClient(credentials); Properties props = new Properties(); props.setProperty("mail.transport.protocol", "aws"); props.setProperty("mail.aws.user", credentials.getAWSAccessKeyId()); props.setProperty("mail.aws.password", credentials.getAWSSecretKey()); this.session = Session.getInstance(props); }
public AWSCredentials getCredentials() { InputStream inputStream = getClass().getResourceAsStream(credentialsFilePath); if (inputStream == null) { throw new SdkClientException("Unable to load AWS credentials from the " + credentialsFilePath + " file on the classpath"); } try { return new PropertiesCredentials(inputStream); } catch (IOException e) { throw new SdkClientException("Unable to load AWS credentials from the " + credentialsFilePath + " file on the classpath", e); } }
/** * Internal method to implement the {@link #setCredentialFile(String)}. */ private static void setCredentialFile0(String filepath) throws FileNotFoundException, IOException { final PropertiesCredentials cred = new PropertiesCredentials(new File(filepath)); synchronized(AwsSdkMetrics.class) { credentialProvider = new AWSCredentialsProvider() { @Override public void refresh() {} @Override public AWSCredentials getCredentials() { return cred; } }; AwsSdkMetrics.credentialFile = filepath; } }
@Override public AWSCredentials getCredentials() { File credentials = new File(Objects.firstNonNull(H2O.OPT_ARGS.aws_credentials, DEFAULT_CREDENTIALS_LOCATION)); try { return new PropertiesCredentials(credentials); } catch (IOException e) { throw new AmazonClientException("Unable to load AWS credentials from file " + credentials); } }
AmazonS3 s3client = new AmazonS3Client(new PropertiesCredentials( S3Sample.class.getResourceAsStream( "AwsCredentials.properties"))); try { System.out.println("Uploading a new object to S3 from a file\n"); File file = new File(uploadFileName); s3client.putObject(new PutObjectRequest( bucketName, keyName, file)); } catch (AmazonServiceException ase) { System.out.println("Caught an AmazonServiceException, which " + "means your request made it " + "to Amazon S3, but was rejected with an error response" + " for some reason."); // ... error handling based on exception details }
AWSCredentials credentials = new PropertiesCredentials(new File(credentialsFile)); ClientConfiguration cconfig = new ClientConfiguration(); cconfig.setMaxConnections(maxConnects);
static String getAutoScaleGroup() { try { String credFileProperty = System.getProperty( AwsPropertyKeys.AWS_CREDENTIALS_FILE.getBundle()); AWSCredentials credentials; if (credFileProperty != null) { credentials = new PropertiesCredentials(new File(credFileProperty)); } else { credentials = new DefaultAWSCredentialsProviderChain().getCredentials(); } AmazonAutoScaling autoScalingClient = AwsServiceClients.autoScaling(credentials); List<AutoScalingInstanceDetails> autoScalingInstances = autoScalingClient.describeAutoScalingInstances( new DescribeAutoScalingInstancesRequest().withInstanceIds(getInstanceId())).getAutoScalingInstances(); return autoScalingInstances.isEmpty() ? UNDEFINED : autoScalingInstances.get(0).getAutoScalingGroupName(); } catch (Exception e) { getLogger().error("Unable to get ASG name.", e); return UNDEFINED; } }
AWSCredentials credentials = new PropertiesCredentials(credentialsAsStream);
protected AWSCredentials getCredentials(final ProcessContext context) { final String accessKey = context.getProperty(ACCESS_KEY).evaluateAttributeExpressions().getValue(); final String secretKey = context.getProperty(SECRET_KEY).evaluateAttributeExpressions().getValue(); final String credentialsFile = context.getProperty(CREDENTIALS_FILE).getValue(); if (credentialsFile != null) { try { return new PropertiesCredentials(new File(credentialsFile)); } catch (final IOException ioe) { throw new ProcessException("Could not read Credentials File", ioe); } } if (accessKey != null && secretKey != null) { return new BasicAWSCredentials(accessKey, secretKey); } return new AnonymousAWSCredentials(); }
public AWSCredentials getCredentials() { try { return new PropertiesCredentials(new File(this.credentialsFilePath)); } catch (IOException e) { throw new SdkClientException( "Unable to load AWS credentials from the " + credentialsFilePath + " file", e); } }
public AWSCredentials getCredentials() { InputStream inputStream = getClass().getResourceAsStream(credentialsFilePath); if (inputStream == null) { throw new SdkClientException("Unable to load AWS credentials from the " + credentialsFilePath + " file on the classpath"); } try { return new PropertiesCredentials(inputStream); } catch (IOException e) { throw new SdkClientException("Unable to load AWS credentials from the " + credentialsFilePath + " file on the classpath", e); } }
/** * Internal method to implement the {@link #setCredentialFile(String)}. */ private static void setCredentialFile0(String filepath) throws FileNotFoundException, IOException { final PropertiesCredentials cred = new PropertiesCredentials(new File(filepath)); synchronized(AwsSdkMetrics.class) { credentialProvider = new AWSCredentialsProvider() { @Override public void refresh() {} @Override public AWSCredentials getCredentials() { return cred; } }; AwsSdkMetrics.credentialFile = filepath; } }
/** * Internal method to implement the {@link #setCredentialFile(String)}. */ private static void setCredentialFile0(String filepath) throws IOException { final PropertiesCredentials cred = new PropertiesCredentials(new File(filepath)); synchronized (AwsSdkMetrics.class) { credentialProvider = new AWSCredentialsProvider() { @Override public void refresh() { } @Override public AWSCredentials getCredentials() { return cred; } }; AwsSdkMetrics.credentialFile = filepath; } }
@Override public AWSCredentials getCredentials() { try { return new PropertiesCredentials(new File(this.credentialsFilePath)); } catch (IOException e) { throw new AmazonClientException( "Unable to load AWS credentials from the " + credentialsFilePath + " file", e); } }
@Override public AWSCredentials getCredentials() { InputStream inputStream = getClass().getResourceAsStream(credentialsFilePath); if (inputStream == null) { throw new AmazonClientException("Unable to load AWS credentials from the " + credentialsFilePath + " file on the classpath"); } try { return new PropertiesCredentials(inputStream); } catch (IOException e) { throw new AmazonClientException("Unable to load AWS credentials from the " + credentialsFilePath + " file on the classpath", e); } }
public class Update_Table { private String tableName = "Test"; private AmazonDynamoDBClient client =null; public void DynamoDBClient() throws IOException { //changed the below line AWSCredentials cred = new PropertiesCredentials(ClassLoader.getResourceAsStream("src/com.afdal.ftsmetheses/AwsCredentials.properties")); //OR try this AWSCredentials cred = new PropertiesCredentials(ClassLoader.getResourceAsStream("com.afdal.ftsmetheses/AwsCredentials.properties")); client = new AmazonDynamoDBClient(cred); } }
public AWSCredentials getCredentials() { InputStream inputStream = getClass().getResourceAsStream(credentialsFilePath); if (inputStream == null) { throw new SdkClientException("Unable to load AWS credentials from the " + credentialsFilePath + " file on the classpath"); } try { return new PropertiesCredentials(inputStream); } catch (IOException e) { throw new SdkClientException("Unable to load AWS credentials from the " + credentialsFilePath + " file on the classpath", e); } }
public AWSCredentials getCredentials() { try { return new PropertiesCredentials(new File(this.credentialsFilePath)); } catch (IOException e) { throw new SdkClientException( "Unable to load AWS credentials from the " + credentialsFilePath + " file", e); } }
AWSCredentials credentials = new PropertiesCredentials( ObjectPersistenceQueryScanExample.class.getResourceAsStream("AwsCredentials.properties")); client = new AmazonDynamoDBClient(credentials); DynamoDBMapper mapper = new DynamoDBMapper(client);