Skip to content

Commit

Permalink
Use Arc for credentials
Browse files Browse the repository at this point in the history
Also resolve a couple of TODOs that are stale.

Just create the Resolver pending
#4685

Remove comment about FIFO handling as it seems to be the same from the
consumer side as a standard queue.

Signed-off-by: Jesse Szwedko <jesse@szwedko.me>
  • Loading branch information
jszwedko committed Oct 23, 2020
1 parent 22c57f9 commit 4189427
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions src/sources/aws_s3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ use tokio_util::codec::FramedRead;
// * Revisit configuration of queue. Should we take the URL instead?
// * At the least, support setting a differente queue owner
// * Revisit configuration of SQS strategy (intrnal vs. external tagging)
// * Move AWS utils from sink to general
// * Make sure we are handling shutdown well
// * Consider any special handling of FIFO SQS queues
// * Consider having helper methods stream data and have top-level forward to pipeline
// * Consider / decide on multi-region S3 support (handling messages referring to buckets in
// multiple regions)
Expand Down Expand Up @@ -158,19 +156,16 @@ impl AwsS3Config {
) -> Result<SqsIngestor, CreateSqsIngestorError> {
match self.sqs {
Some(ref sqs) => {
// TODO:
// * move resolver?
// * try cloning credentials provider again?
let resolver = Resolver;
let client = rusoto::client(resolver).with_context(|| Client {})?;
let creds =
let creds: std::sync::Arc<rusoto::AwsCredentialsProvider> =
rusoto::AwsCredentialsProvider::new(&sqs.region, self.assume_role.clone())
.with_context(|| Credentials {})?;
let sqs_client = SqsClient::new_with(client.clone(), creds, sqs.region.clone());
let creds =
rusoto::AwsCredentialsProvider::new(&sqs.region, self.assume_role.clone())
.with_context(|| Credentials {})?;
let s3_client = S3Client::new_with(client.clone(), creds, sqs.region.clone());
.with_context(|| Credentials {})?
.into();
let sqs_client =
SqsClient::new_with(client.clone(), creds.clone(), sqs.region.clone());
let s3_client =
S3Client::new_with(client.clone(), creds.clone(), sqs.region.clone());

SqsIngestor::new(
sqs_client,
Expand Down

0 comments on commit 4189427

Please sign in to comment.