1 + | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 + | #[allow(clippy::unnecessary_wraps)]
|
3 + | pub async fn de_endpoint_with_host_label_operation_http_request<B>(
|
4 + | #[allow(unused_variables)] request: ::http::Request<B>,
|
5 + | ) -> std::result::Result<
|
6 + | crate::input::EndpointWithHostLabelOperationInput,
|
7 + | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection,
|
8 + | >
|
9 + | where
|
10 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
11 + | B::Data: Send,
|
12 + | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
13 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
14 + | {
|
15 + | Ok({
|
16 + | #[allow(unused_mut)]
|
17 + | let mut input = crate::input::endpoint_with_host_label_operation_input::Builder::default();
|
18 + | #[allow(unused_variables)]
|
19 + | let ::aws_smithy_runtime_api::http::RequestParts {
|
20 + | uri, headers, body, ..
|
21 + | } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
|
22 + | let bytes = ::hyper::body::to_bytes(body).await?;
|
23 + | if !bytes.is_empty() {
|
24 + | ::aws_smithy_legacy_http_server::protocol::content_type_header_classifier_smithy(
|
25 + | &headers,
|
26 + | Some("application/x-amz-json-1.1"),
|
27 + | )?;
|
28 + | input = crate::protocol_serde::shape_endpoint_with_host_label_operation::de_endpoint_with_host_label_operation(bytes.as_ref(), input)?;
|
29 + | }
|
30 + | input.build()?
|
31 + | })
|
32 + | }
|
33 + |
|
34 + | #[allow(clippy::unnecessary_wraps)]
|
35 + | pub fn ser_endpoint_with_host_label_operation_http_response(
|
36 + | #[allow(unused_variables)] output: crate::output::EndpointWithHostLabelOperationOutput,
|
37 + | ) -> std::result::Result<
|
38 + | ::aws_smithy_legacy_http_server::response::Response,
|
39 + | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::ResponseRejection,
|
40 + | > {
|
41 + | Ok({
|
42 + | #[allow(unused_mut)]
|
43 + | let mut builder = ::http::Response::builder();
|
44 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
45 + | builder,
|
46 + | ::http::header::CONTENT_TYPE,
|
47 + | "application/x-amz-json-1.1",
|
48 + | );
|
49 + | let http_status: u16 = 200;
|
50 + | builder = builder.status(http_status);
|
51 + | let payload = "";
|
52 + | let content_length = payload.len();
|
53 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
54 + | builder,
|
55 + | ::http::header::CONTENT_LENGTH,
|
56 + | content_length,
|
57 + | );
|
58 + | let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
|
59 + | builder.body(body)?
|
60 + | })
|
61 + | }
|
62 + |
|
63 + | #[allow(clippy::unnecessary_wraps)]
|
64 + | pub fn ser_endpoint_with_host_label_operation_http_error(
|
65 + | error: &crate::error::EndpointWithHostLabelOperationError,
|
66 + | ) -> std::result::Result<
|
67 + | ::aws_smithy_legacy_http_server::response::Response,
|
68 + | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::ResponseRejection,
|
69 + | > {
|
70 + | Ok({
|
71 + | match error {
|
72 + | crate::error::EndpointWithHostLabelOperationError::ValidationException(output) => {
|
73 + | let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
|
74 + | #[allow(unused_mut)]
|
75 + | let mut builder = ::http::Response::builder();
|
76 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
77 + | builder,
|
78 + | ::http::header::CONTENT_TYPE,
|
79 + | "application/x-amz-json-1.1",
|
80 + | );
|
81 + | let content_length = payload.len();
|
82 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
83 + | builder,
|
84 + | ::http::header::CONTENT_LENGTH,
|
85 + | content_length,
|
86 + | );
|
87 + | builder
|
88 + | .status(400)
|
89 + | .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
|
90 + | }
|
91 + | }
|
92 + | })
|
93 + | }
|
94 + |
|
95 + | pub(crate) fn de_endpoint_with_host_label_operation(
|
96 + | value: &[u8],
|
97 + | mut builder: crate::input::endpoint_with_host_label_operation_input::Builder,
|
98 + | ) -> ::std::result::Result<
|
99 + | crate::input::endpoint_with_host_label_operation_input::Builder,
|
100 + | ::aws_smithy_json::deserialize::error::DeserializeError,
|
101 + | > {
|
102 + | let mut tokens_owned =
|
103 + | ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
|
104 + | .peekable();
|
105 + | let tokens = &mut tokens_owned;
|
106 + | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
107 + | loop {
|
108 + | match tokens.next().transpose()? {
|
109 + | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
110 + | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
|
111 + | match key.to_unescaped()?.as_ref() {
|
112 + | "label" => {
|
113 + | if let Some(v) =
|
114 + | ::aws_smithy_json::deserialize::token::expect_string_or_null(
|
115 + | tokens.next(),
|
116 + | )?
|
117 + | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
118 + | .transpose()?
|
119 + | {
|
120 + | builder = builder.set_label(v);
|
121 + | }
|
122 + | }
|
123 + | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
124 + | }
|
125 + | }
|
126 + | other => {
|
127 + | return Err(
|
128 + | ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
129 + | "expected object key or end object, found: {other:?}"
|
130 + | )),
|
131 + | )
|
132 + | }
|
133 + | }
|
134 + | }
|
135 + | if tokens.next().is_some() {
|
136 + | return Err(
|
137 + | ::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
138 + | "found more JSON tokens after completing parsing",
|
139 + | ),
|
140 + | );
|
141 + | }
|
142 + | Ok(builder)
|
143 + | }
|