build(deps): update aws dependencies (#4194)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
Co-authored-by: Sanchith Hegde <sanchith.hegde@juspay.in>
This commit is contained in:
Chethan Rao
2025-03-19 16:48:46 +05:30
committed by GitHub
parent 5ee217175c
commit afca506369
6 changed files with 679 additions and 806 deletions

1402
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -26,9 +26,9 @@ currency_conversion = { version = "0.1.0", path = "../currency_conversion" }
#Third Party dependencies #Third Party dependencies
actix-web = "4.5.1" actix-web = "4.5.1"
async-trait = "0.1.79" async-trait = "0.1.79"
aws-config = { version = "1.1.9", features = ["behavior-version-latest"] } aws-config = { version = "1.5.10", features = ["behavior-version-latest"] }
aws-sdk-lambda = { version = "1.18.0" } aws-sdk-lambda = { version = "1.60.0" }
aws-smithy-types = { version = "1.1.8" } aws-smithy-types = { version = "1.3.0" }
bigdecimal = { version = "0.4.5", features = ["serde"] } bigdecimal = { version = "0.4.5", features = ["serde"] }
error-stack = "0.4.1" error-stack = "0.4.1"
futures = "0.3.30" futures = "0.3.30"
@ -38,7 +38,7 @@ reqwest = { version = "0.11.27", features = ["serde_json"] }
rust_decimal = "1.35" rust_decimal = "1.35"
serde = { version = "1.0.197", features = ["derive", "rc"] } serde = { version = "1.0.197", features = ["derive", "rc"] }
serde_json = "1.0.115" serde_json = "1.0.115"
sqlx = { version = "0.8.2", features = ["postgres", "runtime-tokio", "runtime-tokio-native-tls", "time", "bigdecimal"] } sqlx = { version = "0.8.3", features = ["postgres", "runtime-tokio", "runtime-tokio-native-tls", "time", "bigdecimal"] }
strum = { version = "0.26.2", features = ["derive"] } strum = { version = "0.26.2", features = ["derive"] }
thiserror = "1.0.58" thiserror = "1.0.58"
time = { version = "0.3.35", features = ["serde", "serde-well-known", "std"] } time = { version = "0.3.35", features = ["serde", "serde-well-known", "std"] }

View File

@ -17,12 +17,12 @@ dynamic_routing = ["dep:prost", "dep:tonic", "dep:tonic-reflection", "dep:tonic-
[dependencies] [dependencies]
async-trait = "0.1.79" async-trait = "0.1.79"
aws-config = { version = "0.55.3", optional = true } aws-config = { version = "1.5.10", optional = true, features = ["behavior-version-latest"] }
aws-sdk-kms = { version = "0.28.0", optional = true } aws-sdk-kms = { version = "1.51.0", optional = true }
aws-sdk-s3 = { version = "0.28.0", optional = true } aws-sdk-sesv2 = "1.57.0"
aws-sdk-sesv2 = "0.28.0" aws-sdk-sts = "1.51.0"
aws-sdk-sts = "0.28.0" aws-sdk-s3 = { version = "1.65.0", optional = true }
aws-smithy-client = "0.55.3" aws-smithy-runtime = "1.8.0"
base64 = "0.22.0" base64 = "0.22.0"
dyn-clone = "1.0.17" dyn-clone = "1.0.17"
error-stack = "0.4.1" error-stack = "0.4.1"

View File

@ -193,4 +193,8 @@ pub enum EmailError {
/// The expected feature is not implemented /// The expected feature is not implemented
#[error("Feature not implemented")] #[error("Feature not implemented")]
NotImplemented, NotImplemented,
/// An error occurred when building email content.
#[error("Error building email content")]
ContentBuildFailure,
} }

View File

@ -7,6 +7,7 @@ use aws_sdk_sesv2::{
Client, Client,
}; };
use aws_sdk_sts::config::Credentials; use aws_sdk_sts::config::Credentials;
use aws_smithy_runtime::client::http::hyper_014::HyperClientBuilder;
use common_utils::{errors::CustomResult, pii}; use common_utils::{errors::CustomResult, pii};
use error_stack::{report, ResultExt}; use error_stack::{report, ResultExt};
use hyper::Uri; use hyper::Uri;
@ -53,7 +54,7 @@ impl SESConfig {
pub enum AwsSesError { pub enum AwsSesError {
/// An error occurred in the SDK while sending email. /// An error occurred in the SDK while sending email.
#[error("Failed to Send Email {0:?}")] #[error("Failed to Send Email {0:?}")]
SendingFailure(aws_smithy_client::SdkError<SendEmailError>), SendingFailure(aws_sdk_sesv2::error::SdkError<SendEmailError>),
/// Configuration variable is missing to construct the email client /// Configuration variable is missing to construct the email client
#[error("Missing configuration variable {0}")] #[error("Missing configuration variable {0}")]
@ -131,29 +132,13 @@ impl AwsSes {
)?; )?;
let credentials = Credentials::new( let credentials = Credentials::new(
creds creds.access_key_id(),
.access_key_id() creds.secret_access_key(),
.ok_or( Some(creds.session_token().to_owned()),
report!(AwsSesError::TemporaryCredentialsMissing(format!( u64::try_from(creds.expiration().as_nanos())
"{role:?}" .ok()
))) .map(Duration::from_nanos)
.attach_printable("Access Key ID not found"), .and_then(|val| SystemTime::UNIX_EPOCH.checked_add(val)),
)?
.to_owned(),
creds
.secret_access_key()
.ok_or(
report!(AwsSesError::TemporaryCredentialsMissing(format!(
"{role:?}"
)))
.attach_printable("Secret Access Key not found"),
)?
.to_owned(),
creds.session_token().map(|s| s.to_owned()),
creds.expiration().and_then(|dt| {
SystemTime::UNIX_EPOCH
.checked_add(Duration::from_nanos(u64::try_from(dt.as_nanos()).ok()?))
}),
"custom_provider", "custom_provider",
); );
@ -176,15 +161,11 @@ impl AwsSes {
) -> CustomResult<aws_config::ConfigLoader, AwsSesError> { ) -> CustomResult<aws_config::ConfigLoader, AwsSesError> {
let region_provider = Region::new(region); let region_provider = Region::new(region);
let mut config = aws_config::from_env().region(region_provider); let mut config = aws_config::from_env().region(region_provider);
if let Some(proxy_url) = proxy_url { if let Some(proxy_url) = proxy_url {
let proxy_connector = Self::get_proxy_connector(proxy_url)?; let proxy_connector = Self::get_proxy_connector(proxy_url)?;
let provider_config = aws_config::provider_config::ProviderConfig::default() let http_client = HyperClientBuilder::new().build(proxy_connector);
.with_tcp_connector(proxy_connector.clone()); config = config.http_client(http_client);
let http_connector =
aws_smithy_client::hyper_ext::Adapter::builder().build(proxy_connector);
config = config
.configure(provider_config)
.http_connector(http_connector);
}; };
Ok(config) Ok(config)
} }
@ -218,7 +199,8 @@ impl EmailClient for AwsSes {
Content::builder() Content::builder()
.data(intermediate_string.into_inner()) .data(intermediate_string.into_inner())
.charset("UTF-8") .charset("UTF-8")
.build(), .build()
.change_context(EmailError::ContentBuildFailure)?,
) )
.build(); .build();
@ -250,7 +232,12 @@ impl EmailClient for AwsSes {
EmailContent::builder() EmailContent::builder()
.simple( .simple(
Message::builder() Message::builder()
.subject(Content::builder().data(subject).build()) .subject(
Content::builder()
.data(subject)
.build()
.change_context(EmailError::ContentBuildFailure)?,
)
.body(body) .body(body)
.build(), .build(),
) )

View File

@ -142,15 +142,15 @@ impl FileStorageInterface for AwsFileStorageClient {
enum AwsS3StorageError { enum AwsS3StorageError {
/// Error indicating that file upload to S3 failed. /// Error indicating that file upload to S3 failed.
#[error("File upload to S3 failed: {0:?}")] #[error("File upload to S3 failed: {0:?}")]
UploadFailure(aws_smithy_client::SdkError<PutObjectError>), UploadFailure(aws_sdk_s3::error::SdkError<PutObjectError>),
/// Error indicating that file retrieval from S3 failed. /// Error indicating that file retrieval from S3 failed.
#[error("File retrieve from S3 failed: {0:?}")] #[error("File retrieve from S3 failed: {0:?}")]
RetrieveFailure(aws_smithy_client::SdkError<GetObjectError>), RetrieveFailure(aws_sdk_s3::error::SdkError<GetObjectError>),
/// Error indicating that file deletion from S3 failed. /// Error indicating that file deletion from S3 failed.
#[error("File delete from S3 failed: {0:?}")] #[error("File delete from S3 failed: {0:?}")]
DeleteFailure(aws_smithy_client::SdkError<DeleteObjectError>), DeleteFailure(aws_sdk_s3::error::SdkError<DeleteObjectError>),
/// Unknown error occurred. /// Unknown error occurred.
#[error("Unknown error occurred: {0:?}")] #[error("Unknown error occurred: {0:?}")]