Search in sources :

Example 26 with AwsCredentialsProvider

use of software.amazon.awssdk.auth.credentials.AwsCredentialsProvider in project beam by apache.

the class BasicSqsClientProviderTest method testSerialization.

@Test
public void testSerialization() {
    AwsCredentialsProvider awsCredentialsProvider = StaticCredentialsProvider.create(AwsBasicCredentials.create("ACCESS_KEY_ID", "SECRET_ACCESS_KEY"));
    BasicSqsClientProvider sqsClientProvider = new BasicSqsClientProvider(awsCredentialsProvider, "us-east-1", null);
    byte[] serializedBytes = SerializableUtils.serializeToByteArray(sqsClientProvider);
    BasicSqsClientProvider sqsClientProviderDeserialized = (BasicSqsClientProvider) SerializableUtils.deserializeFromByteArray(serializedBytes, "Aws Credentials Provider");
    assertEquals(sqsClientProvider, sqsClientProviderDeserialized);
}
Also used : AwsCredentialsProvider(software.amazon.awssdk.auth.credentials.AwsCredentialsProvider) Test(org.junit.Test)

Example 27 with AwsCredentialsProvider

use of software.amazon.awssdk.auth.credentials.AwsCredentialsProvider in project beam by apache.

the class SqsIOWriteTest method testBuildWithCredentialsProviderAndRegion.

@Test
public void testBuildWithCredentialsProviderAndRegion() {
    Region region = Region.US_EAST_1;
    AwsCredentialsProvider credentialsProvider = DefaultCredentialsProvider.create();
    Write write = SqsIO.write().withSqsClientProvider(credentialsProvider, region.id());
    assertThat(write.getClientConfiguration()).isEqualTo(ClientConfiguration.create(credentialsProvider, region, null));
}
Also used : Write(org.apache.beam.sdk.io.aws2.sqs.SqsIO.Write) AwsCredentialsProvider(software.amazon.awssdk.auth.credentials.AwsCredentialsProvider) Region(software.amazon.awssdk.regions.Region) Test(org.junit.Test)

Example 28 with AwsCredentialsProvider

use of software.amazon.awssdk.auth.credentials.AwsCredentialsProvider in project beam by apache.

the class SnsIOTest method testBuildWithCredentialsProviderAndRegionAndEndpoint.

@Test
public void testBuildWithCredentialsProviderAndRegionAndEndpoint() {
    Region region = Region.US_EAST_1;
    AwsCredentialsProvider credentialsProvider = DefaultCredentialsProvider.create();
    URI endpoint = URI.create("localhost:9999");
    Write<Object> write = SnsIO.write().withSnsClientProvider(credentialsProvider, region.id(), endpoint);
    assertThat(write.getClientConfiguration()).isEqualTo(ClientConfiguration.create(credentialsProvider, region, endpoint));
}
Also used : AwsCredentialsProvider(software.amazon.awssdk.auth.credentials.AwsCredentialsProvider) Region(software.amazon.awssdk.regions.Region) URI(java.net.URI) Test(org.junit.Test)

Example 29 with AwsCredentialsProvider

use of software.amazon.awssdk.auth.credentials.AwsCredentialsProvider in project beam by apache.

the class SqsIOReadTest method testBuildWithCredentialsProviderAndRegion.

@Test
public void testBuildWithCredentialsProviderAndRegion() {
    Region region = Region.US_EAST_1;
    AwsCredentialsProvider credentialsProvider = DefaultCredentialsProvider.create();
    Read read = SqsIO.read().withSqsClientProvider(credentialsProvider, region.id());
    assertThat(read.clientConfiguration()).isEqualTo(ClientConfiguration.create(credentialsProvider, region, null));
}
Also used : Read(org.apache.beam.sdk.io.aws2.sqs.SqsIO.Read) AwsCredentialsProvider(software.amazon.awssdk.auth.credentials.AwsCredentialsProvider) Region(software.amazon.awssdk.regions.Region) Test(org.junit.Test)

Example 30 with AwsCredentialsProvider

use of software.amazon.awssdk.auth.credentials.AwsCredentialsProvider in project beam by apache.

the class BasicDynamoDbClientProviderTest method testSerialization.

@Test
public void testSerialization() {
    AwsCredentialsProvider awsCredentialsProvider = StaticCredentialsProvider.create(AwsBasicCredentials.create("ACCESS_KEY_ID", "SECRET_ACCESS_KEY"));
    BasicDynamoDbClientProvider dynamoDbClientProvider = new BasicDynamoDbClientProvider(awsCredentialsProvider, "us-east-1", null);
    byte[] serializedBytes = SerializableUtils.serializeToByteArray(dynamoDbClientProvider);
    BasicDynamoDbClientProvider dynamoDbClientProviderDeserialized = (BasicDynamoDbClientProvider) SerializableUtils.deserializeFromByteArray(serializedBytes, "Aws Credentials Provider");
    assertEquals(dynamoDbClientProvider, dynamoDbClientProviderDeserialized);
}
Also used : AwsCredentialsProvider(software.amazon.awssdk.auth.credentials.AwsCredentialsProvider) Test(org.junit.Test)

Aggregations

AwsCredentialsProvider (software.amazon.awssdk.auth.credentials.AwsCredentialsProvider)40 Test (org.junit.Test)39 Region (software.amazon.awssdk.regions.Region)14 Properties (java.util.Properties)8 URI (java.net.URI)6 AwsCredentials (software.amazon.awssdk.auth.credentials.AwsCredentials)6 GlueSchemaRegistryDeserializationFacade (com.amazonaws.services.schemaregistry.deserializers.GlueSchemaRegistryDeserializationFacade)4 HashMap (java.util.HashMap)2 Read (org.apache.beam.sdk.io.aws2.kinesis.KinesisIO.Read)2 Read (org.apache.beam.sdk.io.aws2.sqs.SqsIO.Read)2 Write (org.apache.beam.sdk.io.aws2.sqs.SqsIO.Write)2 DefaultCredentialsProvider (software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider)2 ProfileCredentialsProvider (software.amazon.awssdk.auth.credentials.ProfileCredentialsProvider)2 StaticCredentialsProvider (software.amazon.awssdk.auth.credentials.StaticCredentialsProvider)2 Supplier (java.util.function.Supplier)1 SerializableUtils.deserializeFromByteArray (org.apache.beam.sdk.util.SerializableUtils.deserializeFromByteArray)1 SerializableUtils.serializeToByteArray (org.apache.beam.sdk.util.SerializableUtils.serializeToByteArray)1 ThrowingSupplier (org.apache.beam.sdk.util.ThrowingSupplier)1 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)1 AwsBasicCredentials (software.amazon.awssdk.auth.credentials.AwsBasicCredentials)1