pub fn ser_vcf_hostnames(
object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::types::VcfHostnames,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
{
object.key("vCenter").string(input.v_center.as_str());
}
{
object.key("nsx").string(input.nsx.as_str());
}
{
object.key("nsxManager1").string(input.nsx_manager1.as_str());
}
{
object.key("nsxManager2").string(input.nsx_manager2.as_str());
}
{
object.key("nsxManager3").string(input.nsx_manager3.as_str());
}
{
object.key("nsxEdge1").string(input.nsx_edge1.as_str());
}
{
object.key("nsxEdge2").string(input.nsx_edge2.as_str());
}
{
object.key("sddcManager").string(input.sddc_manager.as_str());
}
{
object.key("cloudBuilder").string(input.cloud_builder.as_str());
}
Ok(())
}
pub(crate) fn de_vcf_hostnames<'a, I>(
tokens: &mut ::std::iter::Peekable<I>,
_value: &'a [u8],
) -> ::std::result::Result<Option<crate::types::VcfHostnames>, ::aws_smithy_json::deserialize::error::DeserializeError>
where
I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
{
match tokens.next().transpose()? {
Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
#[allow(unused_mut)]
let mut builder = crate::types::builders::VcfHostnamesBuilder::default();
loop {
match tokens.next().transpose()? {
Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
"vCenter" => {
builder = builder.set_v_center(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"nsx" => {
builder = builder.set_nsx(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"nsxManager1" => {
builder = builder.set_nsx_manager1(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"nsxManager2" => {
builder = builder.set_nsx_manager2(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"nsxManager3" => {
builder = builder.set_nsx_manager3(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"nsxEdge1" => {
builder = builder.set_nsx_edge1(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"nsxEdge2" => {
builder = builder.set_nsx_edge2(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"sddcManager" => {
builder = builder.set_sddc_manager(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"cloudBuilder" => {
builder = builder.set_cloud_builder(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
_ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
},
other => {
return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
"expected object key or end object, found: {other:?}"
)))
}
}
}
Ok(Some(crate::serde_util::vcf_hostnames_correct_errors(builder).build().map_err(|err| {
::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err)
})?))
}
_ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
"expected start object or null",
)),
}
}