#[allow(clippy::unnecessary_wraps)]
pub fn de_create_organisation_http_error(_response_status: u16, _response_headers: &::aws_smithy_runtime_api::http::Headers, _response_body: &[u8]) -> std::result::Result<crate::operation::create_organisation::CreateOrganisationOutput, crate::operation::create_organisation::CreateOrganisationError> {
#[allow(unused_mut)]
let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body).map_err(crate::operation::create_organisation::CreateOrganisationError::unhandled)?;
let generic = generic_builder.build();
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::operation::create_organisation::CreateOrganisationError::unhandled(generic))
};
let _error_message = generic.message().map(|msg|msg.to_owned());
Err(match error_code {
"InternalServerError" => crate::operation::create_organisation::CreateOrganisationError::InternalServerError({
#[allow(unused_mut)]
let mut tmp =
{
#[allow(unused_mut)]
let mut output = crate::types::error::builders::InternalServerErrorBuilder::default();
output = crate::protocol_serde::shape_internal_server_error::de_internal_server_error_json_err(_response_body, output).map_err(crate::operation::create_organisation::CreateOrganisationError::unhandled)?;
let output = output.meta(generic);
output.build()
}
;
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
_ => crate::operation::create_organisation::CreateOrganisationError::generic(generic)
})
}
#[allow(clippy::unnecessary_wraps)]
pub fn de_create_organisation_http_response(_response_status: u16, _response_headers: &::aws_smithy_runtime_api::http::Headers, _response_body: &[u8]) -> std::result::Result<crate::operation::create_organisation::CreateOrganisationOutput, crate::operation::create_organisation::CreateOrganisationError> {
Ok({
#[allow(unused_mut)]
let mut output = crate::operation::create_organisation::builders::CreateOrganisationOutputBuilder::default();
output = crate::protocol_serde::shape_create_organisation::de_create_organisation(_response_body, output).map_err(crate::operation::create_organisation::CreateOrganisationError::unhandled)?;
crate::serde_util::create_organisation_output_output_correct_errors(output).build().map_err(crate::operation::create_organisation::CreateOrganisationError::unhandled)?
})
}
pub fn ser_create_organisation_input(input: &crate::operation::create_organisation::CreateOrganisationInput) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
let mut out = String::new();
let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
crate::protocol_serde::shape_create_organisation_input::ser_create_organisation_input_input(&mut object, input)?;
object.finish();
Ok(::aws_smithy_types::body::SdkBody::from(out))
}
pub(crate) fn de_create_organisation(value: &[u8], mut builder: crate::operation::create_organisation::builders::CreateOrganisationOutputBuilder) -> ::std::result::Result<crate::operation::create_organisation::builders::CreateOrganisationOutputBuilder, ::aws_smithy_json::deserialize::error::DeserializeError> {
let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable();
let tokens = &mut tokens_owned;
::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
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() {
"admin_email" => {
builder = builder.set_admin_email(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
s.to_unescaped().map(|u|
u.into_owned()
)
).transpose()?
);
}
"contact_email" => {
builder = builder.set_contact_email(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
s.to_unescaped().map(|u|
u.into_owned()
)
).transpose()?
);
}
"contact_phone" => {
builder = builder.set_contact_phone(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
s.to_unescaped().map(|u|
u.into_owned()
)
).transpose()?
);
}
"country_code" => {
builder = builder.set_country_code(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
s.to_unescaped().map(|u|
u.into_owned()
)
).transpose()?
);
}
"created_at" => {
builder = builder.set_created_at(
::aws_smithy_json::deserialize::token::expect_timestamp_or_null(tokens.next(), ::aws_smithy_types::date_time::Format::DateTimeWithOffset)?
);
}
"created_by" => {
builder = builder.set_created_by(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
s.to_unescaped().map(|u|
u.into_owned()
)
).transpose()?
);
}
"id" => {
builder = builder.set_id(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
s.to_unescaped().map(|u|
u.into_owned()
)
).transpose()?
);
}
"name" => {
builder = builder.set_name(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
s.to_unescaped().map(|u|
u.into_owned()
)
).transpose()?
);
}
"sector" => {
builder = builder.set_sector(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
s.to_unescaped().map(|u|
u.into_owned()
)
).transpose()?
);
}
"status" => {
builder = builder.set_status(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
s.to_unescaped().map(|u|
crate::types::OrgStatus::from(u.as_ref())
)
).transpose()?
);
}
"updated_at" => {
builder = builder.set_updated_at(
::aws_smithy_json::deserialize::token::expect_timestamp_or_null(tokens.next(), ::aws_smithy_types::date_time::Format::DateTimeWithOffset)?
);
}
"updated_by" => {
builder = builder.set_updated_by(
::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)))
}
}
if tokens.next().is_some() {
return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom("found more JSON tokens after completing parsing"));
}
Ok(builder)
}