aws_sdk_mediapackagev2/protocol_serde/
shape_get_dash_manifest_configuration.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub(crate) fn de_get_dash_manifest_configuration<'a, I>(
3    tokens: &mut ::std::iter::Peekable<I>,
4) -> ::std::result::Result<Option<crate::types::GetDashManifestConfiguration>, ::aws_smithy_json::deserialize::error::DeserializeError>
5where
6    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
7{
8    match tokens.next().transpose()? {
9        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
10        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
11            #[allow(unused_mut)]
12            let mut builder = crate::types::builders::GetDashManifestConfigurationBuilder::default();
13            loop {
14                match tokens.next().transpose()? {
15                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
16                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
17                        "ManifestName" => {
18                            builder = builder.set_manifest_name(
19                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
20                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
21                                    .transpose()?,
22                            );
23                        }
24                        "Url" => {
25                            builder = builder.set_url(
26                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
27                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
28                                    .transpose()?,
29                            );
30                        }
31                        "ManifestWindowSeconds" => {
32                            builder = builder.set_manifest_window_seconds(
33                                ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
34                                    .map(i32::try_from)
35                                    .transpose()?,
36                            );
37                        }
38                        "FilterConfiguration" => {
39                            builder =
40                                builder.set_filter_configuration(crate::protocol_serde::shape_filter_configuration::de_filter_configuration(tokens)?);
41                        }
42                        "MinUpdatePeriodSeconds" => {
43                            builder = builder.set_min_update_period_seconds(
44                                ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
45                                    .map(i32::try_from)
46                                    .transpose()?,
47                            );
48                        }
49                        "MinBufferTimeSeconds" => {
50                            builder = builder.set_min_buffer_time_seconds(
51                                ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
52                                    .map(i32::try_from)
53                                    .transpose()?,
54                            );
55                        }
56                        "SuggestedPresentationDelaySeconds" => {
57                            builder = builder.set_suggested_presentation_delay_seconds(
58                                ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
59                                    .map(i32::try_from)
60                                    .transpose()?,
61                            );
62                        }
63                        "SegmentTemplateFormat" => {
64                            builder = builder.set_segment_template_format(
65                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
66                                    .map(|s| s.to_unescaped().map(|u| crate::types::DashSegmentTemplateFormat::from(u.as_ref())))
67                                    .transpose()?,
68                            );
69                        }
70                        "PeriodTriggers" => {
71                            builder =
72                                builder.set_period_triggers(crate::protocol_serde::shape_dash_period_triggers::de_dash_period_triggers(tokens)?);
73                        }
74                        "ScteDash" => {
75                            builder = builder.set_scte_dash(crate::protocol_serde::shape_scte_dash::de_scte_dash(tokens)?);
76                        }
77                        "DrmSignaling" => {
78                            builder = builder.set_drm_signaling(
79                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
80                                    .map(|s| s.to_unescaped().map(|u| crate::types::DashDrmSignaling::from(u.as_ref())))
81                                    .transpose()?,
82                            );
83                        }
84                        "UtcTiming" => {
85                            builder = builder.set_utc_timing(crate::protocol_serde::shape_dash_utc_timing::de_dash_utc_timing(tokens)?);
86                        }
87                        "Profiles" => {
88                            builder = builder.set_profiles(crate::protocol_serde::shape_dash_profiles::de_dash_profiles(tokens)?);
89                        }
90                        "BaseUrls" => {
91                            builder = builder.set_base_urls(crate::protocol_serde::shape_dash_base_urls::de_dash_base_urls(tokens)?);
92                        }
93                        "ProgramInformation" => {
94                            builder = builder.set_program_information(
95                                crate::protocol_serde::shape_dash_program_information::de_dash_program_information(tokens)?,
96                            );
97                        }
98                        "DvbSettings" => {
99                            builder = builder.set_dvb_settings(crate::protocol_serde::shape_dash_dvb_settings::de_dash_dvb_settings(tokens)?);
100                        }
101                        "Compactness" => {
102                            builder = builder.set_compactness(
103                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
104                                    .map(|s| s.to_unescaped().map(|u| crate::types::DashCompactness::from(u.as_ref())))
105                                    .transpose()?,
106                            );
107                        }
108                        "SubtitleConfiguration" => {
109                            builder = builder.set_subtitle_configuration(
110                                crate::protocol_serde::shape_dash_subtitle_configuration::de_dash_subtitle_configuration(tokens)?,
111                            );
112                        }
113                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
114                    },
115                    other => {
116                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
117                            "expected object key or end object, found: {:?}",
118                            other
119                        )))
120                    }
121                }
122            }
123            Ok(Some(
124                crate::serde_util::get_dash_manifest_configuration_correct_errors(builder)
125                    .build()
126                    .map_err(|err| ::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err))?,
127            ))
128        }
129        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
130            "expected start object or null",
131        )),
132    }
133}