Search in sources :

Example 16 with AWSStaticCredentialsProvider

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

the class KinesisIOWriteTest method testReadWithBasicCredentialsAndVerificationDisabled.

@Test
public void testReadWithBasicCredentialsAndVerificationDisabled() {
    String customEndpoint = "localhost:9999";
    Regions region = Regions.US_WEST_1;
    BasicAWSCredentials credentials = new BasicAWSCredentials(ACCESS_KEY_ID, SECRET_KEY);
    Write write = KinesisIO.write().withAWSClientsProvider(ACCESS_KEY_ID, SECRET_KEY, region, customEndpoint, VERIFICATION_DISABLED);
    assertEquals(write.getAWSClientsProvider(), new BasicKinesisProvider(new AWSStaticCredentialsProvider(credentials), region, customEndpoint, VERIFICATION_DISABLED));
}
Also used : Write(org.apache.beam.sdk.io.kinesis.KinesisIO.Write) AWSStaticCredentialsProvider(com.amazonaws.auth.AWSStaticCredentialsProvider) Regions(com.amazonaws.regions.Regions) BasicAWSCredentials(com.amazonaws.auth.BasicAWSCredentials) Test(org.junit.Test)

Example 17 with AWSStaticCredentialsProvider

use of com.amazonaws.auth.AWSStaticCredentialsProvider 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 18 with AWSStaticCredentialsProvider

use of com.amazonaws.auth.AWSStaticCredentialsProvider 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 19 with AWSStaticCredentialsProvider

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

the class KinesisIOReadTest method testReadWithBasicCredentialsAndVerificationDisabled.

@Test
public void testReadWithBasicCredentialsAndVerificationDisabled() {
    String customEndpoint = "localhost:9999";
    Regions region = Regions.US_WEST_1;
    Read<KinesisRecord> read = KinesisIO.read().withAWSClientsProvider(ACCESS_KEY_ID, SECRET_ACCESS_KEY, region, customEndpoint, VERIFICATION_DISABLED);
    assertEquals(read.getAWSClientsProvider(), new BasicKinesisProvider(new AWSStaticCredentialsProvider(new BasicAWSCredentials(ACCESS_KEY_ID, SECRET_ACCESS_KEY)), region, customEndpoint, VERIFICATION_DISABLED));
}
Also used : AWSStaticCredentialsProvider(com.amazonaws.auth.AWSStaticCredentialsProvider) Regions(com.amazonaws.regions.Regions) BasicAWSCredentials(com.amazonaws.auth.BasicAWSCredentials) Test(org.junit.Test)

Example 20 with AWSStaticCredentialsProvider

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

the class KinesisIOReadTest method testReadWithBasicCredentialsAndCustomEndpoint.

@Test
public void testReadWithBasicCredentialsAndCustomEndpoint() {
    String customEndpoint = "localhost:9999";
    Regions region = Regions.US_WEST_1;
    Read<KinesisRecord> read = KinesisIO.read().withAWSClientsProvider(ACCESS_KEY_ID, SECRET_ACCESS_KEY, region, customEndpoint);
    assertEquals(read.getAWSClientsProvider(), new BasicKinesisProvider(new AWSStaticCredentialsProvider(new BasicAWSCredentials(ACCESS_KEY_ID, SECRET_ACCESS_KEY)), region, customEndpoint, true));
}
Also used : AWSStaticCredentialsProvider(com.amazonaws.auth.AWSStaticCredentialsProvider) Regions(com.amazonaws.regions.Regions) BasicAWSCredentials(com.amazonaws.auth.BasicAWSCredentials) Test(org.junit.Test)

Aggregations

AWSStaticCredentialsProvider (com.amazonaws.auth.AWSStaticCredentialsProvider)63 BasicAWSCredentials (com.amazonaws.auth.BasicAWSCredentials)44 AWSCredentials (com.amazonaws.auth.AWSCredentials)15 Test (org.junit.Test)15 AWSCredentialsProvider (com.amazonaws.auth.AWSCredentialsProvider)14 ClientConfiguration (com.amazonaws.ClientConfiguration)13 ProfileCredentialsProvider (com.amazonaws.auth.profile.ProfileCredentialsProvider)11 AmazonS3 (com.amazonaws.services.s3.AmazonS3)9 AmazonClientException (com.amazonaws.AmazonClientException)8 Regions (com.amazonaws.regions.Regions)8 SdkClientException (com.amazonaws.SdkClientException)7 AwsClientBuilder (com.amazonaws.client.builder.AwsClientBuilder)7 BasicSessionCredentials (com.amazonaws.auth.BasicSessionCredentials)6 AmazonS3ClientBuilder (com.amazonaws.services.s3.AmazonS3ClientBuilder)6 File (java.io.File)6 AmazonServiceException (com.amazonaws.AmazonServiceException)5 EndpointConfiguration (com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration)5 AmazonEC2 (com.amazonaws.services.ec2.AmazonEC2)3 ObjectListing (com.amazonaws.services.s3.model.ObjectListing)3 AWSSecurityTokenService (com.amazonaws.services.securitytoken.AWSSecurityTokenService)3