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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub fn ser_aws_cloud_front_distribution_details(
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::types::AwsCloudFrontDistributionDetails,
) -> Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    if let Some(var_1) = &input.cache_behaviors {
        #[allow(unused_mut)]
        let mut object_2 = object.key("CacheBehaviors").start_object();
        crate::protocol_serde::shape_aws_cloud_front_distribution_cache_behaviors::ser_aws_cloud_front_distribution_cache_behaviors(
            &mut object_2,
            var_1,
        )?;
        object_2.finish();
    }
    if let Some(var_3) = &input.default_cache_behavior {
        #[allow(unused_mut)]
        let mut object_4 = object.key("DefaultCacheBehavior").start_object();
        crate::protocol_serde::shape_aws_cloud_front_distribution_default_cache_behavior::ser_aws_cloud_front_distribution_default_cache_behavior(
            &mut object_4,
            var_3,
        )?;
        object_4.finish();
    }
    if let Some(var_5) = &input.default_root_object {
        object.key("DefaultRootObject").string(var_5.as_str());
    }
    if let Some(var_6) = &input.domain_name {
        object.key("DomainName").string(var_6.as_str());
    }
    if let Some(var_7) = &input.e_tag {
        object.key("ETag").string(var_7.as_str());
    }
    if let Some(var_8) = &input.last_modified_time {
        object.key("LastModifiedTime").string(var_8.as_str());
    }
    if let Some(var_9) = &input.logging {
        #[allow(unused_mut)]
        let mut object_10 = object.key("Logging").start_object();
        crate::protocol_serde::shape_aws_cloud_front_distribution_logging::ser_aws_cloud_front_distribution_logging(&mut object_10, var_9)?;
        object_10.finish();
    }
    if let Some(var_11) = &input.origins {
        #[allow(unused_mut)]
        let mut object_12 = object.key("Origins").start_object();
        crate::protocol_serde::shape_aws_cloud_front_distribution_origins::ser_aws_cloud_front_distribution_origins(&mut object_12, var_11)?;
        object_12.finish();
    }
    if let Some(var_13) = &input.origin_groups {
        #[allow(unused_mut)]
        let mut object_14 = object.key("OriginGroups").start_object();
        crate::protocol_serde::shape_aws_cloud_front_distribution_origin_groups::ser_aws_cloud_front_distribution_origin_groups(
            &mut object_14,
            var_13,
        )?;
        object_14.finish();
    }
    if let Some(var_15) = &input.viewer_certificate {
        #[allow(unused_mut)]
        let mut object_16 = object.key("ViewerCertificate").start_object();
        crate::protocol_serde::shape_aws_cloud_front_distribution_viewer_certificate::ser_aws_cloud_front_distribution_viewer_certificate(
            &mut object_16,
            var_15,
        )?;
        object_16.finish();
    }
    if let Some(var_17) = &input.status {
        object.key("Status").string(var_17.as_str());
    }
    if let Some(var_18) = &input.web_acl_id {
        object.key("WebAclId").string(var_18.as_str());
    }
    Ok(())
}

pub(crate) fn de_aws_cloud_front_distribution_details<'a, I>(
    tokens: &mut ::std::iter::Peekable<I>,
) -> Result<Option<crate::types::AwsCloudFrontDistributionDetails>, ::aws_smithy_json::deserialize::error::DeserializeError>
where
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
{
    match tokens.next().transpose()? {
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
            #[allow(unused_mut)]
            let mut builder = crate::types::builders::AwsCloudFrontDistributionDetailsBuilder::default();
            loop {
                match tokens.next().transpose()? {
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
                        "CacheBehaviors" => {
                            builder = builder.set_cache_behaviors(
                                    crate::protocol_serde::shape_aws_cloud_front_distribution_cache_behaviors::de_aws_cloud_front_distribution_cache_behaviors(tokens)?
                                );
                        }
                        "DefaultCacheBehavior" => {
                            builder = builder.set_default_cache_behavior(
                                    crate::protocol_serde::shape_aws_cloud_front_distribution_default_cache_behavior::de_aws_cloud_front_distribution_default_cache_behavior(tokens)?
                                );
                        }
                        "DefaultRootObject" => {
                            builder = builder.set_default_root_object(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "DomainName" => {
                            builder = builder.set_domain_name(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "ETag" => {
                            builder = builder.set_e_tag(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "LastModifiedTime" => {
                            builder = builder.set_last_modified_time(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "Logging" => {
                            builder = builder.set_logging(
                                crate::protocol_serde::shape_aws_cloud_front_distribution_logging::de_aws_cloud_front_distribution_logging(tokens)?,
                            );
                        }
                        "Origins" => {
                            builder = builder.set_origins(
                                crate::protocol_serde::shape_aws_cloud_front_distribution_origins::de_aws_cloud_front_distribution_origins(tokens)?,
                            );
                        }
                        "OriginGroups" => {
                            builder = builder.set_origin_groups(
                                    crate::protocol_serde::shape_aws_cloud_front_distribution_origin_groups::de_aws_cloud_front_distribution_origin_groups(tokens)?
                                );
                        }
                        "ViewerCertificate" => {
                            builder = builder.set_viewer_certificate(
                                    crate::protocol_serde::shape_aws_cloud_front_distribution_viewer_certificate::de_aws_cloud_front_distribution_viewer_certificate(tokens)?
                                );
                        }
                        "Status" => {
                            builder = builder.set_status(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "WebAclId" => {
                            builder = builder.set_web_acl_id(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
                    },
                    other => {
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
                            "expected object key or end object, found: {:?}",
                            other
                        )))
                    }
                }
            }
            Ok(Some(builder.build()))
        }
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
            "expected start object or null",
        )),
    }
}