aws_sdk_gamelift/protocol_serde/
shape_describe_matchmaking_configurations.rs1#[allow(clippy::unnecessary_wraps)]
3pub fn de_describe_matchmaking_configurations_http_error(
4 _response_status: u16,
5 _response_headers: &::aws_smithy_runtime_api::http::Headers,
6 _response_body: &[u8],
7) -> std::result::Result<
8 crate::operation::describe_matchmaking_configurations::DescribeMatchmakingConfigurationsOutput,
9 crate::operation::describe_matchmaking_configurations::DescribeMatchmakingConfigurationsError,
10> {
11 #[allow(unused_mut)]
12 let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
13 .map_err(crate::operation::describe_matchmaking_configurations::DescribeMatchmakingConfigurationsError::unhandled)?;
14 generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
15 let generic = generic_builder.build();
16 let error_code = match generic.code() {
17 Some(code) => code,
18 None => return Err(crate::operation::describe_matchmaking_configurations::DescribeMatchmakingConfigurationsError::unhandled(generic)),
19 };
20
21 let _error_message = generic.message().map(|msg| msg.to_owned());
22 Err(match error_code {
23 "InternalServiceException" => {
24 crate::operation::describe_matchmaking_configurations::DescribeMatchmakingConfigurationsError::InternalServiceException({
25 #[allow(unused_mut)]
26 let mut tmp = {
27 #[allow(unused_mut)]
28 let mut output = crate::types::error::builders::InternalServiceExceptionBuilder::default();
29 output = crate::protocol_serde::shape_internal_service_exception::de_internal_service_exception_json_err(_response_body, output)
30 .map_err(crate::operation::describe_matchmaking_configurations::DescribeMatchmakingConfigurationsError::unhandled)?;
31 let output = output.meta(generic);
32 output.build()
33 };
34 if tmp.message.is_none() {
35 tmp.message = _error_message;
36 }
37 tmp
38 })
39 }
40 "InvalidRequestException" => {
41 crate::operation::describe_matchmaking_configurations::DescribeMatchmakingConfigurationsError::InvalidRequestException({
42 #[allow(unused_mut)]
43 let mut tmp = {
44 #[allow(unused_mut)]
45 let mut output = crate::types::error::builders::InvalidRequestExceptionBuilder::default();
46 output = crate::protocol_serde::shape_invalid_request_exception::de_invalid_request_exception_json_err(_response_body, output)
47 .map_err(crate::operation::describe_matchmaking_configurations::DescribeMatchmakingConfigurationsError::unhandled)?;
48 let output = output.meta(generic);
49 output.build()
50 };
51 if tmp.message.is_none() {
52 tmp.message = _error_message;
53 }
54 tmp
55 })
56 }
57 "UnsupportedRegionException" => {
58 crate::operation::describe_matchmaking_configurations::DescribeMatchmakingConfigurationsError::UnsupportedRegionException({
59 #[allow(unused_mut)]
60 let mut tmp = {
61 #[allow(unused_mut)]
62 let mut output = crate::types::error::builders::UnsupportedRegionExceptionBuilder::default();
63 output =
64 crate::protocol_serde::shape_unsupported_region_exception::de_unsupported_region_exception_json_err(_response_body, output)
65 .map_err(crate::operation::describe_matchmaking_configurations::DescribeMatchmakingConfigurationsError::unhandled)?;
66 let output = output.meta(generic);
67 output.build()
68 };
69 if tmp.message.is_none() {
70 tmp.message = _error_message;
71 }
72 tmp
73 })
74 }
75 _ => crate::operation::describe_matchmaking_configurations::DescribeMatchmakingConfigurationsError::generic(generic),
76 })
77}
78
79#[allow(clippy::unnecessary_wraps)]
80pub fn de_describe_matchmaking_configurations_http_response(
81 _response_status: u16,
82 _response_headers: &::aws_smithy_runtime_api::http::Headers,
83 _response_body: &[u8],
84) -> std::result::Result<
85 crate::operation::describe_matchmaking_configurations::DescribeMatchmakingConfigurationsOutput,
86 crate::operation::describe_matchmaking_configurations::DescribeMatchmakingConfigurationsError,
87> {
88 Ok({
89 #[allow(unused_mut)]
90 let mut output = crate::operation::describe_matchmaking_configurations::builders::DescribeMatchmakingConfigurationsOutputBuilder::default();
91 output = crate::protocol_serde::shape_describe_matchmaking_configurations::de_describe_matchmaking_configurations(_response_body, output)
92 .map_err(crate::operation::describe_matchmaking_configurations::DescribeMatchmakingConfigurationsError::unhandled)?;
93 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
94 output.build()
95 })
96}
97
98pub fn ser_describe_matchmaking_configurations_input(
99 input: &crate::operation::describe_matchmaking_configurations::DescribeMatchmakingConfigurationsInput,
100) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
101 let mut out = String::new();
102 let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
103 crate::protocol_serde::shape_describe_matchmaking_configurations_input::ser_describe_matchmaking_configurations_input_input(&mut object, input)?;
104 object.finish();
105 Ok(::aws_smithy_types::body::SdkBody::from(out))
106}
107
108pub(crate) fn de_describe_matchmaking_configurations(
109 value: &[u8],
110 mut builder: crate::operation::describe_matchmaking_configurations::builders::DescribeMatchmakingConfigurationsOutputBuilder,
111) -> ::std::result::Result<
112 crate::operation::describe_matchmaking_configurations::builders::DescribeMatchmakingConfigurationsOutputBuilder,
113 ::aws_smithy_json::deserialize::error::DeserializeError,
114> {
115 let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable();
116 let tokens = &mut tokens_owned;
117 ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
118 loop {
119 match tokens.next().transpose()? {
120 Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
121 Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
122 "Configurations" => {
123 builder = builder
124 .set_configurations(crate::protocol_serde::shape_matchmaking_configuration_list::de_matchmaking_configuration_list(tokens)?);
125 }
126 "NextToken" => {
127 builder = builder.set_next_token(
128 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
129 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
130 .transpose()?,
131 );
132 }
133 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
134 },
135 other => {
136 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
137 "expected object key or end object, found: {:?}",
138 other
139 )))
140 }
141 }
142 }
143 if tokens.next().is_some() {
144 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
145 "found more JSON tokens after completing parsing",
146 ));
147 }
148 Ok(builder)
149}