1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | #[allow(clippy::unnecessary_wraps)]
|
3 - | pub fn de_update_global_table_settings_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::update_global_table_settings::UpdateGlobalTableSettingsOutput,
|
9 - | crate::operation::update_global_table_settings::UpdateGlobalTableSettingsError,
|
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::update_global_table_settings::UpdateGlobalTableSettingsError::unhandled)?;
|
14 - | generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
|
15 - | let generic = generic_builder.build();
|
16 - | let error_code = match generic.code() {
|
17 - | Some(code) => code,
|
18 - | None => {
|
19 - | return Err(crate::operation::update_global_table_settings::UpdateGlobalTableSettingsError::unhandled(
|
20 - | generic,
|
21 - | ))
|
22 - | }
|
23 - | };
|
24 - |
|
25 - | let _error_message = generic.message().map(|msg| msg.to_owned());
|
26 - | Err(match error_code {
|
27 - | "GlobalTableNotFoundException" => {
|
28 - | crate::operation::update_global_table_settings::UpdateGlobalTableSettingsError::GlobalTableNotFoundException({
|
29 - | #[allow(unused_mut)]
|
30 - | let mut tmp = {
|
31 - | #[allow(unused_mut)]
|
32 - | let mut output = crate::types::error::builders::GlobalTableNotFoundExceptionBuilder::default();
|
33 - | output = crate::protocol_serde::shape_global_table_not_found_exception::de_global_table_not_found_exception_json_err(
|
34 - | _response_body,
|
35 - | output,
|
36 - | )
|
37 - | .map_err(crate::operation::update_global_table_settings::UpdateGlobalTableSettingsError::unhandled)?;
|
38 - | let output = output.meta(generic);
|
39 - | output.build()
|
40 - | };
|
41 - | if tmp.message.is_none() {
|
42 - | tmp.message = _error_message;
|
43 - | }
|
44 - | tmp
|
45 - | })
|
46 - | }
|
47 - | "IndexNotFoundException" => crate::operation::update_global_table_settings::UpdateGlobalTableSettingsError::IndexNotFoundException({
|
48 - | #[allow(unused_mut)]
|
49 - | let mut tmp = {
|
50 - | #[allow(unused_mut)]
|
51 - | let mut output = crate::types::error::builders::IndexNotFoundExceptionBuilder::default();
|
52 - | output = crate::protocol_serde::shape_index_not_found_exception::de_index_not_found_exception_json_err(_response_body, output)
|
53 - | .map_err(crate::operation::update_global_table_settings::UpdateGlobalTableSettingsError::unhandled)?;
|
54 - | let output = output.meta(generic);
|
55 - | output.build()
|
56 - | };
|
57 - | if tmp.message.is_none() {
|
58 - | tmp.message = _error_message;
|
59 - | }
|
60 - | tmp
|
61 - | }),
|
62 - | "InternalServerError" => crate::operation::update_global_table_settings::UpdateGlobalTableSettingsError::InternalServerError({
|
63 - | #[allow(unused_mut)]
|
64 - | let mut tmp = {
|
65 - | #[allow(unused_mut)]
|
66 - | let mut output = crate::types::error::builders::InternalServerErrorBuilder::default();
|
67 - | output = crate::protocol_serde::shape_internal_server_error::de_internal_server_error_json_err(_response_body, output)
|
68 - | .map_err(crate::operation::update_global_table_settings::UpdateGlobalTableSettingsError::unhandled)?;
|
69 - | let output = output.meta(generic);
|
70 - | output.build()
|
71 - | };
|
72 - | if tmp.message.is_none() {
|
73 - | tmp.message = _error_message;
|
74 - | }
|
75 - | tmp
|
76 - | }),
|
77 - | "InvalidEndpointException" => crate::operation::update_global_table_settings::UpdateGlobalTableSettingsError::InvalidEndpointException({
|
78 - | #[allow(unused_mut)]
|
79 - | let mut tmp = {
|
80 - | #[allow(unused_mut)]
|
81 - | let mut output = crate::types::error::builders::InvalidEndpointExceptionBuilder::default();
|
82 - | output = crate::protocol_serde::shape_invalid_endpoint_exception::de_invalid_endpoint_exception_json_err(_response_body, output)
|
83 - | .map_err(crate::operation::update_global_table_settings::UpdateGlobalTableSettingsError::unhandled)?;
|
84 - | let output = output.meta(generic);
|
85 - | output.build()
|
86 - | };
|
87 - | if tmp.message.is_none() {
|
88 - | tmp.message = _error_message;
|
89 - | }
|
90 - | tmp
|
91 - | }),
|
92 - | "LimitExceededException" => crate::operation::update_global_table_settings::UpdateGlobalTableSettingsError::LimitExceededException({
|
93 - | #[allow(unused_mut)]
|
94 - | let mut tmp = {
|
95 - | #[allow(unused_mut)]
|
96 - | let mut output = crate::types::error::builders::LimitExceededExceptionBuilder::default();
|
97 - | output = crate::protocol_serde::shape_limit_exceeded_exception::de_limit_exceeded_exception_json_err(_response_body, output)
|
98 - | .map_err(crate::operation::update_global_table_settings::UpdateGlobalTableSettingsError::unhandled)?;
|
99 - | let output = output.meta(generic);
|
100 - | output.build()
|
101 - | };
|
102 - | if tmp.message.is_none() {
|
103 - | tmp.message = _error_message;
|
104 - | }
|
105 - | tmp
|
106 - | }),
|
107 - | "ReplicaNotFoundException" => crate::operation::update_global_table_settings::UpdateGlobalTableSettingsError::ReplicaNotFoundException({
|
108 - | #[allow(unused_mut)]
|
109 - | let mut tmp = {
|
110 - | #[allow(unused_mut)]
|
111 - | let mut output = crate::types::error::builders::ReplicaNotFoundExceptionBuilder::default();
|
112 - | output = crate::protocol_serde::shape_replica_not_found_exception::de_replica_not_found_exception_json_err(_response_body, output)
|
113 - | .map_err(crate::operation::update_global_table_settings::UpdateGlobalTableSettingsError::unhandled)?;
|
114 - | let output = output.meta(generic);
|
115 - | output.build()
|
116 - | };
|
117 - | if tmp.message.is_none() {
|
118 - | tmp.message = _error_message;
|
119 - | }
|
120 - | tmp
|
121 - | }),
|
122 - | "ResourceInUseException" => crate::operation::update_global_table_settings::UpdateGlobalTableSettingsError::ResourceInUseException({
|
123 - | #[allow(unused_mut)]
|
124 - | let mut tmp = {
|
125 - | #[allow(unused_mut)]
|
126 - | let mut output = crate::types::error::builders::ResourceInUseExceptionBuilder::default();
|
127 - | output = crate::protocol_serde::shape_resource_in_use_exception::de_resource_in_use_exception_json_err(_response_body, output)
|
128 - | .map_err(crate::operation::update_global_table_settings::UpdateGlobalTableSettingsError::unhandled)?;
|
129 - | let output = output.meta(generic);
|
130 - | output.build()
|
131 - | };
|
132 - | if tmp.message.is_none() {
|
133 - | tmp.message = _error_message;
|
134 - | }
|
135 - | tmp
|
136 - | }),
|
137 - | _ => crate::operation::update_global_table_settings::UpdateGlobalTableSettingsError::generic(generic),
|
138 - | })
|
139 - | }
|
140 - |
|
141 - | #[allow(clippy::unnecessary_wraps)]
|
142 - | pub fn de_update_global_table_settings_http_response(
|
143 - | _response_status: u16,
|
144 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
145 - | _response_body: &[u8],
|
146 - | ) -> std::result::Result<
|
147 - | crate::operation::update_global_table_settings::UpdateGlobalTableSettingsOutput,
|
148 - | crate::operation::update_global_table_settings::UpdateGlobalTableSettingsError,
|
149 - | > {
|
150 - | Ok({
|
151 - | #[allow(unused_mut)]
|
152 - | let mut output = crate::operation::update_global_table_settings::builders::UpdateGlobalTableSettingsOutputBuilder::default();
|
153 - | output = crate::protocol_serde::shape_update_global_table_settings::de_update_global_table_settings(_response_body, output)
|
154 - | .map_err(crate::operation::update_global_table_settings::UpdateGlobalTableSettingsError::unhandled)?;
|
155 - | output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
|
156 - | output.build()
|
157 - | })
|
158 - | }
|
159 - |
|
160 - | pub fn ser_update_global_table_settings_input(
|
161 - | input: &crate::operation::update_global_table_settings::UpdateGlobalTableSettingsInput,
|
162 - | ) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
|
163 - | let mut out = String::new();
|
164 - | let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
|
165 - | crate::protocol_serde::shape_update_global_table_settings_input::ser_update_global_table_settings_input_input(&mut object, input)?;
|
166 - | object.finish();
|
167 - | Ok(::aws_smithy_types::body::SdkBody::from(out))
|
168 - | }
|
169 - |
|
170 - | pub(crate) fn de_update_global_table_settings(
|
171 - | _value: &[u8],
|
172 - | mut builder: crate::operation::update_global_table_settings::builders::UpdateGlobalTableSettingsOutputBuilder,
|
173 - | ) -> ::std::result::Result<
|
174 - | crate::operation::update_global_table_settings::builders::UpdateGlobalTableSettingsOutputBuilder,
|
175 - | ::aws_smithy_json::deserialize::error::DeserializeError,
|
176 - | > {
|
177 - | let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
|
178 - | let tokens = &mut tokens_owned;
|
179 - | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
180 - | loop {
|
181 - | match tokens.next().transpose()? {
|
182 - | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
183 - | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
|
184 - | "GlobalTableName" => {
|
185 - | builder = builder.set_global_table_name(
|
186 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
187 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
188 - | .transpose()?,
|
189 - | );
|
190 - | }
|
191 - | "ReplicaSettings" => {
|
192 - | builder = builder.set_replica_settings(
|
193 - | crate::protocol_serde::shape_replica_settings_description_list::de_replica_settings_description_list(tokens, _value)?,
|
194 - | );
|
195 - | }
|
196 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
197 - | },
|
198 - | other => {
|
199 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
200 - | "expected object key or end object, found: {other:?}"
|
201 - | )))
|
202 - | }
|
203 - | }
|
204 - | }
|
205 - | if tokens.next().is_some() {
|
206 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
207 - | "found more JSON tokens after completing parsing",
|
208 - | ));
|
209 - | }
|
210 - | Ok(builder)
|
211 - | }
|