aws_sdk_greengrass/protocol_serde/
shape_function_default_execution_config.rs1pub fn ser_function_default_execution_config(
3 object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
4 input: &crate::types::FunctionDefaultExecutionConfig,
5) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
6 if let Some(var_1) = &input.isolation_mode {
7 object.key("IsolationMode").string(var_1.as_str());
8 }
9 if let Some(var_2) = &input.run_as {
10 #[allow(unused_mut)]
11 let mut object_3 = object.key("RunAs").start_object();
12 crate::protocol_serde::shape_function_run_as_config::ser_function_run_as_config(&mut object_3, var_2)?;
13 object_3.finish();
14 }
15 Ok(())
16}
17
18pub(crate) fn de_function_default_execution_config<'a, I>(
19 tokens: &mut ::std::iter::Peekable<I>,
20) -> ::std::result::Result<Option<crate::types::FunctionDefaultExecutionConfig>, ::aws_smithy_json::deserialize::error::DeserializeError>
21where
22 I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
23{
24 match tokens.next().transpose()? {
25 Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
26 Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
27 #[allow(unused_mut)]
28 let mut builder = crate::types::builders::FunctionDefaultExecutionConfigBuilder::default();
29 loop {
30 match tokens.next().transpose()? {
31 Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
32 Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
33 "IsolationMode" => {
34 builder = builder.set_isolation_mode(
35 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
36 .map(|s| s.to_unescaped().map(|u| crate::types::FunctionIsolationMode::from(u.as_ref())))
37 .transpose()?,
38 );
39 }
40 "RunAs" => {
41 builder = builder.set_run_as(crate::protocol_serde::shape_function_run_as_config::de_function_run_as_config(tokens)?);
42 }
43 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
44 },
45 other => {
46 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
47 "expected object key or end object, found: {other:?}"
48 )))
49 }
50 }
51 }
52 Ok(Some(builder.build()))
53 }
54 _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
55 "expected start object or null",
56 )),
57 }
58}