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 Protocol",
|
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.1");
|
195 208 | builder = _header_serialization_settings.set_default_header(
|
196 209 | builder,
|
197 210 | ::http::header::HeaderName::from_static("x-amz-target"),
|
198 211 | "JsonProtocol.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: AwsJson11EndpointTraitWithHostLabel
|
270 287 | #[::tokio::test]
|
271 288 | #[::tracing_test::traced_test]
|
272 289 | async fn aws_json11_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 expected_headers = [
|
285 302 | ("Content-Type", "application/x-amz-json-1.1"),
|
286 303 | ("X-Amz-Target", "JsonProtocol.EndpointWithHostLabelOperation"),
|
287 304 | ];
|
288 305 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
289 306 | let body = http_request.body().bytes().expect("body should be strict");
|
290 307 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
291 308 | body,
|
292 309 | "{\"label\": \"bar\"}",
|
293 310 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
294 311 | ));
|
295 312 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
296 313 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
297 314 | ::pretty_assertions::assert_eq!(uri.path(), "/", "path was incorrect");
|
298 315 | ::pretty_assertions::assert_eq!(uri.host().expect("host should be set"), "foo.bar.example.com");
|
299 316 | }
|
317 + |
|
318 + | /* ProtocolTestGenerator.kt:98 */
|
300 319 | }
|
301 320 |
|
321 + | /* OperationErrorGenerator.kt:79 */
|
302 322 | /// Error type for the `EndpointWithHostLabelOperationError` operation.
|
323 + | /* RustType.kt:516 */
|
303 324 | #[non_exhaustive]
|
325 + | /* RustType.kt:516 */
|
304 326 | #[derive(::std::fmt::Debug)]
|
305 - | pub enum EndpointWithHostLabelOperationError {
|
327 + | pub /* OperationErrorGenerator.kt:81 */ enum EndpointWithHostLabelOperationError {
|
328 + | /* OperationErrorGenerator.kt:88 */
|
306 329 | /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
|
307 330 | #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
|
308 331 | variable wildcard pattern and check `.code()`:
|
309 332 | \
|
310 333 | `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
|
311 334 | \
|
312 335 | See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-EndpointWithHostLabelOperationError) for what information is available for the error.")]
|
313 336 | Unhandled(crate::error::sealed_unhandled::Unhandled),
|
337 + | /* OperationErrorGenerator.kt:81 */
|
314 338 | }
|
339 + | /* OperationErrorGenerator.kt:218 */
|
315 340 | impl EndpointWithHostLabelOperationError {
|
341 + | /* OperationErrorGenerator.kt:219 */
|
316 342 | /// Creates the `EndpointWithHostLabelOperationError::Unhandled` variant from any error type.
|
317 343 | pub fn unhandled(
|
318 344 | err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
|
319 345 | ) -> Self {
|
320 346 | Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
|
321 347 | source: err.into(),
|
322 348 | meta: ::std::default::Default::default(),
|
323 349 | })
|
324 350 | }
|
325 351 |
|
326 352 | /// Creates the `EndpointWithHostLabelOperationError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
|
327 353 | pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
|
328 354 | Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
|
329 355 | source: err.clone().into(),
|
330 356 | meta: err,
|
331 357 | })
|
332 358 | }
|
333 - | ///
|
359 + | /// /* OperationErrorGenerator.kt:236 */
|
334 360 | /// Returns error metadata, which includes the error code, message,
|
335 361 | /// request ID, and potentially additional information.
|
336 362 | ///
|
363 + | /* OperationErrorGenerator.kt:242 */
|
337 364 | pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
|
365 + | /* OperationErrorGenerator.kt:243 */
|
338 366 | match self {
|
339 - | Self::Unhandled(e) => &e.meta,
|
367 + | /* OperationErrorGenerator.kt:251 */ Self::Unhandled(e) => &e.meta,
|
368 + | /* OperationErrorGenerator.kt:243 */
|
340 369 | }
|
370 + | /* OperationErrorGenerator.kt:242 */
|
341 371 | }
|
372 + | /* OperationErrorGenerator.kt:218 */
|
342 373 | }
|
374 + | /* OperationErrorGenerator.kt:269 */
|
343 375 | impl ::std::error::Error for EndpointWithHostLabelOperationError {
|
376 + | /* OperationErrorGenerator.kt:270 */
|
344 377 | fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
|
378 + | /* OperationErrorGenerator.kt:318 */
|
345 379 | match self {
|
346 - | Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
|
380 + | /* OperationErrorGenerator.kt:326 */
|
381 + | Self::Unhandled(_inner) => {
|
382 + | /* OperationErrorGenerator.kt:279 */
|
383 + | ::std::option::Option::Some(&*_inner.source)
|
384 + | /* OperationErrorGenerator.kt:326 */
|
385 + | } /* OperationErrorGenerator.kt:318 */
|
347 386 | }
|
387 + | /* OperationErrorGenerator.kt:270 */
|
348 388 | }
|
389 + | /* OperationErrorGenerator.kt:269 */
|
349 390 | }
|
391 + | /* OperationErrorGenerator.kt:133 */
|
350 392 | impl ::std::fmt::Display for EndpointWithHostLabelOperationError {
|
393 + | /* OperationErrorGenerator.kt:134 */
|
351 394 | fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
|
395 + | /* OperationErrorGenerator.kt:318 */
|
352 396 | match self {
|
397 + | /* OperationErrorGenerator.kt:326 */
|
353 398 | Self::Unhandled(_inner) => {
|
399 + | /* OperationErrorGenerator.kt:139 */
|
354 400 | if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
|
355 401 | write!(f, "unhandled error ({code})")
|
356 402 | } else {
|
357 403 | f.write_str("unhandled error")
|
358 404 | }
|
359 - | }
|
405 + | /* OperationErrorGenerator.kt:326 */
|
406 + | } /* OperationErrorGenerator.kt:318 */
|
360 407 | }
|
408 + | /* OperationErrorGenerator.kt:134 */
|
361 409 | }
|
410 + | /* OperationErrorGenerator.kt:133 */
|
362 411 | }
|
412 + | /* OperationErrorGenerator.kt:182 */
|
363 413 | impl ::aws_smithy_types::retry::ProvideErrorKind for EndpointWithHostLabelOperationError {
|
414 + | /* OperationErrorGenerator.kt:186 */
|
364 415 | fn code(&self) -> ::std::option::Option<&str> {
|
416 + | /* OperationErrorGenerator.kt:187 */
|
365 417 | ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
|
418 + | /* OperationErrorGenerator.kt:186 */
|
366 419 | }
|
420 + | /* OperationErrorGenerator.kt:190 */
|
367 421 | fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
|
422 + | /* OperationErrorGenerator.kt:197 */
|
368 423 | ::std::option::Option::None
|
424 + | /* OperationErrorGenerator.kt:190 */
|
369 425 | }
|
426 + | /* OperationErrorGenerator.kt:182 */
|
370 427 | }
|
428 + | /* OperationErrorGenerator.kt:163 */
|
371 429 | impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for EndpointWithHostLabelOperationError {
|
430 + | /* OperationErrorGenerator.kt:164 */
|
372 431 | fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
|
432 + | /* OperationErrorGenerator.kt:318 */
|
373 433 | match self {
|
374 - | Self::Unhandled(_inner) => &_inner.meta,
|
434 + | /* OperationErrorGenerator.kt:326 */
|
435 + | Self::Unhandled(_inner) => {
|
436 + | /* OperationErrorGenerator.kt:168 */
|
437 + | &_inner.meta
|
438 + | /* OperationErrorGenerator.kt:326 */
|
439 + | } /* OperationErrorGenerator.kt:318 */
|
375 440 | }
|
441 + | /* OperationErrorGenerator.kt:164 */
|
376 442 | }
|
443 + | /* OperationErrorGenerator.kt:163 */
|
377 444 | }
|
445 + | /* OperationErrorGenerator.kt:109 */
|
378 446 | impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for EndpointWithHostLabelOperationError {
|
447 + | /* OperationErrorGenerator.kt:110 */
|
379 448 | fn create_unhandled_error(
|
380 449 | source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
|
381 450 | meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
|
382 451 | ) -> Self {
|
452 + | /* OperationErrorGenerator.kt:121 */
|
383 453 | Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
|
384 454 | source,
|
385 455 | meta: meta.unwrap_or_default(),
|
386 456 | })
|
457 + | /* OperationErrorGenerator.kt:110 */
|
387 458 | }
|
459 + | /* OperationErrorGenerator.kt:109 */
|
388 460 | }
|
389 461 |
|
462 + | /* CodegenDelegator.kt:255 */
|
390 463 | pub use crate::operation::endpoint_with_host_label_operation::_endpoint_with_host_label_operation_output::EndpointWithHostLabelOperationOutput;
|
391 464 |
|
465 + | /* CodegenDelegator.kt:255 */
|
392 466 | pub use crate::operation::endpoint_with_host_label_operation::_endpoint_with_host_label_operation_input::EndpointWithHostLabelOperationInput;
|
393 467 |
|
468 + | /* RustModule.kt:172 */
|
394 469 | mod _endpoint_with_host_label_operation_input;
|
395 470 |
|
471 + | /* RustModule.kt:172 */
|
396 472 | mod _endpoint_with_host_label_operation_output;
|
397 473 |
|
398 - | /// Builders
|
474 + | /// /* CodegenDelegator.kt:51 */Builders
|
399 475 | pub mod builders;
|