Skip to main content

aws_sdk_mediatailor/protocol_serde/
shape_update_vod_source.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(clippy::unnecessary_wraps)]
3pub fn de_update_vod_source_http_error(
4    _response_status: u16,
5    _response_headers: &::aws_smithy_runtime_api::http::Headers,
6    _response_body: &[u8],
7) -> std::result::Result<crate::operation::update_vod_source::UpdateVodSourceOutput, crate::operation::update_vod_source::UpdateVodSourceError> {
8    #[allow(unused_mut)]
9    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
10        .map_err(crate::operation::update_vod_source::UpdateVodSourceError::unhandled)?;
11    generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
12    let generic = generic_builder.build();
13    Err(crate::operation::update_vod_source::UpdateVodSourceError::generic(generic))
14}
15
16#[allow(clippy::unnecessary_wraps)]
17pub fn de_update_vod_source_http_response(
18    _response_status: u16,
19    _response_headers: &::aws_smithy_runtime_api::http::Headers,
20    _response_body: &[u8],
21) -> std::result::Result<crate::operation::update_vod_source::UpdateVodSourceOutput, crate::operation::update_vod_source::UpdateVodSourceError> {
22    Ok({
23        #[allow(unused_mut)]
24        let mut output = crate::operation::update_vod_source::builders::UpdateVodSourceOutputBuilder::default();
25        output = crate::protocol_serde::shape_update_vod_source::de_update_vod_source(_response_body, output)
26            .map_err(crate::operation::update_vod_source::UpdateVodSourceError::unhandled)?;
27        output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
28        output.build()
29    })
30}
31
32pub fn ser_update_vod_source_input(
33    input: &crate::operation::update_vod_source::UpdateVodSourceInput,
34) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
35    let mut out = String::new();
36    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
37    crate::protocol_serde::shape_update_vod_source_input::ser_update_vod_source_input_input(&mut object, input)?;
38    object.finish();
39    Ok(::aws_smithy_types::body::SdkBody::from(out))
40}
41
42pub(crate) fn de_update_vod_source(
43    _value: &[u8],
44    mut builder: crate::operation::update_vod_source::builders::UpdateVodSourceOutputBuilder,
45) -> ::std::result::Result<
46    crate::operation::update_vod_source::builders::UpdateVodSourceOutputBuilder,
47    ::aws_smithy_json::deserialize::error::DeserializeError,
48> {
49    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
50    let tokens = &mut tokens_owned;
51    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
52    loop {
53        match tokens.next().transpose()? {
54            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
55            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
56                "Arn" => {
57                    builder = builder.set_arn(
58                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
59                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
60                            .transpose()?,
61                    );
62                }
63                "CreationTime" => {
64                    builder = builder.set_creation_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
65                        tokens.next(),
66                        ::aws_smithy_types::date_time::Format::EpochSeconds,
67                    )?);
68                }
69                "HttpPackageConfigurations" => {
70                    builder = builder.set_http_package_configurations(
71                        crate::protocol_serde::shape_http_package_configurations::de_http_package_configurations(tokens, _value)?,
72                    );
73                }
74                "LastModifiedTime" => {
75                    builder = builder.set_last_modified_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
76                        tokens.next(),
77                        ::aws_smithy_types::date_time::Format::EpochSeconds,
78                    )?);
79                }
80                "SourceLocationName" => {
81                    builder = builder.set_source_location_name(
82                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
83                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
84                            .transpose()?,
85                    );
86                }
87                "tags" => {
88                    builder = builder.set_tags(crate::protocol_serde::shape_map_of_string::de_map_of_string(tokens, _value)?);
89                }
90                "VodSourceName" => {
91                    builder = builder.set_vod_source_name(
92                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
93                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
94                            .transpose()?,
95                    );
96                }
97                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
98            },
99            other => {
100                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
101                    "expected object key or end object, found: {other:?}"
102                )))
103            }
104        }
105    }
106    if tokens.next().is_some() {
107        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
108            "found more JSON tokens after completing parsing",
109        ));
110    }
111    Ok(builder)
112}