aws_sdk_devopsguru/protocol_serde/
shape_performance_insights_metric_query.rs1pub(crate) fn de_performance_insights_metric_query<'a, I>(
3 tokens: &mut ::std::iter::Peekable<I>,
4 _value: &'a [u8],
5) -> ::std::result::Result<Option<crate::types::PerformanceInsightsMetricQuery>, ::aws_smithy_json::deserialize::error::DeserializeError>
6where
7 I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
8{
9 match tokens.next().transpose()? {
10 Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
11 Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
12 #[allow(unused_mut)]
13 let mut builder = crate::types::builders::PerformanceInsightsMetricQueryBuilder::default();
14 loop {
15 match tokens.next().transpose()? {
16 Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
17 Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
18 "Metric" => {
19 builder = builder.set_metric(
20 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
21 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
22 .transpose()?,
23 );
24 }
25 "GroupBy" => {
26 builder = builder.set_group_by(
27 crate::protocol_serde::shape_performance_insights_metric_dimension_group::de_performance_insights_metric_dimension_group(tokens, _value)?
28 );
29 }
30 "Filter" => {
31 builder = builder.set_filter(
32 crate::protocol_serde::shape_performance_insights_metric_filter_map::de_performance_insights_metric_filter_map(
33 tokens, _value,
34 )?,
35 );
36 }
37 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
38 },
39 other => {
40 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
41 "expected object key or end object, found: {other:?}"
42 )))
43 }
44 }
45 }
46 Ok(Some(builder.build()))
47 }
48 _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
49 "expected start object or null",
50 )),
51 }
52}