125 129 | crate::operation::list_accounts::ListAccountsError,
|
126 130 | >::new());
|
127 131 |
|
128 132 | ::std::borrow::Cow::Owned(rcb)
|
129 133 | }
|
130 134 | }
|
131 135 |
|
132 136 | #[derive(Debug)]
|
133 137 | struct ListAccountsResponseDeserializer;
|
134 138 | impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for ListAccountsResponseDeserializer {
|
135 - | fn deserialize_nonstreaming(
|
139 + | fn deserialize_nonstreaming_with_config(
|
136 140 | &self,
|
137 141 | response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
142 + | _cfg: &::aws_smithy_types::config_bag::ConfigBag,
|
138 143 | ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
|
139 144 | let (success, status) = (response.status().is_success(), response.status().as_u16());
|
140 - | let headers = response.headers();
|
141 - | let body = response.body().bytes().expect("body loaded");
|
142 145 | #[allow(unused_mut)]
|
143 146 | let mut force_error = false;
|
144 147 | ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
|
145 - | let parse_result = if !success && status != 200 || force_error {
|
146 - | crate::protocol_serde::shape_list_accounts::de_list_accounts_http_error(status, headers, body)
|
148 + | if !success && status != 200 || force_error {
|
149 + | let headers = response.headers();
|
150 + | let body = response.body().bytes().expect("body loaded");
|
151 + | #[allow(unused_mut)]
|
152 + | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
|
153 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
154 + | })?;
|
155 + | generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
|
156 + | let generic = generic_builder.build();
|
157 + | let error_code = match generic.code() {
|
158 + | ::std::option::Option::Some(code) => code,
|
159 + | ::std::option::Option::None => {
|
160 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
161 + | ::aws_smithy_runtime_api::box_error::BoxError::from(crate::operation::list_accounts::ListAccountsError::unhandled(generic)),
|
162 + | ))
|
163 + | }
|
164 + | };
|
165 + | let _error_message = generic.message().map(|msg| msg.to_owned());
|
166 + | let protocol = _cfg
|
167 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
168 + | .expect("a SharedClientProtocol is required");
|
169 + | let err = match error_code {
|
170 + | "InvalidRequestException" => crate::operation::list_accounts::ListAccountsError::InvalidRequestException({
|
171 + | let mut tmp = match protocol
|
172 + | .deserialize_response(response, crate::types::error::InvalidRequestException::SCHEMA, _cfg)
|
173 + | .and_then(|mut deser| {
|
174 + | crate::types::error::InvalidRequestException::deserialize_with_response(
|
175 + | &mut *deser,
|
176 + | response.headers(),
|
177 + | response.status().into(),
|
178 + | body,
|
179 + | )
|
180 + | }) {
|
181 + | ::std::result::Result::Ok(val) => val,
|
182 + | ::std::result::Result::Err(e) => {
|
183 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
184 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
185 + | ))
|
186 + | }
|
187 + | };
|
188 + | tmp.meta = generic;
|
189 + | if tmp.message.is_none() {
|
190 + | tmp.message = _error_message;
|
191 + | }
|
192 + | tmp
|
193 + | }),
|
194 + | "ResourceNotFoundException" => crate::operation::list_accounts::ListAccountsError::ResourceNotFoundException({
|
195 + | let mut tmp = match protocol
|
196 + | .deserialize_response(response, crate::types::error::ResourceNotFoundException::SCHEMA, _cfg)
|
197 + | .and_then(|mut deser| {
|
198 + | crate::types::error::ResourceNotFoundException::deserialize_with_response(
|
199 + | &mut *deser,
|
200 + | response.headers(),
|
201 + | response.status().into(),
|
202 + | body,
|
203 + | )
|
204 + | }) {
|
205 + | ::std::result::Result::Ok(val) => val,
|
206 + | ::std::result::Result::Err(e) => {
|
207 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
208 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
209 + | ))
|
210 + | }
|
211 + | };
|
212 + | tmp.meta = generic;
|
213 + | if tmp.message.is_none() {
|
214 + | tmp.message = _error_message;
|
215 + | }
|
216 + | tmp
|
217 + | }),
|
218 + | "TooManyRequestsException" => crate::operation::list_accounts::ListAccountsError::TooManyRequestsException({
|
219 + | let mut tmp = match protocol
|
220 + | .deserialize_response(response, crate::types::error::TooManyRequestsException::SCHEMA, _cfg)
|
221 + | .and_then(|mut deser| {
|
222 + | crate::types::error::TooManyRequestsException::deserialize_with_response(
|
223 + | &mut *deser,
|
224 + | response.headers(),
|
225 + | response.status().into(),
|
226 + | body,
|
227 + | )
|
228 + | }) {
|
229 + | ::std::result::Result::Ok(val) => val,
|
230 + | ::std::result::Result::Err(e) => {
|
231 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
232 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
233 + | ))
|
234 + | }
|
235 + | };
|
236 + | tmp.meta = generic;
|
237 + | if tmp.message.is_none() {
|
238 + | tmp.message = _error_message;
|
239 + | }
|
240 + | tmp
|
241 + | }),
|
242 + | "UnauthorizedException" => crate::operation::list_accounts::ListAccountsError::UnauthorizedException({
|
243 + | let mut tmp = match protocol
|
244 + | .deserialize_response(response, crate::types::error::UnauthorizedException::SCHEMA, _cfg)
|
245 + | .and_then(|mut deser| {
|
246 + | crate::types::error::UnauthorizedException::deserialize_with_response(
|
247 + | &mut *deser,
|
248 + | response.headers(),
|
249 + | response.status().into(),
|
250 + | body,
|
251 + | )
|
252 + | }) {
|
253 + | ::std::result::Result::Ok(val) => val,
|
254 + | ::std::result::Result::Err(e) => {
|
255 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
256 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
257 + | ))
|
258 + | }
|
259 + | };
|
260 + | tmp.meta = generic;
|
261 + | if tmp.message.is_none() {
|
262 + | tmp.message = _error_message;
|
263 + | }
|
264 + | tmp
|
265 + | }),
|
266 + | _ => crate::operation::list_accounts::ListAccountsError::generic(generic),
|
267 + | };
|
268 + | ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
|
269 + | ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
|
270 + | ))
|
147 271 | } else {
|
148 - | crate::protocol_serde::shape_list_accounts::de_list_accounts_http_response(status, headers, body)
|
149 - | };
|
150 - | crate::protocol_serde::type_erase_result(parse_result)
|
272 + | let protocol = _cfg
|
273 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
274 + | .expect("a SharedClientProtocol is required");
|
275 + | let mut deser = protocol.deserialize_response(response, ListAccounts::OUTPUT_SCHEMA, _cfg).map_err(|e| {
|
276 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
277 + | })?;
|
278 + | let body = response.body().bytes().expect("body loaded");
|
279 + | let output = crate::operation::list_accounts::ListAccountsOutput::deserialize_with_response(
|
280 + | &mut *deser,
|
281 + | response.headers(),
|
282 + | response.status().into(),
|
283 + | body,
|
284 + | )
|
285 + | .map_err(|e| {
|
286 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
287 + | })?;
|
288 + | ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
|
289 + | }
|
151 290 | }
|
152 291 | }
|
153 292 | #[derive(Debug)]
|
154 293 | struct ListAccountsRequestSerializer;
|
155 294 | impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for ListAccountsRequestSerializer {
|
156 295 | #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
|
157 296 | fn serialize_input(
|
158 297 | &self,
|
159 298 | input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
160 299 | _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
161 300 | ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
|
162 301 | let input = input
|
163 302 | .downcast::<crate::operation::list_accounts::ListAccountsInput>()
|
164 303 | .expect("correct type");
|
165 - | let _header_serialization_settings = _cfg
|
166 - | .load::<crate::serialization_settings::HeaderSerializationSettings>()
|
167 - | .cloned()
|
168 - | .unwrap_or_default();
|
169 - | let mut request_builder = {
|
170 - | #[allow(clippy::uninlined_format_args)]
|
171 - | fn uri_base(
|
172 - | _input: &crate::operation::list_accounts::ListAccountsInput,
|
173 - | output: &mut ::std::string::String,
|
174 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
175 - | use ::std::fmt::Write as _;
|
176 - | ::std::write!(output, "/assignment/accounts").expect("formatting should succeed");
|
177 - | ::std::result::Result::Ok(())
|
178 - | }
|
179 - | fn uri_query(
|
180 - | _input: &crate::operation::list_accounts::ListAccountsInput,
|
181 - | mut output: &mut ::std::string::String,
|
182 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
183 - | let mut query = ::aws_smithy_http::query::Writer::new(output);
|
184 - | if let ::std::option::Option::Some(inner_1) = &_input.next_token {
|
185 - | {
|
186 - | query.push_kv("next_token", &::aws_smithy_http::query::fmt_string(inner_1));
|
187 - | }
|
188 - | }
|
189 - | if let ::std::option::Option::Some(inner_2) = &_input.max_results {
|
190 - | {
|
191 - | query.push_kv("max_result", ::aws_smithy_types::primitive::Encoder::from(*inner_2).encode());
|
192 - | }
|
193 - | }
|
194 - | ::std::result::Result::Ok(())
|
195 - | }
|
196 - | #[allow(clippy::unnecessary_wraps)]
|
197 - | fn update_http_builder(
|
198 - | input: &crate::operation::list_accounts::ListAccountsInput,
|
199 - | builder: ::http_1x::request::Builder,
|
200 - | ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
201 - | let mut uri = ::std::string::String::new();
|
202 - | uri_base(input, &mut uri)?;
|
203 - | uri_query(input, &mut uri)?;
|
204 - | let builder = crate::protocol_serde::shape_list_accounts::ser_list_accounts_headers(input, builder)?;
|
205 - | ::std::result::Result::Ok(builder.method("GET").uri(uri))
|
206 - | }
|
207 - | let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
|
208 - | builder
|
209 - | };
|
210 - | let body = ::aws_smithy_types::body::SdkBody::from("");
|
304 + | let protocol = _cfg
|
305 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
306 + | .expect("a SharedClientProtocol is required");
|
307 + | let mut request = protocol
|
308 + | .serialize_request(&input, ListAccounts::INPUT_SCHEMA, "", _cfg)
|
309 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
211 310 |
|
212 - | ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
|
311 + | return ::std::result::Result::Ok(request);
|
213 312 | }
|
214 313 | }
|
215 314 | #[derive(Debug)]
|
216 315 | struct ListAccountsEndpointParamsInterceptor;
|
217 316 |
|
218 317 | impl ::aws_smithy_runtime_api::client::interceptors::Intercept for ListAccountsEndpointParamsInterceptor {
|
219 318 | fn name(&self) -> &'static str {
|
220 319 | "ListAccountsEndpointParamsInterceptor"
|
221 320 | }
|
222 321 |
|