From 812b254b4931c7b90221f1e53c84ecba4020383a Mon Sep 17 00:00:00 2001 From: Santiago Carmuega Date: Fri, 25 Mar 2022 16:17:49 -0300 Subject: [PATCH] fix: Implement missing S3 object naming conventions (#223) --- src/sinks/aws_lambda/setup.rs | 4 ++-- src/sinks/aws_s3/run.rs | 25 ++++++++++++++++++++++--- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/sinks/aws_lambda/setup.rs b/src/sinks/aws_lambda/setup.rs index 55061d3a..d64cfb09 100644 --- a/src/sinks/aws_lambda/setup.rs +++ b/src/sinks/aws_lambda/setup.rs @@ -30,11 +30,11 @@ impl SinkProvider for WithUtils { let retry_config = RetryConfig::new() .with_max_attempts(self.inner.max_retries.unwrap_or(DEFAULT_MAX_RETRIES)); - let sqs_config = aws_sdk_lambda::config::Builder::from(&aws_config) + let lambda_config = aws_sdk_lambda::config::Builder::from(&aws_config) .retry_config(retry_config) .build(); - let client = Client::from_conf(sqs_config); + let client = Client::from_conf(lambda_config); let function_name = self.inner.function_name.clone(); let utils = self.utils.clone(); diff --git a/src/sinks/aws_s3/run.rs b/src/sinks/aws_s3/run.rs index 89336e08..8e15d398 100644 --- a/src/sinks/aws_s3/run.rs +++ b/src/sinks/aws_s3/run.rs @@ -44,9 +44,28 @@ fn define_obj_key(prefix: &str, policy: &Naming, record: &BlockRecord) -> String Naming::Hash => format!("{}{}", prefix, record.hash), Naming::SlotHash => format!("{}{}.{}", prefix, record.slot, record.hash), Naming::BlockHash => format!("{}{}.{}", prefix, record.number, record.hash), - Naming::EpochHash => todo!(), - Naming::EpochSlotHash => todo!(), - Naming::EpochBlockHash => todo!(), + Naming::EpochHash => format!( + "{}{}.{}", + prefix, + record.epoch.unwrap_or_default(), + record.hash + ), + Naming::EpochSlotHash => format!( + "{}{}.{}.{}", + prefix, + record.epoch.unwrap_or_default(), + record.slot, + record.hash + ), + Naming::EpochBlockHash => { + format!( + "{}{}.{}.{}", + prefix, + record.epoch.unwrap_or_default(), + record.number, + record.hash + ) + } } }