aws_sdk_s3/protocol_serde/
shape_get_bucket_notification_configuration.rs1#[allow(clippy::unnecessary_wraps)]
3pub fn de_get_bucket_notification_configuration_http_error(
4 _response_status: u16,
5 _response_headers: &::aws_smithy_runtime_api::http::Headers,
6 _response_body: &[u8],
7) -> std::result::Result<
8 crate::operation::get_bucket_notification_configuration::GetBucketNotificationConfigurationOutput,
9 crate::operation::get_bucket_notification_configuration::GetBucketNotificationConfigurationError,
10> {
11 #[allow(unused_mut)]
12 let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
13 .map_err(crate::operation::get_bucket_notification_configuration::GetBucketNotificationConfigurationError::unhandled)?;
14 generic_builder = crate::s3_request_id::apply_extended_request_id(generic_builder, _response_headers);
15 generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
16 let generic = generic_builder.build();
17 Err(crate::operation::get_bucket_notification_configuration::GetBucketNotificationConfigurationError::generic(generic))
18}
19
20#[allow(clippy::unnecessary_wraps)]
21pub fn de_get_bucket_notification_configuration_http_response(
22 _response_status: u16,
23 _response_headers: &::aws_smithy_runtime_api::http::Headers,
24 _response_body: &[u8],
25) -> std::result::Result<
26 crate::operation::get_bucket_notification_configuration::GetBucketNotificationConfigurationOutput,
27 crate::operation::get_bucket_notification_configuration::GetBucketNotificationConfigurationError,
28> {
29 Ok({
30 #[allow(unused_mut)]
31 let mut output =
32 crate::operation::get_bucket_notification_configuration::builders::GetBucketNotificationConfigurationOutputBuilder::default();
33 output = crate::protocol_serde::shape_get_bucket_notification_configuration::de_get_bucket_notification_configuration(_response_body, output)
34 .map_err(crate::operation::get_bucket_notification_configuration::GetBucketNotificationConfigurationError::unhandled)?;
35 output._set_extended_request_id(crate::s3_request_id::RequestIdExt::extended_request_id(_response_headers).map(str::to_string));
36 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
37 output.build()
38 })
39}
40
41pub fn ser_get_bucket_notification_configuration_headers(
42 input: &crate::operation::get_bucket_notification_configuration::GetBucketNotificationConfigurationInput,
43 mut builder: ::http::request::Builder,
44) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
45 if let ::std::option::Option::Some(inner_1) = &input.expected_bucket_owner {
46 let formatted_2 = inner_1.as_str();
47 let header_value = formatted_2;
48 let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
49 ::aws_smithy_types::error::operation::BuildError::invalid_field(
50 "expected_bucket_owner",
51 format!("`{}` cannot be used as a header value: {}", &header_value, err),
52 )
53 })?;
54 builder = builder.header("x-amz-expected-bucket-owner", header_value);
55 }
56 Ok(builder)
57}
58
59#[allow(unused_mut)]
60pub fn de_get_bucket_notification_configuration(
61 inp: &[u8],
62 mut builder: crate::operation::get_bucket_notification_configuration::builders::GetBucketNotificationConfigurationOutputBuilder,
63) -> std::result::Result<
64 crate::operation::get_bucket_notification_configuration::builders::GetBucketNotificationConfigurationOutputBuilder,
65 ::aws_smithy_xml::decode::XmlDecodeError,
66> {
67 let mut doc = ::aws_smithy_xml::decode::Document::try_from(inp)?;
68
69 #[allow(unused_mut)]
70 let mut decoder = doc.root_element()?;
71 #[allow(unused_variables)]
72 let start_el = decoder.start_el();
73 if !start_el.matches("NotificationConfiguration") {
74 return Err(::aws_smithy_xml::decode::XmlDecodeError::custom(format!(
75 "encountered invalid XML root: expected NotificationConfiguration but got {start_el:?}. This is likely a bug in the SDK."
76 )));
77 }
78 while let Some(mut tag) = decoder.next_tag() {
79 match tag.start_el() {
80 s if s.matches("CloudFunctionConfiguration") => {
81 let var_3 =
82 Some(
83 Result::<::std::vec::Vec::<crate::types::LambdaFunctionConfiguration>, ::aws_smithy_xml::decode::XmlDecodeError>::Ok({
84 let mut list_4 = builder.lambda_function_configurations.take().unwrap_or_default();
85 list_4.push(
86 crate::protocol_serde::shape_lambda_function_configuration::de_lambda_function_configuration(&mut tag)
87 ?
88 );
89 list_4
90 })
91 ?
92 )
93 ;
94 builder = builder.set_lambda_function_configurations(var_3);
95 }
96 ,
97 s if s.matches("TopicConfiguration") => {
98 let var_5 =
99 Some(
100 Result::<::std::vec::Vec::<crate::types::TopicConfiguration>, ::aws_smithy_xml::decode::XmlDecodeError>::Ok({
101 let mut list_6 = builder.topic_configurations.take().unwrap_or_default();
102 list_6.push(
103 crate::protocol_serde::shape_topic_configuration::de_topic_configuration(&mut tag)
104 ?
105 );
106 list_6
107 })
108 ?
109 )
110 ;
111 builder = builder.set_topic_configurations(var_5);
112 }
113 ,
114 s if s.matches("QueueConfiguration") => {
115 let var_7 =
116 Some(
117 Result::<::std::vec::Vec::<crate::types::QueueConfiguration>, ::aws_smithy_xml::decode::XmlDecodeError>::Ok({
118 let mut list_8 = builder.queue_configurations.take().unwrap_or_default();
119 list_8.push(
120 crate::protocol_serde::shape_queue_configuration::de_queue_configuration(&mut tag)
121 ?
122 );
123 list_8
124 })
125 ?
126 )
127 ;
128 builder = builder.set_queue_configurations(var_7);
129 }
130 ,
131 s if s.matches("EventBridgeConfiguration") => {
132 let var_9 =
133 Some(
134 crate::protocol_serde::shape_event_bridge_configuration::de_event_bridge_configuration(&mut tag)
135 ?
136 )
137 ;
138 builder = builder.set_event_bridge_configuration(var_9);
139 }
140 ,
141 _ => {}
142 }
143 }
144 Ok(builder)
145}