aws_sdk_bedrock/protocol_serde/
shape_vpc_config.rs1pub fn ser_vpc_config(
3 object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
4 input: &crate::types::VpcConfig,
5) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
6 {
7 let mut array_1 = object.key("subnetIds").start_array();
8 for item_2 in &input.subnet_ids {
9 {
10 array_1.value().string(item_2.as_str());
11 }
12 }
13 array_1.finish();
14 }
15 {
16 let mut array_3 = object.key("securityGroupIds").start_array();
17 for item_4 in &input.security_group_ids {
18 {
19 array_3.value().string(item_4.as_str());
20 }
21 }
22 array_3.finish();
23 }
24 Ok(())
25}
26
27pub(crate) fn de_vpc_config<'a, I>(
28 tokens: &mut ::std::iter::Peekable<I>,
29) -> ::std::result::Result<Option<crate::types::VpcConfig>, ::aws_smithy_json::deserialize::error::DeserializeError>
30where
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::VpcConfigBuilder::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 "subnetIds" => {
43 builder = builder.set_subnet_ids(crate::protocol_serde::shape_subnet_ids::de_subnet_ids(tokens)?);
44 }
45 "securityGroupIds" => {
46 builder = builder.set_security_group_ids(crate::protocol_serde::shape_security_group_ids::de_security_group_ids(tokens)?);
47 }
48 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
49 },
50 other => {
51 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
52 "expected object key or end object, found: {other:?}"
53 )))
54 }
55 }
56 }
57 Ok(Some(crate::serde_util::vpc_config_correct_errors(builder).build().map_err(|err| {
58 ::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err)
59 })?))
60 }
61 _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
62 "expected start object or null",
63 )),
64 }
65}