77 86 | runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
|
78 87 | }
|
79 88 | runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
|
80 89 | config_override,
|
81 90 | client_config.config.clone(),
|
82 91 | &client_config.runtime_components,
|
83 92 | ));
|
84 93 | }
|
85 94 | runtime_plugins
|
86 95 | }
|
96 + | /* OperationGenerator.kt:85 */
|
87 97 | }
|
98 + | /* OperationRuntimePluginGenerator.kt:55 */
|
88 99 | impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for StatusResponse {
|
89 100 | fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
|
90 101 | let mut cfg = ::aws_smithy_types::config_bag::Layer::new("StatusResponse");
|
91 102 |
|
92 103 | cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
|
93 104 | StatusResponseRequestSerializer,
|
94 105 | ));
|
95 106 | cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
|
96 107 | StatusResponseResponseDeserializer,
|
97 108 | ));
|
98 109 |
|
99 110 | cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
|
100 111 | ::aws_smithy_runtime_api::client::auth::static_resolver::StaticAuthSchemeOptionResolverParams::new(),
|
101 112 | ));
|
102 113 |
|
103 114 | cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
|
104 115 | "StatusResponse",
|
105 116 | "Rest Json Protocol",
|
106 117 | ));
|
107 118 |
|
108 119 | ::std::option::Option::Some(cfg.freeze())
|
109 120 | }
|
110 121 |
|
111 122 | fn runtime_components(
|
112 123 | &self,
|
113 124 | _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
|
114 125 | ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
|
115 126 | #[allow(unused_mut)]
|
116 127 | let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("StatusResponse")
|
117 128 | .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default())
|
118 129 | .with_interceptor(StatusResponseEndpointParamsInterceptor)
|
119 130 | .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
|
120 131 | crate::operation::status_response::StatusResponseError,
|
121 132 | >::new())
|
122 133 | .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
|
123 134 | crate::operation::status_response::StatusResponseError,
|
124 135 | >::new());
|
125 136 |
|
126 137 | ::std::borrow::Cow::Owned(rcb)
|
127 138 | }
|
128 139 | }
|
129 140 |
|
141 + | /* ResponseDeserializerGenerator.kt:64 */
|
130 142 | #[derive(Debug)]
|
131 143 | struct StatusResponseResponseDeserializer;
|
132 144 | impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for StatusResponseResponseDeserializer {
|
133 145 | fn deserialize_nonstreaming(
|
134 146 | &self,
|
135 147 | response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
136 148 | ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
|
137 149 | let (success, status) = (response.status().is_success(), response.status().as_u16());
|
138 150 | let headers = response.headers();
|
139 151 | let body = response.body().bytes().expect("body loaded");
|
140 152 | #[allow(unused_mut)]
|
141 153 | let mut force_error = false;
|
142 154 |
|
143 155 | let parse_result = if !success && status != 200 || force_error {
|
144 156 | crate::protocol_serde::shape_status_response::de_status_response_http_error(status, headers, body)
|
145 157 | } else {
|
146 158 | crate::protocol_serde::shape_status_response::de_status_response_http_response(status, headers, body)
|
147 159 | };
|
148 160 | crate::protocol_serde::type_erase_result(parse_result)
|
149 161 | }
|
150 162 | }
|
163 + | /* RequestSerializerGenerator.kt:67 */
|
151 164 | #[derive(Debug)]
|
152 165 | struct StatusResponseRequestSerializer;
|
153 166 | impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for StatusResponseRequestSerializer {
|
154 167 | #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
|
155 168 | fn serialize_input(
|
156 169 | &self,
|
157 170 | input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
158 171 | _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
159 172 | ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
|
160 173 | let input = input
|
161 174 | .downcast::<crate::operation::status_response::StatusResponseInput>()
|
162 175 | .expect("correct type");
|
163 176 | let _header_serialization_settings = _cfg
|
164 177 | .load::<crate::serialization_settings::HeaderSerializationSettings>()
|
165 178 | .cloned()
|
166 179 | .unwrap_or_default();
|
167 180 | let mut request_builder = {
|
168 181 | fn uri_base(
|
169 182 | _input: &crate::operation::status_response::StatusResponseInput,
|
170 183 | output: &mut ::std::string::String,
|
171 184 | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
172 185 | use ::std::fmt::Write as _;
|
173 186 | ::std::write!(output, "/").expect("formatting should succeed");
|
174 187 | ::std::result::Result::Ok(())
|
175 188 | }
|
176 189 | #[allow(clippy::unnecessary_wraps)]
|
177 190 | fn update_http_builder(
|
178 191 | input: &crate::operation::status_response::StatusResponseInput,
|
179 192 | builder: ::http::request::Builder,
|
180 193 | ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
181 194 | let mut uri = ::std::string::String::new();
|
182 195 | uri_base(input, &mut uri)?;
|
183 196 | ::std::result::Result::Ok(builder.method("POST").uri(uri))
|
184 197 | }
|
185 198 | let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
|
186 199 | builder
|
187 200 | };
|
188 201 | let body = ::aws_smithy_types::body::SdkBody::from("");
|
189 202 |
|
190 203 | ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
|
191 204 | }
|
192 205 | }
|
206 + | /* EndpointParamsInterceptorGenerator.kt:86 */
|
193 207 | #[derive(Debug)]
|
194 208 | struct StatusResponseEndpointParamsInterceptor;
|
195 209 |
|
196 210 | impl ::aws_smithy_runtime_api::client::interceptors::Intercept for StatusResponseEndpointParamsInterceptor {
|
197 211 | fn name(&self) -> &'static str {
|
198 212 | "StatusResponseEndpointParamsInterceptor"
|
199 213 | }
|
200 214 |
|
201 215 | fn read_before_execution(
|
202 216 | &self,
|
203 217 | context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
|
204 218 | '_,
|
205 219 | ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
206 220 | ::aws_smithy_runtime_api::client::interceptors::context::Output,
|
207 221 | ::aws_smithy_runtime_api::client::interceptors::context::Error,
|
208 222 | >,
|
209 223 | cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
210 224 | ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
|
211 225 | let _input = context
|
212 226 | .input()
|
213 227 | .downcast_ref::<StatusResponseInput>()
|
214 228 | .ok_or("failed to downcast to StatusResponseInput")?;
|
215 229 |
|
216 230 | let params = crate::config::endpoint::Params::builder().build().map_err(|err| {
|
217 231 | ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
|
218 232 | })?;
|
219 233 | cfg.interceptor_state()
|
220 234 | .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
|
221 235 | ::std::result::Result::Ok(())
|
222 236 | }
|
223 237 | }
|
224 238 |
|
225 239 | // The get_* functions below are generated from JMESPath expressions in the
|
226 240 | // operationContextParams trait. They target the operation's input shape.
|
227 241 |
|
242 + | /* RustType.kt:516 */
|
228 243 | #[allow(unreachable_code, unused_variables)]
|
244 + | /* RustType.kt:516 */
|
229 245 | #[cfg(test)]
|
246 + | /* ProtocolTestGenerator.kt:98 */
|
230 247 | mod status_response_test {
|
231 248 |
|
232 249 | /// Upper case error modeled lower case
|
233 250 | /// Test ID: ServiceLevelErrorClient
|
234 251 | #[::tokio::test]
|
235 252 | #[::tracing_test::traced_test]
|
236 253 | async fn service_level_error_client_response() {
|
237 254 | let expected_output = crate::types::error::ExtraError::builder().build();
|
238 255 | let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
|
239 256 | ::http::response::Builder::new()
|
240 257 | .header("X-Amzn-Errortype", "ExtraError")
|
241 258 | .status(500)
|
242 259 | .body(::aws_smithy_types::body::SdkBody::from(""))
|
243 260 | .unwrap(),
|
244 261 | )
|
245 262 | .unwrap();
|
246 263 | use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
|
247 264 | use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
|
248 265 |
|
249 266 | let op = crate::operation::status_response::StatusResponse::new();
|
250 267 | let config = op.config().expect("the operation has config");
|
251 268 | let de = config
|
252 269 | .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
|
253 270 | .expect("the config must have a deserializer");
|
254 271 |
|
255 272 | let parsed = de.deserialize_streaming(&mut http_response);
|
256 273 | let parsed = parsed.unwrap_or_else(|| {
|
257 274 | let http_response = http_response.map(|body| {
|
258 275 | ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
259 276 | body.bytes().unwrap(),
|
260 277 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
261 278 | )))
|
262 279 | });
|
263 280 | de.deserialize_nonstreaming(&http_response)
|
264 281 | });
|
265 282 | let parsed = parsed.expect_err("should be error response");
|
266 283 | let parsed: &crate::operation::status_response::StatusResponseError =
|
267 284 | parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
|
268 285 | if let crate::operation::status_response::StatusResponseError::ExtraError(parsed) = parsed {
|
269 286 | ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
|
270 287 | } else {
|
271 288 | panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
|
272 289 | }
|
273 290 | }
|
291 + |
|
292 + | /* ProtocolTestGenerator.kt:98 */
|
274 293 | }
|
275 294 |
|
295 + | /* OperationErrorGenerator.kt:79 */
|
276 296 | /// Error type for the `StatusResponseError` operation.
|
297 + | /* RustType.kt:516 */
|
277 298 | #[non_exhaustive]
|
299 + | /* RustType.kt:516 */
|
278 300 | #[derive(::std::fmt::Debug)]
|
279 - | pub enum StatusResponseError {
|
301 + | pub /* OperationErrorGenerator.kt:81 */ enum StatusResponseError {
|
302 + | /* OperationErrorGenerator.kt:83 */
|
280 303 | #[allow(missing_docs)] // documentation missing in model
|
304 + | /* OperationErrorGenerator.kt:86 */
|
281 305 | ExtraError(crate::types::error::ExtraError),
|
306 + | /* OperationErrorGenerator.kt:88 */
|
282 307 | /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
|
283 308 | #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
|
284 309 | variable wildcard pattern and check `.code()`:
|
285 310 | \
|
286 311 | `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
|
287 312 | \
|
288 313 | See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-StatusResponseError) for what information is available for the error.")]
|
289 314 | Unhandled(crate::error::sealed_unhandled::Unhandled),
|
315 + | /* OperationErrorGenerator.kt:81 */
|
290 316 | }
|
317 + | /* OperationErrorGenerator.kt:218 */
|
291 318 | impl StatusResponseError {
|
319 + | /* OperationErrorGenerator.kt:219 */
|
292 320 | /// Creates the `StatusResponseError::Unhandled` variant from any error type.
|
293 321 | pub fn unhandled(
|
294 322 | err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
|
295 323 | ) -> Self {
|
296 324 | Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
|
297 325 | source: err.into(),
|
298 326 | meta: ::std::default::Default::default(),
|
299 327 | })
|
300 328 | }
|
301 329 |
|
302 330 | /// Creates the `StatusResponseError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
|
303 331 | pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
|
304 332 | Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
|
305 333 | source: err.clone().into(),
|
306 334 | meta: err,
|
307 335 | })
|
308 336 | }
|
309 - | ///
|
337 + | /// /* OperationErrorGenerator.kt:236 */
|
310 338 | /// Returns error metadata, which includes the error code, message,
|
311 339 | /// request ID, and potentially additional information.
|
312 340 | ///
|
341 + | /* OperationErrorGenerator.kt:242 */
|
313 342 | pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
|
343 + | /* OperationErrorGenerator.kt:243 */
|
314 344 | match self {
|
315 - | Self::ExtraError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
|
316 - | Self::Unhandled(e) => &e.meta,
|
345 + | /* OperationErrorGenerator.kt:246 */ Self::ExtraError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
|
346 + | /* OperationErrorGenerator.kt:251 */ Self::Unhandled(e) => &e.meta,
|
347 + | /* OperationErrorGenerator.kt:243 */
|
317 348 | }
|
349 + | /* OperationErrorGenerator.kt:242 */
|
318 350 | }
|
351 + | /* OperationErrorGenerator.kt:257 */
|
319 352 | /// Returns `true` if the error kind is `StatusResponseError::ExtraError`.
|
353 + | /* OperationErrorGenerator.kt:258 */
|
320 354 | pub fn is_extra_error(&self) -> bool {
|
355 + | /* OperationErrorGenerator.kt:259 */
|
321 356 | matches!(self, Self::ExtraError(_))
|
357 + | /* OperationErrorGenerator.kt:258 */
|
322 358 | }
|
359 + | /* OperationErrorGenerator.kt:218 */
|
323 360 | }
|
361 + | /* OperationErrorGenerator.kt:269 */
|
324 362 | impl ::std::error::Error for StatusResponseError {
|
363 + | /* OperationErrorGenerator.kt:270 */
|
325 364 | fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
|
365 + | /* OperationErrorGenerator.kt:318 */
|
326 366 | match self {
|
327 - | Self::ExtraError(_inner) => ::std::option::Option::Some(_inner),
|
328 - | Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
|
367 + | /* OperationErrorGenerator.kt:321 */
|
368 + | Self::ExtraError(_inner) =>
|
369 + | /* OperationErrorGenerator.kt:283 */
|
370 + | {
|
371 + | ::std::option::Option::Some(_inner)
|
372 + | }
|
373 + | ,
|
374 + | /* OperationErrorGenerator.kt:326 */
|
375 + | Self::Unhandled(_inner) => {
|
376 + | /* OperationErrorGenerator.kt:279 */
|
377 + | ::std::option::Option::Some(&*_inner.source)
|
378 + | /* OperationErrorGenerator.kt:326 */
|
379 + | } /* OperationErrorGenerator.kt:318 */
|
329 380 | }
|
381 + | /* OperationErrorGenerator.kt:270 */
|
330 382 | }
|
383 + | /* OperationErrorGenerator.kt:269 */
|
331 384 | }
|
385 + | /* OperationErrorGenerator.kt:133 */
|
332 386 | impl ::std::fmt::Display for StatusResponseError {
|
387 + | /* OperationErrorGenerator.kt:134 */
|
333 388 | fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
|
389 + | /* OperationErrorGenerator.kt:318 */
|
334 390 | match self {
|
335 - | Self::ExtraError(_inner) => _inner.fmt(f),
|
391 + | /* OperationErrorGenerator.kt:321 */
|
392 + | Self::ExtraError(_inner) =>
|
393 + | /* OperationErrorGenerator.kt:151 */
|
394 + | {
|
395 + | _inner.fmt(f)
|
396 + | }
|
397 + | ,
|
398 + | /* OperationErrorGenerator.kt:326 */
|
336 399 | Self::Unhandled(_inner) => {
|
400 + | /* OperationErrorGenerator.kt:139 */
|
337 401 | if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
|
338 402 | write!(f, "unhandled error ({code})")
|
339 403 | } else {
|
340 404 | f.write_str("unhandled error")
|
341 405 | }
|
342 - | }
|
406 + | /* OperationErrorGenerator.kt:326 */
|
407 + | } /* OperationErrorGenerator.kt:318 */
|
343 408 | }
|
409 + | /* OperationErrorGenerator.kt:134 */
|
344 410 | }
|
411 + | /* OperationErrorGenerator.kt:133 */
|
345 412 | }
|
413 + | /* OperationErrorGenerator.kt:182 */
|
346 414 | impl ::aws_smithy_types::retry::ProvideErrorKind for StatusResponseError {
|
415 + | /* OperationErrorGenerator.kt:186 */
|
347 416 | fn code(&self) -> ::std::option::Option<&str> {
|
417 + | /* OperationErrorGenerator.kt:187 */
|
348 418 | ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
|
419 + | /* OperationErrorGenerator.kt:186 */
|
349 420 | }
|
421 + | /* OperationErrorGenerator.kt:190 */
|
350 422 | fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
|
423 + | /* OperationErrorGenerator.kt:197 */
|
351 424 | ::std::option::Option::None
|
425 + | /* OperationErrorGenerator.kt:190 */
|
352 426 | }
|
427 + | /* OperationErrorGenerator.kt:182 */
|
353 428 | }
|
429 + | /* OperationErrorGenerator.kt:163 */
|
354 430 | impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for StatusResponseError {
|
431 + | /* OperationErrorGenerator.kt:164 */
|
355 432 | fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
|
433 + | /* OperationErrorGenerator.kt:318 */
|
356 434 | match self {
|
357 - | Self::ExtraError(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
|
358 - | Self::Unhandled(_inner) => &_inner.meta,
|
435 + | /* OperationErrorGenerator.kt:321 */
|
436 + | Self::ExtraError(_inner) =>
|
437 + | /* OperationErrorGenerator.kt:169 */
|
438 + | {
|
439 + | ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner)
|
440 + | }
|
441 + | ,
|
442 + | /* OperationErrorGenerator.kt:326 */
|
443 + | Self::Unhandled(_inner) => {
|
444 + | /* OperationErrorGenerator.kt:168 */
|
445 + | &_inner.meta
|
446 + | /* OperationErrorGenerator.kt:326 */
|
447 + | } /* OperationErrorGenerator.kt:318 */
|
359 448 | }
|
449 + | /* OperationErrorGenerator.kt:164 */
|
360 450 | }
|
451 + | /* OperationErrorGenerator.kt:163 */
|
361 452 | }
|
453 + | /* OperationErrorGenerator.kt:109 */
|
362 454 | impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for StatusResponseError {
|
455 + | /* OperationErrorGenerator.kt:110 */
|
363 456 | fn create_unhandled_error(
|
364 457 | source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
|
365 458 | meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
|
366 459 | ) -> Self {
|
460 + | /* OperationErrorGenerator.kt:121 */
|
367 461 | Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
|
368 462 | source,
|
369 463 | meta: meta.unwrap_or_default(),
|
370 464 | })
|
465 + | /* OperationErrorGenerator.kt:110 */
|
371 466 | }
|
467 + | /* OperationErrorGenerator.kt:109 */
|
372 468 | }
|
373 469 |
|
470 + | /* CodegenDelegator.kt:255 */
|
374 471 | pub use crate::operation::status_response::_status_response_output::StatusResponseOutput;
|
375 472 |
|
473 + | /* CodegenDelegator.kt:255 */
|
376 474 | pub use crate::operation::status_response::_status_response_input::StatusResponseInput;
|
377 475 |
|
476 + | /* RustModule.kt:172 */
|
378 477 | mod _status_response_input;
|
379 478 |
|
479 + | /* RustModule.kt:172 */
|
380 480 | mod _status_response_output;
|
381 481 |
|
382 - | /// Builders
|
482 + | /// /* CodegenDelegator.kt:51 */Builders
|
383 483 | pub mod builders;
|