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