aws_sdk_datasync/protocol_serde/
shape_s3_manifest_config.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub fn ser_s3_manifest_config(
3    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
4    input: &crate::types::S3ManifestConfig,
5) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
6    {
7        object.key("ManifestObjectPath").string(input.manifest_object_path.as_str());
8    }
9    {
10        object.key("BucketAccessRoleArn").string(input.bucket_access_role_arn.as_str());
11    }
12    {
13        object.key("S3BucketArn").string(input.s3_bucket_arn.as_str());
14    }
15    if let Some(var_1) = &input.manifest_object_version_id {
16        object.key("ManifestObjectVersionId").string(var_1.as_str());
17    }
18    Ok(())
19}
20
21pub(crate) fn de_s3_manifest_config<'a, I>(
22    tokens: &mut ::std::iter::Peekable<I>,
23) -> ::std::result::Result<Option<crate::types::S3ManifestConfig>, ::aws_smithy_json::deserialize::error::DeserializeError>
24where
25    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
26{
27    match tokens.next().transpose()? {
28        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
29        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
30            #[allow(unused_mut)]
31            let mut builder = crate::types::builders::S3ManifestConfigBuilder::default();
32            loop {
33                match tokens.next().transpose()? {
34                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
35                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
36                        "ManifestObjectPath" => {
37                            builder = builder.set_manifest_object_path(
38                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
39                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
40                                    .transpose()?,
41                            );
42                        }
43                        "BucketAccessRoleArn" => {
44                            builder = builder.set_bucket_access_role_arn(
45                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
46                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
47                                    .transpose()?,
48                            );
49                        }
50                        "S3BucketArn" => {
51                            builder = builder.set_s3_bucket_arn(
52                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
53                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
54                                    .transpose()?,
55                            );
56                        }
57                        "ManifestObjectVersionId" => {
58                            builder = builder.set_manifest_object_version_id(
59                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
60                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
61                                    .transpose()?,
62                            );
63                        }
64                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
65                    },
66                    other => {
67                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
68                            "expected object key or end object, found: {:?}",
69                            other
70                        )))
71                    }
72                }
73            }
74            Ok(Some(crate::serde_util::s3_manifest_config_correct_errors(builder).build().map_err(
75                |err| ::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err),
76            )?))
77        }
78        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
79            "expected start object or null",
80        )),
81    }
82}