147 153 | ::std::borrow::Cow::Owned(rcb)
|
148 154 | }
|
149 155 | }
|
150 156 |
|
151 157 | #[derive(Debug)]
|
152 158 | struct PutFunctionCodeSigningConfigResponseDeserializer;
|
153 159 | impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for PutFunctionCodeSigningConfigResponseDeserializer {
|
154 160 | fn deserialize_nonstreaming(
|
155 161 | &self,
|
156 162 | response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
163 + | _cfg: &::aws_smithy_types::config_bag::ConfigBag,
|
157 164 | ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
|
158 165 | let (success, status) = (response.status().is_success(), response.status().as_u16());
|
159 - | let headers = response.headers();
|
160 - | let body = response.body().bytes().expect("body loaded");
|
161 166 | #[allow(unused_mut)]
|
162 167 | let mut force_error = false;
|
163 168 | ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
|
164 - | let parse_result = if !success && status != 200 || force_error {
|
165 - | crate::protocol_serde::shape_put_function_code_signing_config::de_put_function_code_signing_config_http_error(status, headers, body)
|
169 + | if !success && status != 200 || force_error {
|
170 + | let headers = response.headers();
|
171 + | let body = response.body().bytes().expect("body loaded");
|
172 + | #[allow(unused_mut)]
|
173 + | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
|
174 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
175 + | })?;
|
176 + | generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
|
177 + | let generic = generic_builder.build();
|
178 + | let error_code = match generic.code() {
|
179 + | ::std::option::Option::Some(code) => code,
|
180 + | ::std::option::Option::None => {
|
181 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
182 + | ::aws_smithy_runtime_api::box_error::BoxError::from(
|
183 + | crate::operation::put_function_code_signing_config::PutFunctionCodeSigningConfigError::unhandled(generic),
|
184 + | ),
|
185 + | ))
|
186 + | }
|
187 + | };
|
188 + | let _error_message = generic.message().map(|msg| msg.to_owned());
|
189 + | let protocol = _cfg
|
190 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
191 + | .expect("a SharedClientProtocol is required");
|
192 + | let err = match error_code {
|
193 + | "CodeSigningConfigNotFoundException" => {
|
194 + | crate::operation::put_function_code_signing_config::PutFunctionCodeSigningConfigError::CodeSigningConfigNotFoundException({
|
195 + | let mut tmp = match protocol
|
196 + | .deserialize_response(response, crate::types::error::CodeSigningConfigNotFoundException::SCHEMA, _cfg)
|
197 + | .and_then(|mut deser| {
|
198 + | crate::types::error::CodeSigningConfigNotFoundException::deserialize_with_response(
|
199 + | &mut *deser,
|
200 + | response.headers(),
|
201 + | response.status().into(),
|
202 + | body,
|
203 + | )
|
204 + | }) {
|
205 + | ::std::result::Result::Ok(val) => val,
|
206 + | ::std::result::Result::Err(e) => {
|
207 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
208 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
209 + | ))
|
210 + | }
|
211 + | };
|
212 + | tmp.meta = generic;
|
213 + | if tmp.message.is_none() {
|
214 + | tmp.message = _error_message;
|
215 + | }
|
216 + | tmp
|
217 + | })
|
218 + | }
|
219 + | "InvalidParameterValueException" => {
|
220 + | crate::operation::put_function_code_signing_config::PutFunctionCodeSigningConfigError::InvalidParameterValueException({
|
221 + | let mut tmp = match protocol
|
222 + | .deserialize_response(response, crate::types::error::InvalidParameterValueException::SCHEMA, _cfg)
|
223 + | .and_then(|mut deser| {
|
224 + | crate::types::error::InvalidParameterValueException::deserialize_with_response(
|
225 + | &mut *deser,
|
226 + | response.headers(),
|
227 + | response.status().into(),
|
228 + | body,
|
229 + | )
|
230 + | }) {
|
231 + | ::std::result::Result::Ok(val) => val,
|
232 + | ::std::result::Result::Err(e) => {
|
233 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
234 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
235 + | ))
|
236 + | }
|
237 + | };
|
238 + | tmp.meta = generic;
|
239 + | if tmp.message.is_none() {
|
240 + | tmp.message = _error_message;
|
241 + | }
|
242 + | tmp
|
243 + | })
|
244 + | }
|
245 + | "ResourceConflictException" => {
|
246 + | crate::operation::put_function_code_signing_config::PutFunctionCodeSigningConfigError::ResourceConflictException({
|
247 + | let mut tmp = match protocol
|
248 + | .deserialize_response(response, crate::types::error::ResourceConflictException::SCHEMA, _cfg)
|
249 + | .and_then(|mut deser| {
|
250 + | crate::types::error::ResourceConflictException::deserialize_with_response(
|
251 + | &mut *deser,
|
252 + | response.headers(),
|
253 + | response.status().into(),
|
254 + | body,
|
255 + | )
|
256 + | }) {
|
257 + | ::std::result::Result::Ok(val) => val,
|
258 + | ::std::result::Result::Err(e) => {
|
259 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
260 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
261 + | ))
|
262 + | }
|
263 + | };
|
264 + | tmp.meta = generic;
|
265 + | if tmp.message.is_none() {
|
266 + | tmp.message = _error_message;
|
267 + | }
|
268 + | tmp
|
269 + | })
|
270 + | }
|
271 + | "ResourceNotFoundException" => {
|
272 + | crate::operation::put_function_code_signing_config::PutFunctionCodeSigningConfigError::ResourceNotFoundException({
|
273 + | let mut tmp = match protocol
|
274 + | .deserialize_response(response, crate::types::error::ResourceNotFoundException::SCHEMA, _cfg)
|
275 + | .and_then(|mut deser| {
|
276 + | crate::types::error::ResourceNotFoundException::deserialize_with_response(
|
277 + | &mut *deser,
|
278 + | response.headers(),
|
279 + | response.status().into(),
|
280 + | body,
|
281 + | )
|
282 + | }) {
|
283 + | ::std::result::Result::Ok(val) => val,
|
284 + | ::std::result::Result::Err(e) => {
|
285 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
286 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
287 + | ))
|
288 + | }
|
289 + | };
|
290 + | tmp.meta = generic;
|
291 + | if tmp.message.is_none() {
|
292 + | tmp.message = _error_message;
|
293 + | }
|
294 + | tmp
|
295 + | })
|
296 + | }
|
297 + | "ServiceException" => crate::operation::put_function_code_signing_config::PutFunctionCodeSigningConfigError::ServiceException({
|
298 + | let mut tmp = match protocol
|
299 + | .deserialize_response(response, crate::types::error::ServiceException::SCHEMA, _cfg)
|
300 + | .and_then(|mut deser| {
|
301 + | crate::types::error::ServiceException::deserialize_with_response(
|
302 + | &mut *deser,
|
303 + | response.headers(),
|
304 + | response.status().into(),
|
305 + | body,
|
306 + | )
|
307 + | }) {
|
308 + | ::std::result::Result::Ok(val) => val,
|
309 + | ::std::result::Result::Err(e) => {
|
310 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
311 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
312 + | ))
|
313 + | }
|
314 + | };
|
315 + | tmp.meta = generic;
|
316 + | if tmp.message.is_none() {
|
317 + | tmp.message = _error_message;
|
318 + | }
|
319 + | tmp
|
320 + | }),
|
321 + | "TooManyRequestsException" => {
|
322 + | crate::operation::put_function_code_signing_config::PutFunctionCodeSigningConfigError::TooManyRequestsException({
|
323 + | let mut tmp = match protocol
|
324 + | .deserialize_response(response, crate::types::error::TooManyRequestsException::SCHEMA, _cfg)
|
325 + | .and_then(|mut deser| {
|
326 + | crate::types::error::TooManyRequestsException::deserialize_with_response(
|
327 + | &mut *deser,
|
328 + | response.headers(),
|
329 + | response.status().into(),
|
330 + | body,
|
331 + | )
|
332 + | }) {
|
333 + | ::std::result::Result::Ok(val) => val,
|
334 + | ::std::result::Result::Err(e) => {
|
335 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
336 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
337 + | ))
|
338 + | }
|
339 + | };
|
340 + | tmp.meta = generic;
|
341 + | if tmp.message.is_none() {
|
342 + | tmp.message = _error_message;
|
343 + | }
|
344 + | tmp
|
345 + | })
|
346 + | }
|
347 + | _ => crate::operation::put_function_code_signing_config::PutFunctionCodeSigningConfigError::generic(generic),
|
348 + | };
|
349 + | ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
|
350 + | ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
|
351 + | ))
|
166 352 | } else {
|
167 - | crate::protocol_serde::shape_put_function_code_signing_config::de_put_function_code_signing_config_http_response(status, headers, body)
|
168 - | };
|
169 - | crate::protocol_serde::type_erase_result(parse_result)
|
353 + | let protocol = _cfg
|
354 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
355 + | .expect("a SharedClientProtocol is required");
|
356 + | let mut deser = protocol
|
357 + | .deserialize_response(response, PutFunctionCodeSigningConfig::OUTPUT_SCHEMA, _cfg)
|
358 + | .map_err(|e| {
|
359 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
360 + | })?;
|
361 + | let body = response.body().bytes().expect("body loaded");
|
362 + | let output = crate::operation::put_function_code_signing_config::PutFunctionCodeSigningConfigOutput::deserialize_with_response(
|
363 + | &mut *deser,
|
364 + | response.headers(),
|
365 + | response.status().into(),
|
366 + | body,
|
367 + | )
|
368 + | .map_err(|e| {
|
369 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
370 + | })?;
|
371 + | ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
|
372 + | }
|
170 373 | }
|
171 374 | }
|
172 375 | #[derive(Debug)]
|
173 376 | struct PutFunctionCodeSigningConfigRequestSerializer;
|
174 377 | impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for PutFunctionCodeSigningConfigRequestSerializer {
|
175 378 | #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
|
176 379 | fn serialize_input(
|
177 380 | &self,
|
178 381 | input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
179 382 | _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
180 383 | ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
|
181 384 | let input = input
|
182 385 | .downcast::<crate::operation::put_function_code_signing_config::PutFunctionCodeSigningConfigInput>()
|
183 386 | .expect("correct type");
|
184 - | let _header_serialization_settings = _cfg
|
185 - | .load::<crate::serialization_settings::HeaderSerializationSettings>()
|
186 - | .cloned()
|
187 - | .unwrap_or_default();
|
188 - | let mut request_builder = {
|
189 - | #[allow(clippy::uninlined_format_args)]
|
190 - | fn uri_base(
|
191 - | _input: &crate::operation::put_function_code_signing_config::PutFunctionCodeSigningConfigInput,
|
192 - | output: &mut ::std::string::String,
|
193 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
194 - | use ::std::fmt::Write as _;
|
195 - | let input_1 = &_input.function_name;
|
196 - | let input_1 = input_1
|
197 - | .as_ref()
|
198 - | .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("function_name", "cannot be empty or unset"))?;
|
199 - | let function_name = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Default);
|
200 - | if function_name.is_empty() {
|
201 - | return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
|
202 - | "function_name",
|
203 - | "cannot be empty or unset",
|
204 - | ));
|
387 + | let protocol = _cfg
|
388 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
389 + | .expect("a SharedClientProtocol is required");
|
390 + | if protocol.supports_http_bindings() {
|
391 + | let mut request = protocol
|
392 + | .serialize_body(&input, PutFunctionCodeSigningConfig::INPUT_SCHEMA, "", _cfg)
|
393 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
394 + | {
|
395 + | let mut uri = "/2020-06-30/functions/{FunctionName}/code-signing-config".to_string();
|
396 + | let mut query_params: Vec<(String, String)> = Vec::new();
|
397 + | if let Some(ref val) = input.function_name {
|
398 + | uri = uri.replace("{FunctionName}", &::aws_smithy_schema::http_protocol::percent_encode(&val.to_string()));
|
205 399 | }
|
206 - | ::std::write!(
|
207 - | output,
|
208 - | "/2020-06-30/functions/{FunctionName}/code-signing-config",
|
209 - | FunctionName = function_name
|
210 - | )
|
211 - | .expect("formatting should succeed");
|
212 - | ::std::result::Result::Ok(())
|
213 - | }
|
214 - | #[allow(clippy::unnecessary_wraps)]
|
215 - | fn update_http_builder(
|
216 - | input: &crate::operation::put_function_code_signing_config::PutFunctionCodeSigningConfigInput,
|
217 - | builder: ::http_1x::request::Builder,
|
218 - | ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
219 - | let mut uri = ::std::string::String::new();
|
220 - | uri_base(input, &mut uri)?;
|
221 - | ::std::result::Result::Ok(builder.method("PUT").uri(uri))
|
400 + | if !query_params.is_empty() {
|
401 + | uri.push(if uri.contains('?') { '&' } else { '?' });
|
402 + | let pairs: Vec<String> = query_params
|
403 + | .iter()
|
404 + | .map(|(k, v)| {
|
405 + | format!(
|
406 + | "{}={}",
|
407 + | ::aws_smithy_schema::http_protocol::percent_encode(k),
|
408 + | ::aws_smithy_schema::http_protocol::percent_encode(v)
|
409 + | )
|
410 + | })
|
411 + | .collect();
|
412 + | uri.push_str(&pairs.join("&"));
|
413 + | }
|
414 + | request.set_uri(uri.as_str()).expect("valid URI");
|
222 415 | }
|
223 - | let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
|
224 - | builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/json");
|
225 - | builder
|
226 - | };
|
227 - | let body = ::aws_smithy_types::body::SdkBody::from(
|
228 - | crate::protocol_serde::shape_put_function_code_signing_config::ser_put_function_code_signing_config_input(&input)?,
|
229 - | );
|
230 - | if let Some(content_length) = body.content_length() {
|
231 - | let content_length = content_length.to_string();
|
232 - | request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
|
416 + |
|
417 + | return ::std::result::Result::Ok(request);
|
418 + | } else {
|
419 + | let mut request = protocol
|
420 + | .serialize_request(&input, PutFunctionCodeSigningConfig::INPUT_SCHEMA, "", _cfg)
|
421 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
422 + |
|
423 + | return ::std::result::Result::Ok(request);
|
233 424 | }
|
234 - | ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
|
235 425 | }
|
236 426 | }
|
237 427 | #[derive(Debug)]
|
238 428 | struct PutFunctionCodeSigningConfigEndpointParamsInterceptor;
|
239 429 |
|
240 430 | impl ::aws_smithy_runtime_api::client::interceptors::Intercept for PutFunctionCodeSigningConfigEndpointParamsInterceptor {
|
241 431 | fn name(&self) -> &'static str {
|
242 432 | "PutFunctionCodeSigningConfigEndpointParamsInterceptor"
|
243 433 | }
|
244 434 |
|