aws_sdk_codepipeline/protocol_serde/
shape_output_artifact.rs1pub fn ser_output_artifact(
3 object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
4 input: &crate::types::OutputArtifact,
5) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
6 {
7 object.key("name").string(input.name.as_str());
8 }
9 if let Some(var_1) = &input.files {
10 let mut array_2 = object.key("files").start_array();
11 for item_3 in var_1 {
12 {
13 array_2.value().string(item_3.as_str());
14 }
15 }
16 array_2.finish();
17 }
18 Ok(())
19}
20
21pub(crate) fn de_output_artifact<'a, I>(
22 tokens: &mut ::std::iter::Peekable<I>,
23) -> ::std::result::Result<Option<crate::types::OutputArtifact>, ::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::OutputArtifactBuilder::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 "name" => {
37 builder = builder.set_name(
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 "files" => {
44 builder = builder.set_files(crate::protocol_serde::shape_file_path_list::de_file_path_list(tokens)?);
45 }
46 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
47 },
48 other => {
49 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
50 "expected object key or end object, found: {:?}",
51 other
52 )))
53 }
54 }
55 }
56 Ok(Some(crate::serde_util::output_artifact_correct_errors(builder).build().map_err(
57 |err| ::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err),
58 )?))
59 }
60 _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
61 "expected start object or null",
62 )),
63 }
64}