1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | pub fn ser_evaluation(
|
3 - | object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
|
4 - | input: &crate::types::Evaluation,
|
5 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
|
6 - | {
|
7 - | object.key("ComplianceResourceType").string(input.compliance_resource_type.as_str());
|
8 - | }
|
9 - | {
|
10 - | object.key("ComplianceResourceId").string(input.compliance_resource_id.as_str());
|
11 - | }
|
12 - | {
|
13 - | object.key("ComplianceType").string(input.compliance_type.as_str());
|
14 - | }
|
15 - | if let Some(var_1) = &input.annotation {
|
16 - | object.key("Annotation").string(var_1.as_str());
|
17 - | }
|
18 - | {
|
19 - | object
|
20 - | .key("OrderingTimestamp")
|
21 - | .date_time(&input.ordering_timestamp, ::aws_smithy_types::date_time::Format::EpochSeconds)?;
|
22 - | }
|
23 - | Ok(())
|
24 - | }
|
25 - |
|
26 - | pub(crate) fn de_evaluation<'a, I>(
|
27 - | tokens: &mut ::std::iter::Peekable<I>,
|
28 - | _value: &'a [u8],
|
29 - | ) -> ::std::result::Result<Option<crate::types::Evaluation>, ::aws_smithy_json::deserialize::error::DeserializeError>
|
30 - | where
|
31 - | I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
|
32 - | {
|
33 - | match tokens.next().transpose()? {
|
34 - | Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
|
35 - | Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
|
36 - | #[allow(unused_mut)]
|
37 - | let mut builder = crate::types::builders::EvaluationBuilder::default();
|
38 - | loop {
|
39 - | match tokens.next().transpose()? {
|
40 - | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
41 - | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
|
42 - | "ComplianceResourceType" => {
|
43 - | builder = builder.set_compliance_resource_type(
|
44 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
45 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
46 - | .transpose()?,
|
47 - | );
|
48 - | }
|
49 - | "ComplianceResourceId" => {
|
50 - | builder = builder.set_compliance_resource_id(
|
51 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
52 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
53 - | .transpose()?,
|
54 - | );
|
55 - | }
|
56 - | "ComplianceType" => {
|
57 - | builder = builder.set_compliance_type(
|
58 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
59 - | .map(|s| s.to_unescaped().map(|u| crate::types::ComplianceType::from(u.as_ref())))
|
60 - | .transpose()?,
|
61 - | );
|
62 - | }
|
63 - | "Annotation" => {
|
64 - | builder = builder.set_annotation(
|
65 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
66 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
67 - | .transpose()?,
|
68 - | );
|
69 - | }
|
70 - | "OrderingTimestamp" => {
|
71 - | builder = builder.set_ordering_timestamp(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
|
72 - | tokens.next(),
|
73 - | ::aws_smithy_types::date_time::Format::EpochSeconds,
|
74 - | )?);
|
75 - | }
|
76 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
77 - | },
|
78 - | other => {
|
79 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
80 - | "expected object key or end object, found: {other:?}"
|
81 - | )))
|
82 - | }
|
83 - | }
|
84 - | }
|
85 - | Ok(Some(crate::serde_util::evaluation_correct_errors(builder).build().map_err(|err| {
|
86 - | ::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err)
|
87 - | })?))
|
88 - | }
|
89 - | _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
90 - | "expected start object or null",
|
91 - | )),
|
92 - | }
|
93 - | }
|