aws_sdk_s3/protocol_serde/
shape_server_side_encryption_rule.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub fn ser_server_side_encryption_rule(
    input: &crate::types::ServerSideEncryptionRule,
    writer: ::aws_smithy_xml::encode::ElWriter,
) -> Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    #[allow(unused_mut)]
    let mut scope = writer.finish();
    if let Some(var_1) = &input.apply_server_side_encryption_by_default {
        let inner_writer = scope.start_el("ApplyServerSideEncryptionByDefault");
        crate::protocol_serde::shape_server_side_encryption_by_default::ser_server_side_encryption_by_default(var_1, inner_writer)?
    }
    if let Some(var_2) = &input.bucket_key_enabled {
        let mut inner_writer = scope.start_el("BucketKeyEnabled").finish();
        inner_writer.data(::aws_smithy_types::primitive::Encoder::from(*var_2).encode());
    }
    scope.finish();
    Ok(())
}

#[allow(clippy::needless_question_mark)]
pub fn de_server_side_encryption_rule(
    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
) -> Result<crate::types::ServerSideEncryptionRule, ::aws_smithy_xml::decode::XmlDecodeError> {
    #[allow(unused_mut)]
    let mut builder = crate::types::ServerSideEncryptionRule::builder();
    while let Some(mut tag) = decoder.next_tag() {
        match tag.start_el() {
            s if s.matches("ApplyServerSideEncryptionByDefault") /* ApplyServerSideEncryptionByDefault com.amazonaws.s3#ServerSideEncryptionRule$ApplyServerSideEncryptionByDefault */ =>  {
                let var_3 =
                    Some(
                        crate::protocol_serde::shape_server_side_encryption_by_default::de_server_side_encryption_by_default(&mut tag)
                        ?
                    )
                ;
                builder = builder.set_apply_server_side_encryption_by_default(var_3);
            }
            ,
            s if s.matches("BucketKeyEnabled") /* BucketKeyEnabled com.amazonaws.s3#ServerSideEncryptionRule$BucketKeyEnabled */ =>  {
                let var_4 =
                    Some(
                         {
                            <bool as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            )
                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.s3#BucketKeyEnabled`)"))
                        }
                        ?
                    )
                ;
                builder = builder.set_bucket_key_enabled(var_4);
            }
            ,
            _ => {}
        }
    }
    Ok(builder.build())
}