Skip to content

Commit

Permalink
s3s-aws: proxy: improve readability
Browse files Browse the repository at this point in the history
  • Loading branch information
nomick committed Jan 8, 2024
1 parent 48cff0b commit 6d547b2
Show file tree
Hide file tree
Showing 4 changed files with 212 additions and 1,050 deletions.
14 changes: 2 additions & 12 deletions codegen/src/aws_proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ pub fn codegen(ops: &Operations, rust_types: &RustTypes) {
"use s3s::S3;"
"use s3s::{S3Request, S3Response};"
"use s3s::S3Result;"
"use s3s::header::{X_AMZ_REQUEST_ID, X_AMZ_ID_2};"
""
"use tracing::debug;"
""
Expand Down Expand Up @@ -88,18 +87,9 @@ pub fn codegen(ops: &Operations, rust_types: &RustTypes) {
glines![
"match result {"
" Ok(output) => {"
" let request_id = super::meta::request_id(&output)?;"
" let ext_request_id = super::meta::extended_request_id(&output)?;"
" let headers = super::meta::build_headers(&output)?;"
" let output = try_from_aws(output)?;"
" debug!(?output);"
" let mut res = S3Response::new(output);"
" if let Some(val) = request_id {"
" res.headers.insert(X_AMZ_REQUEST_ID, val);"
" }"
" if let Some(val) = ext_request_id {"
" res.headers.insert(X_AMZ_ID_2, val);"
" }"
" Ok(res)"
" Ok(S3Response::new_with_headers(output, headers))"
" },"
" Err(e) => Err(wrap_sdk_error!(e)),"
"}"
Expand Down
Loading

0 comments on commit 6d547b2

Please sign in to comment.