com.amazonaws.auth.PropertiesCredentials Java Examples
The following examples show how to use
com.amazonaws.auth.PropertiesCredentials.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractAWSProcessor.java From localization_nifi with Apache License 2.0 | 6 votes |
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(); }
Example #2
Source File: AbstractAWSProcessor.java From nifi with Apache License 2.0 | 6 votes |
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(); }
Example #3
Source File: TestAWSCredentials.java From nifi with Apache License 2.0 | 5 votes |
@Test public void testCredentialsFile() { runner.setProperty(AbstractAWSProcessor.CREDENTIALS_FILE, "src/test/resources/mock-aws-credentials.properties"); runner.assertValid(); runner.run(1); assertEquals(PropertiesCredentials.class, awsCredentials.getClass()); assertNull(awsCredentialsProvider); }
Example #4
Source File: ITAbstractDynamoDBTest.java From localization_nifi with Apache License 2.0 | 4 votes |
@BeforeClass public static void beforeClass() throws Exception { FileInputStream fis = new FileInputStream(CREDENTIALS_FILE); final PropertiesCredentials credentials = new PropertiesCredentials(fis); amazonDynamoDBClient = new AmazonDynamoDBClient(credentials); dynamoDB = new DynamoDB(amazonDynamoDBClient); amazonDynamoDBClient.setRegion(Region.getRegion(Regions.US_WEST_2)); ArrayList<AttributeDefinition> attributeDefinitions = new ArrayList<AttributeDefinition>(); attributeDefinitions .add(new AttributeDefinition().withAttributeName("hashS").withAttributeType("S")); attributeDefinitions .add(new AttributeDefinition().withAttributeName("rangeS").withAttributeType("S")); ArrayList<KeySchemaElement> keySchema = new ArrayList<KeySchemaElement>(); keySchema.add(new KeySchemaElement().withAttributeName("hashS").withKeyType(KeyType.HASH)); keySchema.add(new KeySchemaElement().withAttributeName("rangeS").withKeyType(KeyType.RANGE)); CreateTableRequest request = new CreateTableRequest() .withTableName(stringHashStringRangeTableName) .withKeySchema(keySchema) .withAttributeDefinitions(attributeDefinitions) .withProvisionedThroughput(new ProvisionedThroughput() .withReadCapacityUnits(5L) .withWriteCapacityUnits(6L)); Table stringHashStringRangeTable = dynamoDB.createTable(request); stringHashStringRangeTable.waitForActive(); attributeDefinitions = new ArrayList<AttributeDefinition>(); attributeDefinitions .add(new AttributeDefinition().withAttributeName("hashN").withAttributeType("N")); attributeDefinitions .add(new AttributeDefinition().withAttributeName("rangeN").withAttributeType("N")); keySchema = new ArrayList<KeySchemaElement>(); keySchema.add(new KeySchemaElement().withAttributeName("hashN").withKeyType(KeyType.HASH)); keySchema.add(new KeySchemaElement().withAttributeName("rangeN").withKeyType(KeyType.RANGE)); request = new CreateTableRequest() .withTableName(numberHashNumberRangeTableName) .withKeySchema(keySchema) .withAttributeDefinitions(attributeDefinitions) .withProvisionedThroughput(new ProvisionedThroughput() .withReadCapacityUnits(5L) .withWriteCapacityUnits(6L)); Table numberHashNumberRangeTable = dynamoDB.createTable(request); numberHashNumberRangeTable.waitForActive(); attributeDefinitions = new ArrayList<AttributeDefinition>(); attributeDefinitions .add(new AttributeDefinition().withAttributeName("hashN").withAttributeType("N")); keySchema = new ArrayList<KeySchemaElement>(); keySchema.add(new KeySchemaElement().withAttributeName("hashN").withKeyType(KeyType.HASH)); request = new CreateTableRequest() .withTableName(numberHashOnlyTableName) .withKeySchema(keySchema) .withAttributeDefinitions(attributeDefinitions) .withProvisionedThroughput(new ProvisionedThroughput() .withReadCapacityUnits(5L) .withWriteCapacityUnits(6L)); Table numberHashOnlyTable = dynamoDB.createTable(request); numberHashOnlyTable.waitForActive(); }
Example #5
Source File: LowLevelBatchWriteSyntax.java From aws-doc-sdk-examples with Apache License 2.0 | 4 votes |
private static void createClient() throws IOException { AWSCredentials credentials = new PropertiesCredentials( LowLevelBatchWriteSyntax.class.getResourceAsStream("AwsCredentials.properties")); client = new AmazonDynamoDBClient(credentials); }
Example #6
Source File: SQSTestBase.java From attic-apex-malhar with Apache License 2.0 | 4 votes |
public SQSTestBase() { PropertiesFileCredentialsProvider file = new PropertiesFileCredentialsProvider(getTestCredsFilePath()); testCreds = (PropertiesCredentials)file.getCredentials(); sqs = new AmazonSQSClient(testCreds); }
Example #7
Source File: ITDeleteSQS.java From nifi with Apache License 2.0 | 4 votes |
@Before public void setUp() throws IOException { PropertiesCredentials credentials = new PropertiesCredentials(new File(CREDENTIALS_FILE)); sqsClient = new AmazonSQSClient(credentials); sqsClient.withRegion(Regions.fromName(TEST_REGION)); }
Example #8
Source File: ITAbstractDynamoDBTest.java From nifi with Apache License 2.0 | 4 votes |
@BeforeClass public static void beforeClass() throws Exception { FileInputStream fis = new FileInputStream(CREDENTIALS_FILE); final PropertiesCredentials credentials = new PropertiesCredentials(fis); amazonDynamoDBClient = new AmazonDynamoDBClient(credentials); dynamoDB = new DynamoDB(amazonDynamoDBClient); amazonDynamoDBClient.setRegion(Region.getRegion(Regions.US_WEST_2)); ArrayList<AttributeDefinition> attributeDefinitions = new ArrayList<AttributeDefinition>(); attributeDefinitions .add(new AttributeDefinition().withAttributeName("hashS").withAttributeType("S")); attributeDefinitions .add(new AttributeDefinition().withAttributeName("rangeS").withAttributeType("S")); ArrayList<KeySchemaElement> keySchema = new ArrayList<KeySchemaElement>(); keySchema.add(new KeySchemaElement().withAttributeName("hashS").withKeyType(KeyType.HASH)); keySchema.add(new KeySchemaElement().withAttributeName("rangeS").withKeyType(KeyType.RANGE)); CreateTableRequest request = new CreateTableRequest() .withTableName(stringHashStringRangeTableName) .withKeySchema(keySchema) .withAttributeDefinitions(attributeDefinitions) .withProvisionedThroughput(new ProvisionedThroughput() .withReadCapacityUnits(5L) .withWriteCapacityUnits(6L)); Table stringHashStringRangeTable = dynamoDB.createTable(request); stringHashStringRangeTable.waitForActive(); attributeDefinitions = new ArrayList<AttributeDefinition>(); attributeDefinitions .add(new AttributeDefinition().withAttributeName("hashN").withAttributeType("N")); attributeDefinitions .add(new AttributeDefinition().withAttributeName("rangeN").withAttributeType("N")); keySchema = new ArrayList<KeySchemaElement>(); keySchema.add(new KeySchemaElement().withAttributeName("hashN").withKeyType(KeyType.HASH)); keySchema.add(new KeySchemaElement().withAttributeName("rangeN").withKeyType(KeyType.RANGE)); request = new CreateTableRequest() .withTableName(numberHashNumberRangeTableName) .withKeySchema(keySchema) .withAttributeDefinitions(attributeDefinitions) .withProvisionedThroughput(new ProvisionedThroughput() .withReadCapacityUnits(5L) .withWriteCapacityUnits(6L)); Table numberHashNumberRangeTable = dynamoDB.createTable(request); numberHashNumberRangeTable.waitForActive(); attributeDefinitions = new ArrayList<AttributeDefinition>(); attributeDefinitions .add(new AttributeDefinition().withAttributeName("hashN").withAttributeType("N")); keySchema = new ArrayList<KeySchemaElement>(); keySchema.add(new KeySchemaElement().withAttributeName("hashN").withKeyType(KeyType.HASH)); request = new CreateTableRequest() .withTableName(numberHashOnlyTableName) .withKeySchema(keySchema) .withAttributeDefinitions(attributeDefinitions) .withProvisionedThroughput(new ProvisionedThroughput() .withReadCapacityUnits(5L) .withWriteCapacityUnits(6L)); Table numberHashOnlyTable = dynamoDB.createTable(request); numberHashOnlyTable.waitForActive(); }
Example #9
Source File: LowLevelBatchWriteSyntax.java From aws-dynamodb-examples with Apache License 2.0 | 4 votes |
private static void createClient() throws IOException { AWSCredentials credentials = new PropertiesCredentials( LowLevelBatchWriteSyntax.class.getResourceAsStream("AwsCredentials.properties")); client = new AmazonDynamoDBClient(credentials); }