Search in sources :

Example 31 with AwsCredentialsProvider

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

the class DynamoDBIOReadTest method testBuildWithCredentialsProviderAndRegionAndEndpoint.

@Test
public void testBuildWithCredentialsProviderAndRegionAndEndpoint() {
    Region region = Region.US_EAST_1;
    AwsCredentialsProvider credentialsProvider = DefaultCredentialsProvider.create();
    URI endpoint = URI.create("localhost:9999");
    Read<Object> read = DynamoDBIO.read().withDynamoDbClientProvider(credentialsProvider, region.id(), endpoint);
    assertThat(read.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 32 with AwsCredentialsProvider

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

the class DynamoDBIOWriteTest method testBuildWithCredentialsProviderAndRegion.

@Test
public void testBuildWithCredentialsProviderAndRegion() {
    Region region = Region.US_EAST_1;
    AwsCredentialsProvider credentialsProvider = DefaultCredentialsProvider.create();
    Write<Object> write = DynamoDBIO.write().withDynamoDbClientProvider(credentialsProvider, region.id());
    assertThat(write.getClientConfiguration()).isEqualTo(ClientConfiguration.create(credentialsProvider, region, null));
}
Also used : AwsCredentialsProvider(software.amazon.awssdk.auth.credentials.AwsCredentialsProvider) Region(software.amazon.awssdk.regions.Region) Test(org.junit.Test)

Example 33 with AwsCredentialsProvider

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

the class KinesisIOReadTest method testBuildWithCredentialsProviderAndCustomEndpoint.

@Test
public void testBuildWithCredentialsProviderAndCustomEndpoint() {
    String customEndpoint = "localhost:9999";
    Region region = Region.US_WEST_1;
    AwsCredentialsProvider credentialsProvider = DefaultCredentialsProvider.create();
    Read read = KinesisIO.read().withAWSClientsProvider(credentialsProvider, region, customEndpoint);
    assertThat(read.getClientConfiguration()).isEqualTo(ClientConfiguration.create(credentialsProvider, region, URI.create(customEndpoint)));
}
Also used : Read(org.apache.beam.sdk.io.aws2.kinesis.KinesisIO.Read) AwsCredentialsProvider(software.amazon.awssdk.auth.credentials.AwsCredentialsProvider) Region(software.amazon.awssdk.regions.Region) Test(org.junit.Test)

Example 34 with AwsCredentialsProvider

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

the class GlueSchemaRegistryInputStreamDeserializerTest method testDefaultAwsCredentialsProvider.

@Test
public void testDefaultAwsCredentialsProvider() throws Exception {
    GlueSchemaRegistryInputStreamDeserializer glueSchemaRegistryInputStreamDeserializer = new GlueSchemaRegistryInputStreamDeserializer(configs);
    GlueSchemaRegistryDeserializationFacade facade = getField("glueSchemaRegistryDeserializationFacade", glueSchemaRegistryInputStreamDeserializer);
    AwsCredentialsProvider credentialsProvider = facade.getCredentialsProvider();
    assertThat(credentialsProvider).isInstanceOf(DefaultCredentialsProvider.class);
}
Also used : AwsCredentialsProvider(software.amazon.awssdk.auth.credentials.AwsCredentialsProvider) GlueSchemaRegistryDeserializationFacade(com.amazonaws.services.schemaregistry.deserializers.GlueSchemaRegistryDeserializationFacade) Test(org.junit.Test)

Example 35 with AwsCredentialsProvider

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

the class GlueSchemaRegistryJsonSchemaCoderTest method testDefaultAwsCredentialsProvider.

@Test
public void testDefaultAwsCredentialsProvider() throws Exception {
    GlueSchemaRegistryJsonSchemaCoder coder = new GlueSchemaRegistryJsonSchemaCoder("test", getBaseConfig());
    GlueSchemaRegistryDeserializationFacade facade = getField("glueSchemaRegistryDeserializationFacade", coder);
    AwsCredentialsProvider credentialsProvider = facade.getCredentialsProvider();
    assertThat(credentialsProvider).isInstanceOf(DefaultCredentialsProvider.class);
}
Also used : AwsCredentialsProvider(software.amazon.awssdk.auth.credentials.AwsCredentialsProvider) GlueSchemaRegistryDeserializationFacade(com.amazonaws.services.schemaregistry.deserializers.GlueSchemaRegistryDeserializationFacade) 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