pub fn ser_configuration(
object_7: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::types::Configuration,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
match input {
crate::types::Configuration::EbsSnapshot(inner) => {
#[allow(unused_mut)]
let mut object_1 = object_7.key("ebsSnapshot").start_object();
crate::protocol_serde::shape_ebs_snapshot_configuration::ser_ebs_snapshot_configuration(&mut object_1, inner)?;
object_1.finish();
}
crate::types::Configuration::EcrRepository(inner) => {
#[allow(unused_mut)]
let mut object_2 = object_7.key("ecrRepository").start_object();
crate::protocol_serde::shape_ecr_repository_configuration::ser_ecr_repository_configuration(&mut object_2, inner)?;
object_2.finish();
}
crate::types::Configuration::IamRole(inner) => {
#[allow(unused_mut)]
let mut object_3 = object_7.key("iamRole").start_object();
crate::protocol_serde::shape_iam_role_configuration::ser_iam_role_configuration(&mut object_3, inner)?;
object_3.finish();
}
crate::types::Configuration::EfsFileSystem(inner) => {
#[allow(unused_mut)]
let mut object_4 = object_7.key("efsFileSystem").start_object();
crate::protocol_serde::shape_efs_file_system_configuration::ser_efs_file_system_configuration(&mut object_4, inner)?;
object_4.finish();
}
crate::types::Configuration::KmsKey(inner) => {
#[allow(unused_mut)]
let mut object_5 = object_7.key("kmsKey").start_object();
crate::protocol_serde::shape_kms_key_configuration::ser_kms_key_configuration(&mut object_5, inner)?;
object_5.finish();
}
crate::types::Configuration::RdsDbClusterSnapshot(inner) => {
#[allow(unused_mut)]
let mut object_6 = object_7.key("rdsDbClusterSnapshot").start_object();
crate::protocol_serde::shape_rds_db_cluster_snapshot_configuration::ser_rds_db_cluster_snapshot_configuration(&mut object_6, inner)?;
object_6.finish();
}
crate::types::Configuration::RdsDbSnapshot(inner) => {
#[allow(unused_mut)]
let mut object_7 = object_7.key("rdsDbSnapshot").start_object();
crate::protocol_serde::shape_rds_db_snapshot_configuration::ser_rds_db_snapshot_configuration(&mut object_7, inner)?;
object_7.finish();
}
crate::types::Configuration::SecretsManagerSecret(inner) => {
#[allow(unused_mut)]
let mut object_8 = object_7.key("secretsManagerSecret").start_object();
crate::protocol_serde::shape_secrets_manager_secret_configuration::ser_secrets_manager_secret_configuration(&mut object_8, inner)?;
object_8.finish();
}
crate::types::Configuration::S3Bucket(inner) => {
#[allow(unused_mut)]
let mut object_9 = object_7.key("s3Bucket").start_object();
crate::protocol_serde::shape_s3_bucket_configuration::ser_s3_bucket_configuration(&mut object_9, inner)?;
object_9.finish();
}
crate::types::Configuration::SnsTopic(inner) => {
#[allow(unused_mut)]
let mut object_10 = object_7.key("snsTopic").start_object();
crate::protocol_serde::shape_sns_topic_configuration::ser_sns_topic_configuration(&mut object_10, inner)?;
object_10.finish();
}
crate::types::Configuration::SqsQueue(inner) => {
#[allow(unused_mut)]
let mut object_11 = object_7.key("sqsQueue").start_object();
crate::protocol_serde::shape_sqs_queue_configuration::ser_sqs_queue_configuration(&mut object_11, inner)?;
object_11.finish();
}
crate::types::Configuration::S3ExpressDirectoryBucket(inner) => {
#[allow(unused_mut)]
let mut object_12 = object_7.key("s3ExpressDirectoryBucket").start_object();
crate::protocol_serde::shape_s3_express_directory_bucket_configuration::ser_s3_express_directory_bucket_configuration(
&mut object_12,
inner,
)?;
object_12.finish();
}
crate::types::Configuration::DynamodbStream(inner) => {
#[allow(unused_mut)]
let mut object_13 = object_7.key("dynamodbStream").start_object();
crate::protocol_serde::shape_dynamodb_stream_configuration::ser_dynamodb_stream_configuration(&mut object_13, inner)?;
object_13.finish();
}
crate::types::Configuration::DynamodbTable(inner) => {
#[allow(unused_mut)]
let mut object_14 = object_7.key("dynamodbTable").start_object();
crate::protocol_serde::shape_dynamodb_table_configuration::ser_dynamodb_table_configuration(&mut object_14, inner)?;
object_14.finish();
}
crate::types::Configuration::Unknown => {
return Err(::aws_smithy_types::error::operation::SerializationError::unknown_variant("Configuration"))
}
}
Ok(())
}
pub(crate) fn de_configuration<'a, I>(
tokens: &mut ::std::iter::Peekable<I>,
_value: &'a [u8],
) -> ::std::result::Result<Option<crate::types::Configuration>, ::aws_smithy_json::deserialize::error::DeserializeError>
where
I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
{
let mut variant = None;
match tokens.next().transpose()? {
Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => return Ok(None),
Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => loop {
match tokens.next().transpose()? {
Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
if let ::std::option::Option::Some(::std::result::Result::Ok(::aws_smithy_json::deserialize::Token::ValueNull { .. })) =
tokens.peek()
{
let _ = tokens.next().expect("peek returned a token")?;
continue;
}
let key = key.to_unescaped()?;
if key == "__type" {
::aws_smithy_json::deserialize::token::skip_value(tokens)?;
continue;
}
if variant.is_some() {
return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
"encountered mixed variants in union",
));
}
variant = match key.as_ref() {
"ebsSnapshot" => Some(crate::types::Configuration::EbsSnapshot(
crate::protocol_serde::shape_ebs_snapshot_configuration::de_ebs_snapshot_configuration(tokens, _value)?.ok_or_else(
|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'ebsSnapshot' cannot be null"),
)?,
)),
"ecrRepository" => Some(crate::types::Configuration::EcrRepository(
crate::protocol_serde::shape_ecr_repository_configuration::de_ecr_repository_configuration(tokens, _value)?.ok_or_else(
|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'ecrRepository' cannot be null"),
)?,
)),
"iamRole" => Some(crate::types::Configuration::IamRole(
crate::protocol_serde::shape_iam_role_configuration::de_iam_role_configuration(tokens, _value)?.ok_or_else(|| {
::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'iamRole' cannot be null")
})?,
)),
"efsFileSystem" => Some(crate::types::Configuration::EfsFileSystem(
crate::protocol_serde::shape_efs_file_system_configuration::de_efs_file_system_configuration(tokens, _value)?
.ok_or_else(|| {
::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'efsFileSystem' cannot be null")
})?,
)),
"kmsKey" => Some(crate::types::Configuration::KmsKey(
crate::protocol_serde::shape_kms_key_configuration::de_kms_key_configuration(tokens, _value)?.ok_or_else(|| {
::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'kmsKey' cannot be null")
})?,
)),
"rdsDbClusterSnapshot" => Some(crate::types::Configuration::RdsDbClusterSnapshot(
crate::protocol_serde::shape_rds_db_cluster_snapshot_configuration::de_rds_db_cluster_snapshot_configuration(
tokens, _value,
)?
.ok_or_else(|| {
::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'rdsDbClusterSnapshot' cannot be null")
})?,
)),
"rdsDbSnapshot" => Some(crate::types::Configuration::RdsDbSnapshot(
crate::protocol_serde::shape_rds_db_snapshot_configuration::de_rds_db_snapshot_configuration(tokens, _value)?
.ok_or_else(|| {
::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'rdsDbSnapshot' cannot be null")
})?,
)),
"secretsManagerSecret" => Some(crate::types::Configuration::SecretsManagerSecret(
crate::protocol_serde::shape_secrets_manager_secret_configuration::de_secrets_manager_secret_configuration(
tokens, _value,
)?
.ok_or_else(|| {
::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'secretsManagerSecret' cannot be null")
})?,
)),
"s3Bucket" => Some(crate::types::Configuration::S3Bucket(
crate::protocol_serde::shape_s3_bucket_configuration::de_s3_bucket_configuration(tokens, _value)?.ok_or_else(|| {
::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 's3Bucket' cannot be null")
})?,
)),
"snsTopic" => Some(crate::types::Configuration::SnsTopic(
crate::protocol_serde::shape_sns_topic_configuration::de_sns_topic_configuration(tokens, _value)?.ok_or_else(|| {
::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'snsTopic' cannot be null")
})?,
)),
"sqsQueue" => Some(crate::types::Configuration::SqsQueue(
crate::protocol_serde::shape_sqs_queue_configuration::de_sqs_queue_configuration(tokens, _value)?.ok_or_else(|| {
::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'sqsQueue' cannot be null")
})?,
)),
"s3ExpressDirectoryBucket" => Some(crate::types::Configuration::S3ExpressDirectoryBucket(
crate::protocol_serde::shape_s3_express_directory_bucket_configuration::de_s3_express_directory_bucket_configuration(
tokens, _value,
)?
.ok_or_else(|| {
::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 's3ExpressDirectoryBucket' cannot be null")
})?,
)),
"dynamodbStream" => Some(crate::types::Configuration::DynamodbStream(
crate::protocol_serde::shape_dynamodb_stream_configuration::de_dynamodb_stream_configuration(tokens, _value)?
.ok_or_else(|| {
::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'dynamodbStream' cannot be null")
})?,
)),
"dynamodbTable" => Some(crate::types::Configuration::DynamodbTable(
crate::protocol_serde::shape_dynamodb_table_configuration::de_dynamodb_table_configuration(tokens, _value)?.ok_or_else(
|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'dynamodbTable' cannot be null"),
)?,
)),
_ => {
::aws_smithy_json::deserialize::token::skip_value(tokens)?;
Some(crate::types::Configuration::Unknown)
}
};
}
other => {
return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
"expected object key or end object, found: {other:?}"
)))
}
}
},
_ => {
return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
"expected start object or null",
))
}
}
if variant.is_none() {
return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
"Union did not contain a valid variant.",
));
}
Ok(variant)
}