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