use of software.amazon.awssdk.auth.credentials.StaticCredentialsProvider in project beam by apache.
the class AwsSerializableUtilsTest method testAwsCredentialsProviderSerialization.
@Test
public void testAwsCredentialsProviderSerialization() {
AwsCredentialsProvider awsCredentialsProvider = StaticCredentialsProvider.create(AwsBasicCredentials.create(ACCESS_KEY_ID, SECRET_ACCESS_KEY));
String awsCredentialsProviderSerialized = AwsSerializableUtils.serializeAwsCredentialsProvider(awsCredentialsProvider);
AwsCredentialsProvider awsCredentialsProviderDeserialized = AwsSerializableUtils.deserializeAwsCredentialsProvider(awsCredentialsProviderSerialized);
assertTrue(awsCredentialsProviderDeserialized instanceof StaticCredentialsProvider);
AwsCredentials awsCredentials = awsCredentialsProviderDeserialized.resolveCredentials();
assertEquals(ACCESS_KEY_ID, awsCredentials.accessKeyId());
assertEquals(SECRET_ACCESS_KEY, awsCredentials.secretAccessKey());
}
use of software.amazon.awssdk.auth.credentials.StaticCredentialsProvider in project beam by apache.
the class KinesisIOReadTest method testBuildWithBasicCredentials.
@Test
public void testBuildWithBasicCredentials() {
Region region = Region.US_EAST_1;
AwsBasicCredentials credentials = AwsBasicCredentials.create(KEY, SECRET);
StaticCredentialsProvider credentialsProvider = StaticCredentialsProvider.create(credentials);
Read read = KinesisIO.read().withAWSClientsProvider(KEY, SECRET, region);
assertThat(read.getClientConfiguration()).isEqualTo(ClientConfiguration.create(credentialsProvider, region, null));
}
use of software.amazon.awssdk.auth.credentials.StaticCredentialsProvider in project beam by apache.
the class KinesisIOReadTest method testBuildWithBasicCredentialsAndCustomEndpoint.
@Test
public void testBuildWithBasicCredentialsAndCustomEndpoint() {
String customEndpoint = "localhost:9999";
Region region = Region.US_WEST_1;
AwsBasicCredentials credentials = AwsBasicCredentials.create("key", "secret");
StaticCredentialsProvider credentialsProvider = StaticCredentialsProvider.create(credentials);
Read read = KinesisIO.read().withAWSClientsProvider(KEY, SECRET, region, customEndpoint);
assertThat(read.getClientConfiguration()).isEqualTo(ClientConfiguration.create(credentialsProvider, region, URI.create(customEndpoint)));
}
use of software.amazon.awssdk.auth.credentials.StaticCredentialsProvider in project flink by apache.
the class GlueSchemaRegistryAvroKinesisITCase method setUp.
@Before
public void setUp() throws Exception {
Assume.assumeTrue("Access key not configured, skipping test...", !StringUtils.isNullOrWhitespaceOnly(ACCESS_KEY));
Assume.assumeTrue("Secret key not configured, skipping test...", !StringUtils.isNullOrWhitespaceOnly(SECRET_KEY));
StaticCredentialsProvider gsrCredentialsProvider = StaticCredentialsProvider.create(AwsBasicCredentials.create(ACCESS_KEY, SECRET_KEY));
Properties properties = KINESALITE.getContainerProperties();
kinesisClient = new GSRKinesisPubsubClient(properties, gsrCredentialsProvider);
kinesisClient.createStream(INPUT_STREAM, 2, properties);
kinesisClient.createStream(OUTPUT_STREAM, 2, properties);
System.setProperty(SdkSystemSetting.CBOR_ENABLED.property(), "false");
}
use of software.amazon.awssdk.auth.credentials.StaticCredentialsProvider in project flink by apache.
the class GlueSchemaRegistryJsonKinesisITCase method setUp.
@Before
public void setUp() throws Exception {
Assume.assumeTrue("Access key not configured, skipping test...", !StringUtils.isNullOrWhitespaceOnly(ACCESS_KEY));
Assume.assumeTrue("Secret key not configured, skipping test...", !StringUtils.isNullOrWhitespaceOnly(SECRET_KEY));
StaticCredentialsProvider gsrCredentialsProvider = StaticCredentialsProvider.create(AwsBasicCredentials.create(ACCESS_KEY, SECRET_KEY));
Properties properties = KINESALITE.getContainerProperties();
kinesisClient = new GSRKinesisPubsubClient(properties, gsrCredentialsProvider);
kinesisClient.createStream(INPUT_STREAM, 2, properties);
kinesisClient.createStream(OUTPUT_STREAM, 2, properties);
System.setProperty(SdkSystemSetting.CBOR_ENABLED.property(), "false");
}
Aggregations