aws_sdk_sagemaker/protocol_serde/
shape_auto_ml_security_config.rs1pub fn ser_auto_ml_security_config(
3 object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
4 input: &crate::types::AutoMlSecurityConfig,
5) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
6 if let Some(var_1) = &input.volume_kms_key_id {
7 object.key("VolumeKmsKeyId").string(var_1.as_str());
8 }
9 if let Some(var_2) = &input.enable_inter_container_traffic_encryption {
10 object.key("EnableInterContainerTrafficEncryption").boolean(*var_2);
11 }
12 if let Some(var_3) = &input.vpc_config {
13 #[allow(unused_mut)]
14 let mut object_4 = object.key("VpcConfig").start_object();
15 crate::protocol_serde::shape_vpc_config::ser_vpc_config(&mut object_4, var_3)?;
16 object_4.finish();
17 }
18 Ok(())
19}
20
21pub(crate) fn de_auto_ml_security_config<'a, I>(
22 tokens: &mut ::std::iter::Peekable<I>,
23 _value: &'a [u8],
24) -> ::std::result::Result<Option<crate::types::AutoMlSecurityConfig>, ::aws_smithy_json::deserialize::error::DeserializeError>
25where
26 I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
27{
28 match tokens.next().transpose()? {
29 Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
30 Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
31 #[allow(unused_mut)]
32 let mut builder = crate::types::builders::AutoMlSecurityConfigBuilder::default();
33 loop {
34 match tokens.next().transpose()? {
35 Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
36 Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
37 "VolumeKmsKeyId" => {
38 builder = builder.set_volume_kms_key_id(
39 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
40 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
41 .transpose()?,
42 );
43 }
44 "EnableInterContainerTrafficEncryption" => {
45 builder = builder.set_enable_inter_container_traffic_encryption(
46 ::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?,
47 );
48 }
49 "VpcConfig" => {
50 builder = builder.set_vpc_config(crate::protocol_serde::shape_vpc_config::de_vpc_config(tokens, _value)?);
51 }
52 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
53 },
54 other => {
55 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
56 "expected object key or end object, found: {other:?}"
57 )))
58 }
59 }
60 }
61 Ok(Some(builder.build()))
62 }
63 _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
64 "expected start object or null",
65 )),
66 }
67}