Search in sources :

Example 41 with AWSCredentialsProvider

use of com.amazonaws.auth.AWSCredentialsProvider in project beam by apache.

the class KinesisIOWriteTest method testReadWithCredentialsProvider.

@Test
public void testReadWithCredentialsProvider() {
    Regions region = Regions.US_EAST_1;
    AWSCredentialsProvider credentialsProvider = DefaultAWSCredentialsProviderChain.getInstance();
    Write write = KinesisIO.write().withAWSClientsProvider(credentialsProvider, region);
    assertEquals(write.getAWSClientsProvider(), new BasicKinesisProvider(credentialsProvider, region, null, true));
}
Also used : Write(org.apache.beam.sdk.io.kinesis.KinesisIO.Write) Regions(com.amazonaws.regions.Regions) AWSCredentialsProvider(com.amazonaws.auth.AWSCredentialsProvider) Test(org.junit.Test)

Example 42 with AWSCredentialsProvider

use of com.amazonaws.auth.AWSCredentialsProvider in project beam by apache.

the class KinesisIOWriteTest method testReadWithCredentialsProviderAndVerificationDisabled.

@Test
public void testReadWithCredentialsProviderAndVerificationDisabled() {
    String customEndpoint = "localhost:9999";
    Regions region = Regions.US_WEST_1;
    AWSCredentialsProvider credentialsProvider = DefaultAWSCredentialsProviderChain.getInstance();
    Write write = KinesisIO.write().withAWSClientsProvider(credentialsProvider, region, customEndpoint, VERIFICATION_DISABLED);
    assertEquals(write.getAWSClientsProvider(), new BasicKinesisProvider(credentialsProvider, region, customEndpoint, VERIFICATION_DISABLED));
}
Also used : Write(org.apache.beam.sdk.io.kinesis.KinesisIO.Write) Regions(com.amazonaws.regions.Regions) AWSCredentialsProvider(com.amazonaws.auth.AWSCredentialsProvider) Test(org.junit.Test)

Example 43 with AWSCredentialsProvider

use of com.amazonaws.auth.AWSCredentialsProvider in project beam by apache.

the class AwsModuleTest method testAWSStaticCredentialsProviderSerializationDeserialization.

@Test
public void testAWSStaticCredentialsProviderSerializationDeserialization() throws Exception {
    AWSCredentialsProvider credentialsProvider = new AWSStaticCredentialsProvider(new BasicAWSCredentials(ACCESS_KEY_ID, SECRET_ACCESS_KEY));
    String serializedCredentialsProvider = serialize(credentialsProvider);
    AWSCredentialsProvider deserializedCredentialsProvider = deserializeCredentialsProvider(serializedCredentialsProvider);
    checkStaticBasicCredentials(deserializedCredentialsProvider);
    credentialsProvider = new AWSStaticCredentialsProvider(new BasicSessionCredentials(ACCESS_KEY_ID, SECRET_ACCESS_KEY, SESSION_TOKEN));
    checkStaticSessionCredentials(credentialsProvider);
}
Also used : AWSStaticCredentialsProvider(com.amazonaws.auth.AWSStaticCredentialsProvider) BasicSessionCredentials(com.amazonaws.auth.BasicSessionCredentials) AWSCredentialsProvider(com.amazonaws.auth.AWSCredentialsProvider) BasicAWSCredentials(com.amazonaws.auth.BasicAWSCredentials) Test(org.junit.Test)

Example 44 with AWSCredentialsProvider

use of com.amazonaws.auth.AWSCredentialsProvider in project beam by apache.

the class BasicKinesisClientProviderTest method testSerialization.

@Test
public void testSerialization() {
    AWSCredentialsProvider awsCredentialsProvider = new AWSStaticCredentialsProvider(new BasicAWSCredentials(ACCESS_KEY_ID, SECRET_ACCESS_KEY));
    BasicKinesisProvider kinesisProvider = new BasicKinesisProvider(awsCredentialsProvider, Regions.AP_EAST_1, null, true);
    byte[] serializedBytes = SerializableUtils.serializeToByteArray(kinesisProvider);
    BasicKinesisProvider kinesisProviderDeserialized = (BasicKinesisProvider) SerializableUtils.deserializeFromByteArray(serializedBytes, "Basic Kinesis Provider");
    assertEquals(kinesisProvider, kinesisProviderDeserialized);
}
Also used : AWSStaticCredentialsProvider(com.amazonaws.auth.AWSStaticCredentialsProvider) AWSCredentialsProvider(com.amazonaws.auth.AWSCredentialsProvider) BasicAWSCredentials(com.amazonaws.auth.BasicAWSCredentials) Test(org.junit.Test)

Example 45 with AWSCredentialsProvider

use of com.amazonaws.auth.AWSCredentialsProvider in project beam by apache.

the class KinesisIOReadTest method testReadWithCredentialsProvider.

@Test
public void testReadWithCredentialsProvider() {
    Regions region = Regions.US_EAST_1;
    AWSCredentialsProvider credentialsProvider = DefaultAWSCredentialsProviderChain.getInstance();
    Read<KinesisRecord> read = KinesisIO.read().withAWSClientsProvider(credentialsProvider, region);
    assertEquals(read.getAWSClientsProvider(), new BasicKinesisProvider(credentialsProvider, region, null, true));
}
Also used : Regions(com.amazonaws.regions.Regions) AWSCredentialsProvider(com.amazonaws.auth.AWSCredentialsProvider) Test(org.junit.Test)

Aggregations

AWSCredentialsProvider (com.amazonaws.auth.AWSCredentialsProvider)125 Test (org.junit.Test)75 DefaultAWSCredentialsProviderChain (com.amazonaws.auth.DefaultAWSCredentialsProviderChain)26 BasicAWSCredentials (com.amazonaws.auth.BasicAWSCredentials)20 AWSStaticCredentialsProvider (com.amazonaws.auth.AWSStaticCredentialsProvider)19 AWSCredentials (com.amazonaws.auth.AWSCredentials)16 TestRunner (org.apache.nifi.util.TestRunner)15 ClientConfiguration (com.amazonaws.ClientConfiguration)12 AmazonS3Client (com.amazonaws.services.s3.AmazonS3Client)12 STSAssumeRoleSessionCredentialsProvider (com.amazonaws.auth.STSAssumeRoleSessionCredentialsProvider)8 ProfileCredentialsProvider (com.amazonaws.auth.profile.ProfileCredentialsProvider)8 PropertyDescriptor (org.apache.nifi.components.PropertyDescriptor)8 AWSCredentialsProviderChain (com.amazonaws.auth.AWSCredentialsProviderChain)7 ClasspathPropertiesFileCredentialsProvider (com.amazonaws.auth.ClasspathPropertiesFileCredentialsProvider)7 EnvironmentVariableCredentialsProvider (com.amazonaws.auth.EnvironmentVariableCredentialsProvider)7 SystemPropertiesCredentialsProvider (com.amazonaws.auth.SystemPropertiesCredentialsProvider)7 ArrayList (java.util.ArrayList)7 Properties (java.util.Properties)7 Configuration (org.apache.hadoop.conf.Configuration)7 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)7