135 139 | crate::operation::list_aliases::ListAliasesError,
|
136 140 | >::new());
|
137 141 |
|
138 142 | ::std::borrow::Cow::Owned(rcb)
|
139 143 | }
|
140 144 | }
|
141 145 |
|
142 146 | #[derive(Debug)]
|
143 147 | struct ListAliasesResponseDeserializer;
|
144 148 | impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for ListAliasesResponseDeserializer {
|
145 - | fn deserialize_nonstreaming(
|
149 + | fn deserialize_nonstreaming_with_config(
|
146 150 | &self,
|
147 151 | response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
152 + | _cfg: &::aws_smithy_types::config_bag::ConfigBag,
|
148 153 | ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
|
149 154 | let (success, status) = (response.status().is_success(), response.status().as_u16());
|
150 - | let headers = response.headers();
|
151 - | let body = response.body().bytes().expect("body loaded");
|
152 155 | #[allow(unused_mut)]
|
153 156 | let mut force_error = false;
|
154 157 | ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
|
155 - | let parse_result = if !success && status != 200 || force_error {
|
156 - | crate::protocol_serde::shape_list_aliases::de_list_aliases_http_error(status, headers, body)
|
157 - | } else {
|
158 - | crate::protocol_serde::shape_list_aliases::de_list_aliases_http_response(status, headers, body)
|
158 + | if !success && status != 200 || force_error {
|
159 + | let headers = response.headers();
|
160 + | let body = response.body().bytes().expect("body loaded");
|
161 + | #[allow(unused_mut)]
|
162 + | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
|
163 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
164 + | })?;
|
165 + | generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
|
166 + | let generic = generic_builder.build();
|
167 + | let error_code = match generic.code() {
|
168 + | ::std::option::Option::Some(code) => code,
|
169 + | ::std::option::Option::None => {
|
170 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
171 + | ::aws_smithy_runtime_api::box_error::BoxError::from(crate::operation::list_aliases::ListAliasesError::unhandled(generic)),
|
172 + | ))
|
173 + | }
|
174 + | };
|
175 + | let _error_message = generic.message().map(|msg| msg.to_owned());
|
176 + | let protocol = _cfg
|
177 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
178 + | .expect("a SharedClientProtocol is required");
|
179 + | let err = match error_code {
|
180 + | "InvalidParameterValueException" => crate::operation::list_aliases::ListAliasesError::InvalidParameterValueException({
|
181 + | let mut tmp = match protocol
|
182 + | .deserialize_response(response, crate::types::error::InvalidParameterValueException::SCHEMA, _cfg)
|
183 + | .and_then(|mut deser| {
|
184 + | crate::types::error::InvalidParameterValueException::deserialize_with_response(
|
185 + | &mut *deser,
|
186 + | response.headers(),
|
187 + | response.status().into(),
|
188 + | body,
|
189 + | )
|
190 + | }) {
|
191 + | ::std::result::Result::Ok(val) => val,
|
192 + | ::std::result::Result::Err(e) => {
|
193 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
194 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
195 + | ))
|
196 + | }
|
197 + | };
|
198 + | tmp.meta = generic;
|
199 + | if tmp.message.is_none() {
|
200 + | tmp.message = _error_message;
|
201 + | }
|
202 + | tmp
|
203 + | }),
|
204 + | "ResourceNotFoundException" => crate::operation::list_aliases::ListAliasesError::ResourceNotFoundException({
|
205 + | let mut tmp = match protocol
|
206 + | .deserialize_response(response, crate::types::error::ResourceNotFoundException::SCHEMA, _cfg)
|
207 + | .and_then(|mut deser| {
|
208 + | crate::types::error::ResourceNotFoundException::deserialize_with_response(
|
209 + | &mut *deser,
|
210 + | response.headers(),
|
211 + | response.status().into(),
|
212 + | body,
|
213 + | )
|
214 + | }) {
|
215 + | ::std::result::Result::Ok(val) => val,
|
216 + | ::std::result::Result::Err(e) => {
|
217 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
218 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
219 + | ))
|
220 + | }
|
221 + | };
|
222 + | tmp.meta = generic;
|
223 + | if tmp.message.is_none() {
|
224 + | tmp.message = _error_message;
|
225 + | }
|
226 + | tmp
|
227 + | }),
|
228 + | "ServiceException" => crate::operation::list_aliases::ListAliasesError::ServiceException({
|
229 + | let mut tmp = match protocol
|
230 + | .deserialize_response(response, crate::types::error::ServiceException::SCHEMA, _cfg)
|
231 + | .and_then(|mut deser| {
|
232 + | crate::types::error::ServiceException::deserialize_with_response(
|
233 + | &mut *deser,
|
234 + | response.headers(),
|
235 + | response.status().into(),
|
236 + | body,
|
237 + | )
|
238 + | }) {
|
239 + | ::std::result::Result::Ok(val) => val,
|
240 + | ::std::result::Result::Err(e) => {
|
241 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
242 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
243 + | ))
|
244 + | }
|
245 + | };
|
246 + | tmp.meta = generic;
|
247 + | if tmp.message.is_none() {
|
248 + | tmp.message = _error_message;
|
249 + | }
|
250 + | tmp
|
251 + | }),
|
252 + | "TooManyRequestsException" => crate::operation::list_aliases::ListAliasesError::TooManyRequestsException({
|
253 + | let mut tmp = match protocol
|
254 + | .deserialize_response(response, crate::types::error::TooManyRequestsException::SCHEMA, _cfg)
|
255 + | .and_then(|mut deser| {
|
256 + | crate::types::error::TooManyRequestsException::deserialize_with_response(
|
257 + | &mut *deser,
|
258 + | response.headers(),
|
259 + | response.status().into(),
|
260 + | body,
|
261 + | )
|
262 + | }) {
|
263 + | ::std::result::Result::Ok(val) => val,
|
264 + | ::std::result::Result::Err(e) => {
|
265 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
266 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
267 + | ))
|
268 + | }
|
269 + | };
|
270 + | tmp.meta = generic;
|
271 + | if tmp.message.is_none() {
|
272 + | tmp.message = _error_message;
|
273 + | }
|
274 + | tmp
|
275 + | }),
|
276 + | _ => crate::operation::list_aliases::ListAliasesError::generic(generic),
|
159 277 | };
|
160 - | crate::protocol_serde::type_erase_result(parse_result)
|
278 + | ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
|
279 + | ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
|
280 + | ))
|
281 + | } else {
|
282 + | let protocol = _cfg
|
283 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
284 + | .expect("a SharedClientProtocol is required");
|
285 + | let mut deser = protocol.deserialize_response(response, ListAliases::OUTPUT_SCHEMA, _cfg).map_err(|e| {
|
286 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
287 + | })?;
|
288 + | let body = response.body().bytes().expect("body loaded");
|
289 + | let output = crate::operation::list_aliases::ListAliasesOutput::deserialize_with_response(
|
290 + | &mut *deser,
|
291 + | response.headers(),
|
292 + | response.status().into(),
|
293 + | body,
|
294 + | )
|
295 + | .map_err(|e| {
|
296 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
297 + | })?;
|
298 + | ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
|
299 + | }
|
161 300 | }
|
162 301 | }
|
163 302 | #[derive(Debug)]
|
164 303 | struct ListAliasesRequestSerializer;
|
165 304 | impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for ListAliasesRequestSerializer {
|
166 305 | #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
|
167 306 | fn serialize_input(
|
168 307 | &self,
|
169 308 | input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
170 309 | _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
171 310 | ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
|
172 311 | let input = input
|
173 312 | .downcast::<crate::operation::list_aliases::ListAliasesInput>()
|
174 313 | .expect("correct type");
|
175 - | let _header_serialization_settings = _cfg
|
176 - | .load::<crate::serialization_settings::HeaderSerializationSettings>()
|
177 - | .cloned()
|
178 - | .unwrap_or_default();
|
179 - | let mut request_builder = {
|
180 - | #[allow(clippy::uninlined_format_args)]
|
181 - | fn uri_base(
|
182 - | _input: &crate::operation::list_aliases::ListAliasesInput,
|
183 - | output: &mut ::std::string::String,
|
184 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
185 - | use ::std::fmt::Write as _;
|
186 - | let input_1 = &_input.function_name;
|
187 - | let input_1 = input_1
|
188 - | .as_ref()
|
189 - | .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("function_name", "cannot be empty or unset"))?;
|
190 - | let function_name = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Default);
|
191 - | if function_name.is_empty() {
|
192 - | return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
|
193 - | "function_name",
|
194 - | "cannot be empty or unset",
|
195 - | ));
|
196 - | }
|
197 - | ::std::write!(output, "/2015-03-31/functions/{FunctionName}/aliases", FunctionName = function_name)
|
198 - | .expect("formatting should succeed");
|
199 - | ::std::result::Result::Ok(())
|
200 - | }
|
201 - | fn uri_query(
|
202 - | _input: &crate::operation::list_aliases::ListAliasesInput,
|
203 - | mut output: &mut ::std::string::String,
|
204 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
205 - | let mut query = ::aws_smithy_http::query::Writer::new(output);
|
206 - | if let ::std::option::Option::Some(inner_2) = &_input.function_version {
|
207 - | {
|
208 - | query.push_kv("FunctionVersion", &::aws_smithy_http::query::fmt_string(inner_2));
|
209 - | }
|
210 - | }
|
211 - | if let ::std::option::Option::Some(inner_3) = &_input.marker {
|
314 + | let protocol = _cfg
|
315 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
316 + | .expect("a SharedClientProtocol is required");
|
317 + | if protocol.supports_http_bindings() {
|
318 + | let mut request = protocol
|
319 + | .serialize_body(&input, ListAliases::INPUT_SCHEMA, "", _cfg)
|
320 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
212 321 | {
|
213 - | query.push_kv("Marker", &::aws_smithy_http::query::fmt_string(inner_3));
|
214 - | }
|
215 - | }
|
216 - | if let ::std::option::Option::Some(inner_4) = &_input.max_items {
|
217 - | {
|
218 - | query.push_kv("MaxItems", ::aws_smithy_types::primitive::Encoder::from(*inner_4).encode());
|
219 - | }
|
322 + | let mut uri = "/2015-03-31/functions/{FunctionName}/aliases".to_string();
|
323 + | let mut query_params: Vec<(String, String)> = Vec::new();
|
324 + | if let Some(ref val) = input.function_name {
|
325 + | uri = uri.replace("{FunctionName}", &::aws_smithy_schema::http_protocol::percent_encode(&val.to_string()));
|
326 + | }
|
327 + | if let Some(ref val) = input.function_version {
|
328 + | query_params.push(("FunctionVersion".to_string(), val.to_string()));
|
329 + | }
|
330 + | if let Some(ref val) = input.marker {
|
331 + | query_params.push(("Marker".to_string(), val.to_string()));
|
332 + | }
|
333 + | if let Some(ref val) = input.max_items {
|
334 + | query_params.push(("MaxItems".to_string(), val.to_string()));
|
335 + | }
|
336 + | if !query_params.is_empty() {
|
337 + | uri.push(if uri.contains('?') { '&' } else { '?' });
|
338 + | let pairs: Vec<String> = query_params
|
339 + | .iter()
|
340 + | .map(|(k, v)| {
|
341 + | format!(
|
342 + | "{}={}",
|
343 + | ::aws_smithy_schema::http_protocol::percent_encode(k),
|
344 + | ::aws_smithy_schema::http_protocol::percent_encode(v)
|
345 + | )
|
346 + | })
|
347 + | .collect();
|
348 + | uri.push_str(&pairs.join("&"));
|
220 349 | }
|
221 - | ::std::result::Result::Ok(())
|
350 + | request.set_uri(uri.as_str()).expect("valid URI");
|
222 351 | }
|
223 - | #[allow(clippy::unnecessary_wraps)]
|
224 - | fn update_http_builder(
|
225 - | input: &crate::operation::list_aliases::ListAliasesInput,
|
226 - | builder: ::http_1x::request::Builder,
|
227 - | ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
228 - | let mut uri = ::std::string::String::new();
|
229 - | uri_base(input, &mut uri)?;
|
230 - | uri_query(input, &mut uri)?;
|
231 - | ::std::result::Result::Ok(builder.method("GET").uri(uri))
|
232 - | }
|
233 - | let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
|
234 - | builder
|
235 - | };
|
236 - | let body = ::aws_smithy_types::body::SdkBody::from("");
|
237 352 |
|
238 - | ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
|
353 + | return ::std::result::Result::Ok(request);
|
354 + | } else {
|
355 + | let mut request = protocol
|
356 + | .serialize_request(&input, ListAliases::INPUT_SCHEMA, "", _cfg)
|
357 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
358 + |
|
359 + | return ::std::result::Result::Ok(request);
|
360 + | }
|
239 361 | }
|
240 362 | }
|
241 363 | #[derive(Debug)]
|
242 364 | struct ListAliasesEndpointParamsInterceptor;
|
243 365 |
|
244 366 | impl ::aws_smithy_runtime_api::client::interceptors::Intercept for ListAliasesEndpointParamsInterceptor {
|
245 367 | fn name(&self) -> &'static str {
|
246 368 | "ListAliasesEndpointParamsInterceptor"
|
247 369 | }
|
248 370 |
|