pub fn ser_orchestration_ai_agent_configuration(
object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::types::OrchestrationAiAgentConfiguration,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
{
object.key("orchestrationAIPromptId").string(input.orchestration_ai_prompt_id.as_str());
}
if let Some(var_1) = &input.orchestration_ai_guardrail_id {
object.key("orchestrationAIGuardrailId").string(var_1.as_str());
}
if let Some(var_2) = &input.tool_configurations {
let mut array_3 = object.key("toolConfigurations").start_array();
for item_4 in var_2 {
{
#[allow(unused_mut)]
let mut object_5 = array_3.value().start_object();
crate::protocol_serde::shape_tool_configuration::ser_tool_configuration(&mut object_5, item_4)?;
object_5.finish();
}
}
array_3.finish();
}
if let Some(var_6) = &input.connect_instance_arn {
object.key("connectInstanceArn").string(var_6.as_str());
}
if let Some(var_7) = &input.locale {
object.key("locale").string(var_7.as_str());
}
Ok(())
}
pub(crate) fn de_orchestration_ai_agent_configuration<'a, I>(
tokens: &mut ::std::iter::Peekable<I>,
_value: &'a [u8],
) -> ::std::result::Result<Option<crate::types::OrchestrationAiAgentConfiguration>, ::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::OrchestrationAiAgentConfigurationBuilder::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() {
"orchestrationAIPromptId" => {
builder = builder.set_orchestration_ai_prompt_id(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"orchestrationAIGuardrailId" => {
builder = builder.set_orchestration_ai_guardrail_id(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"toolConfigurations" => {
builder = builder.set_tool_configurations(
crate::protocol_serde::shape_tool_configuration_list::de_tool_configuration_list(tokens, _value)?,
);
}
"connectInstanceArn" => {
builder = builder.set_connect_instance_arn(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"locale" => {
builder = builder.set_locale(
::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::orchestration_ai_agent_configuration_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",
)),
}
}