132 136 | ::std::borrow::Cow::Owned(rcb)
|
133 137 | }
|
134 138 | }
|
135 139 |
|
136 140 | #[derive(Debug)]
|
137 141 | struct CreateOAuth2TokenResponseDeserializer;
|
138 142 | impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for CreateOAuth2TokenResponseDeserializer {
|
139 143 | fn deserialize_nonstreaming(
|
140 144 | &self,
|
141 145 | response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
146 + | _cfg: &::aws_smithy_types::config_bag::ConfigBag,
|
142 147 | ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
|
143 148 | let (success, status) = (response.status().is_success(), response.status().as_u16());
|
144 - | let headers = response.headers();
|
145 - | let body = response.body().bytes().expect("body loaded");
|
146 149 | #[allow(unused_mut)]
|
147 150 | let mut force_error = false;
|
148 151 | ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
|
149 - | let parse_result = if !success && status != 200 || force_error {
|
150 - | crate::protocol_serde::shape_create_o_auth2_token::de_create_o_auth2_token_http_error(status, headers, body)
|
151 - | } else {
|
152 - | crate::protocol_serde::shape_create_o_auth2_token::de_create_o_auth2_token_http_response(status, headers, body)
|
152 + | if !success && status != 200 || force_error {
|
153 + | let headers = response.headers();
|
154 + | let body = response.body().bytes().expect("body loaded");
|
155 + | #[allow(unused_mut)]
|
156 + | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
|
157 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
158 + | })?;
|
159 + | generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
|
160 + | let generic = generic_builder.build();
|
161 + | let error_code = match generic.code() {
|
162 + | ::std::option::Option::Some(code) => code,
|
163 + | ::std::option::Option::None => {
|
164 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
165 + | ::aws_smithy_runtime_api::box_error::BoxError::from(
|
166 + | crate::operation::create_o_auth2_token::CreateOAuth2TokenError::unhandled(generic),
|
167 + | ),
|
168 + | ))
|
169 + | }
|
153 170 | };
|
154 - | crate::protocol_serde::type_erase_result(parse_result)
|
171 + | let _error_message = generic.message().map(|msg| msg.to_owned());
|
172 + | let protocol = _cfg
|
173 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
174 + | .expect("a SharedClientProtocol is required");
|
175 + | let err = match error_code {
|
176 + | "AccessDeniedException" => crate::operation::create_o_auth2_token::CreateOAuth2TokenError::AccessDeniedException({
|
177 + | let mut tmp = match protocol
|
178 + | .deserialize_response(response, crate::types::error::AccessDeniedException::SCHEMA, _cfg)
|
179 + | .and_then(|mut deser| {
|
180 + | crate::types::error::AccessDeniedException::deserialize_with_response(
|
181 + | &mut *deser,
|
182 + | response.headers(),
|
183 + | response.status().into(),
|
184 + | body,
|
185 + | )
|
186 + | }) {
|
187 + | ::std::result::Result::Ok(val) => val,
|
188 + | ::std::result::Result::Err(e) => {
|
189 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
190 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
191 + | ))
|
192 + | }
|
193 + | };
|
194 + | tmp.meta = generic;
|
195 + | tmp
|
196 + | }),
|
197 + | "InternalServerException" => crate::operation::create_o_auth2_token::CreateOAuth2TokenError::InternalServerException({
|
198 + | let mut tmp = match protocol
|
199 + | .deserialize_response(response, crate::types::error::InternalServerException::SCHEMA, _cfg)
|
200 + | .and_then(|mut deser| {
|
201 + | crate::types::error::InternalServerException::deserialize_with_response(
|
202 + | &mut *deser,
|
203 + | response.headers(),
|
204 + | response.status().into(),
|
205 + | body,
|
206 + | )
|
207 + | }) {
|
208 + | ::std::result::Result::Ok(val) => val,
|
209 + | ::std::result::Result::Err(e) => {
|
210 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
211 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
212 + | ))
|
213 + | }
|
214 + | };
|
215 + | tmp.meta = generic;
|
216 + | tmp
|
217 + | }),
|
218 + | "TooManyRequestsError" => crate::operation::create_o_auth2_token::CreateOAuth2TokenError::TooManyRequestsError({
|
219 + | let mut tmp = match protocol
|
220 + | .deserialize_response(response, crate::types::error::TooManyRequestsError::SCHEMA, _cfg)
|
221 + | .and_then(|mut deser| {
|
222 + | crate::types::error::TooManyRequestsError::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 + | tmp
|
238 + | }),
|
239 + | "ValidationException" => crate::operation::create_o_auth2_token::CreateOAuth2TokenError::ValidationException({
|
240 + | let mut tmp = match protocol
|
241 + | .deserialize_response(response, crate::types::error::ValidationException::SCHEMA, _cfg)
|
242 + | .and_then(|mut deser| {
|
243 + | crate::types::error::ValidationException::deserialize_with_response(
|
244 + | &mut *deser,
|
245 + | response.headers(),
|
246 + | response.status().into(),
|
247 + | body,
|
248 + | )
|
249 + | }) {
|
250 + | ::std::result::Result::Ok(val) => val,
|
251 + | ::std::result::Result::Err(e) => {
|
252 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
253 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
254 + | ))
|
255 + | }
|
256 + | };
|
257 + | tmp.meta = generic;
|
258 + | tmp
|
259 + | }),
|
260 + | _ => crate::operation::create_o_auth2_token::CreateOAuth2TokenError::generic(generic),
|
261 + | };
|
262 + | ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
|
263 + | ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
|
264 + | ))
|
265 + | } else {
|
266 + | let protocol = _cfg
|
267 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
268 + | .expect("a SharedClientProtocol is required");
|
269 + | let mut deser = protocol
|
270 + | .deserialize_response(response, CreateOAuth2Token::OUTPUT_SCHEMA, _cfg)
|
271 + | .map_err(|e| {
|
272 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
273 + | })?;
|
274 + | let body = response.body().bytes().expect("body loaded");
|
275 + | let output = crate::operation::create_o_auth2_token::CreateOAuth2TokenOutput::deserialize_with_response(
|
276 + | &mut *deser,
|
277 + | response.headers(),
|
278 + | response.status().into(),
|
279 + | body,
|
280 + | )
|
281 + | .map_err(|e| {
|
282 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
283 + | })?;
|
284 + | ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
|
285 + | }
|
155 286 | }
|
156 287 | }
|
157 288 | #[derive(Debug)]
|
158 289 | struct CreateOAuth2TokenRequestSerializer;
|
159 290 | impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for CreateOAuth2TokenRequestSerializer {
|
160 291 | #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
|
161 292 | fn serialize_input(
|
162 293 | &self,
|
163 294 | input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
164 295 | _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
165 296 | ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
|
166 297 | let input = input
|
167 298 | .downcast::<crate::operation::create_o_auth2_token::CreateOAuth2TokenInput>()
|
168 299 | .expect("correct type");
|
169 - | let _header_serialization_settings = _cfg
|
170 - | .load::<crate::serialization_settings::HeaderSerializationSettings>()
|
171 - | .cloned()
|
172 - | .unwrap_or_default();
|
173 - | let mut request_builder = {
|
174 - | #[allow(clippy::uninlined_format_args)]
|
175 - | fn uri_base(
|
176 - | _input: &crate::operation::create_o_auth2_token::CreateOAuth2TokenInput,
|
177 - | output: &mut ::std::string::String,
|
178 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
179 - | use ::std::fmt::Write as _;
|
180 - | ::std::write!(output, "/v1/token").expect("formatting should succeed");
|
181 - | ::std::result::Result::Ok(())
|
182 - | }
|
183 - | #[allow(clippy::unnecessary_wraps)]
|
184 - | fn update_http_builder(
|
185 - | input: &crate::operation::create_o_auth2_token::CreateOAuth2TokenInput,
|
186 - | builder: ::http_1x::request::Builder,
|
187 - | ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
188 - | let mut uri = ::std::string::String::new();
|
189 - | uri_base(input, &mut uri)?;
|
190 - | ::std::result::Result::Ok(builder.method("POST").uri(uri))
|
191 - | }
|
192 - | let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
|
193 - | builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/json");
|
194 - | builder
|
195 - | };
|
196 - | let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_create_o_auth2_token_input::ser_token_input_http_payload(
|
197 - | &input.token_input,
|
198 - | )?);
|
199 - | if let Some(content_length) = body.content_length() {
|
200 - | let content_length = content_length.to_string();
|
201 - | request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
|
202 - | }
|
203 - | ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
|
300 + | let protocol = _cfg
|
301 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
302 + | .expect("a SharedClientProtocol is required");
|
303 + | let mut request = protocol
|
304 + | .serialize_request(&input, CreateOAuth2Token::INPUT_SCHEMA, "", _cfg)
|
305 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
306 + |
|
307 + | return ::std::result::Result::Ok(request);
|
204 308 | }
|
205 309 | }
|
206 310 | #[derive(Debug)]
|
207 311 | struct CreateOAuth2TokenEndpointParamsInterceptor;
|
208 312 |
|
209 313 | impl ::aws_smithy_runtime_api::client::interceptors::Intercept for CreateOAuth2TokenEndpointParamsInterceptor {
|
210 314 | fn name(&self) -> &'static str {
|
211 315 | "CreateOAuth2TokenEndpointParamsInterceptor"
|
212 316 | }
|
213 317 |
|