Unverified Commit ba0a4eb4 authored by Nugine's avatar Nugine
Browse files

codegen: aws_proxy: checksum algorithm

parent 7cf97ceb
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -43,6 +43,15 @@ pub fn codegen(ops: &Operations, rust_types: &RustTypes, g: &mut Codegen) {
                    s => s,
                };

                // hack
                if op.name == "PutObject" && field.type_ == "ChecksumAlgorithm" {
                    assert!(field.option_type);
                    let default_val = "aws_sdk_s3::model::ChecksumAlgorithm::Sha256";
                    let val = f!("try_into_aws(input.{s3s_field_name})?.or(Some({default_val}))");
                    g.ln(f!("b = b.set_{aws_field_name}({val});"));
                    continue;
                }

                if field.option_type {
                    g.ln(f!("b = b.set_{aws_field_name}(try_into_aws(input.{s3s_field_name})?);"));
                } else {
+3 −1
Original line number Diff line number Diff line
@@ -1801,7 +1801,9 @@ impl S3 for Proxy {
        b = b.set_bucket(Some(try_into_aws(input.bucket)?));
        b = b.set_bucket_key_enabled(Some(try_into_aws(input.bucket_key_enabled)?));
        b = b.set_cache_control(try_into_aws(input.cache_control)?);
        b = b.set_checksum_algorithm(try_into_aws(input.checksum_algorithm)?);
        b = b.set_checksum_algorithm(
            try_into_aws(input.checksum_algorithm)?.or(Some(aws_sdk_s3::model::ChecksumAlgorithm::Sha256)),
        );
        b = b.set_checksum_crc32(try_into_aws(input.checksum_crc32)?);
        b = b.set_checksum_crc32_c(try_into_aws(input.checksum_crc32c)?);
        b = b.set_checksum_sha1(try_into_aws(input.checksum_sha1)?);