1 1 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 2 | /// Orchestration and serialization glue logic for `Operation`.
|
3 3 | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
4 4 | #[non_exhaustive]
|
5 5 | pub struct Operation;
|
6 6 | impl Operation {
|
7 7 | /// Creates a new `Operation`
|
8 8 | pub fn new() -> Self {
|
9 9 | Self
|
10 10 | }
|
11 + | /// The schema for this operation's input shape.
|
12 + | pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::operation::OperationInput::SCHEMA;
|
13 + | /// The schema for this operation's output shape.
|
14 + | pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::operation::OperationOutput::SCHEMA;
|
11 15 | pub(crate) async fn orchestrate(
|
12 16 | runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
|
13 17 | input: crate::operation::operation::OperationInput,
|
14 18 | ) -> ::std::result::Result<
|
15 19 | crate::operation::operation::OperationOutput,
|
16 20 | ::aws_smithy_runtime_api::client::result::SdkError<
|
17 21 | crate::operation::operation::OperationError,
|
18 22 | ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
19 23 | >,
|
20 24 | > {
|
124 128 | ::std::borrow::Cow::Owned(rcb)
|
125 129 | }
|
126 130 | }
|
127 131 |
|
128 132 | #[derive(Debug)]
|
129 133 | struct OperationResponseDeserializer;
|
130 134 | impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for OperationResponseDeserializer {
|
131 135 | fn deserialize_nonstreaming(
|
132 136 | &self,
|
133 137 | response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
138 + | _cfg: &::aws_smithy_types::config_bag::ConfigBag,
|
134 139 | ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
|
135 140 | let (success, status) = (response.status().is_success(), response.status().as_u16());
|
141 + | #[allow(unused_mut)]
|
142 + | let mut force_error = false;
|
143 + |
|
144 + | if !success && status != 200 || force_error {
|
136 145 | let headers = response.headers();
|
137 146 | let body = response.body().bytes().expect("body loaded");
|
138 147 | #[allow(unused_mut)]
|
139 - | let mut force_error = false;
|
148 + | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
|
149 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
150 + | })?;
|
140 151 |
|
141 - | let parse_result = if !success && status != 200 || force_error {
|
142 - | crate::protocol_serde::shape_operation::de_operation_http_error(status, headers, body)
|
152 + | let generic = generic_builder.build();
|
153 + | ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
|
154 + | ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(crate::operation::operation::OperationError::generic(generic)),
|
155 + | ))
|
143 156 | } else {
|
144 - | crate::protocol_serde::shape_operation::de_operation_http_response(status, headers, body)
|
145 - | };
|
146 - | crate::protocol_serde::type_erase_result(parse_result)
|
157 + | let protocol = _cfg
|
158 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
159 + | .expect("a SharedClientProtocol is required");
|
160 + | let mut deser = protocol.deserialize_response(response, Operation::OUTPUT_SCHEMA, _cfg).map_err(|e| {
|
161 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
162 + | })?;
|
163 + | let body = response.body().bytes().expect("body loaded");
|
164 + | let output = crate::operation::operation::OperationOutput::deserialize_with_response(
|
165 + | &mut *deser,
|
166 + | response.headers(),
|
167 + | response.status().into(),
|
168 + | body,
|
169 + | )
|
170 + | .map_err(|e| {
|
171 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
172 + | })?;
|
173 + | ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
|
174 + | }
|
147 175 | }
|
148 176 | }
|
149 177 | #[derive(Debug)]
|
150 178 | struct OperationRequestSerializer;
|
151 179 | impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for OperationRequestSerializer {
|
152 180 | #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
|
153 181 | fn serialize_input(
|
154 182 | &self,
|
155 183 | input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
156 184 | _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
157 185 | ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
|
158 186 | let input = input.downcast::<crate::operation::operation::OperationInput>().expect("correct type");
|
159 - | let _header_serialization_settings = _cfg
|
160 - | .load::<crate::serialization_settings::HeaderSerializationSettings>()
|
161 - | .cloned()
|
162 - | .unwrap_or_default();
|
163 - | let mut request_builder = {
|
164 - | #[allow(clippy::uninlined_format_args)]
|
165 - | fn uri_base(
|
166 - | _input: &crate::operation::operation::OperationInput,
|
167 - | output: &mut ::std::string::String,
|
168 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
169 - | use ::std::fmt::Write as _;
|
170 - | ::std::write!(output, "/operation").expect("formatting should succeed");
|
171 - | ::std::result::Result::Ok(())
|
172 - | }
|
173 - | #[allow(clippy::unnecessary_wraps)]
|
174 - | fn update_http_builder(
|
175 - | input: &crate::operation::operation::OperationInput,
|
176 - | builder: ::http_1x::request::Builder,
|
177 - | ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
178 - | let mut uri = ::std::string::String::new();
|
179 - | uri_base(input, &mut uri)?;
|
180 - | ::std::result::Result::Ok(builder.method("POST").uri(uri))
|
181 - | }
|
182 - | let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
|
183 - | builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/json");
|
184 - | builder
|
185 - | };
|
186 - | let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_operation::ser_operation_input(&input)?);
|
187 - | if let Some(content_length) = body.content_length() {
|
188 - | let content_length = content_length.to_string();
|
189 - | request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
|
190 - | }
|
191 - | ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
|
187 + | let protocol = _cfg
|
188 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
189 + | .expect("a SharedClientProtocol is required");
|
190 + | let mut request = protocol
|
191 + | .serialize_request(&input, Operation::INPUT_SCHEMA, "", _cfg)
|
192 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
193 + |
|
194 + | return ::std::result::Result::Ok(request);
|
192 195 | }
|
193 196 | }
|
194 197 | #[derive(Debug)]
|
195 198 | struct OperationEndpointParamsInterceptor;
|
196 199 |
|
197 200 | impl ::aws_smithy_runtime_api::client::interceptors::Intercept for OperationEndpointParamsInterceptor {
|
198 201 | fn name(&self) -> &'static str {
|
199 202 | "OperationEndpointParamsInterceptor"
|
200 203 | }
|
201 204 |
|