1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | #[allow(clippy::unnecessary_wraps)]
|
3 - | pub fn de_replicate_key_http_error(
|
4 - | _response_status: u16,
|
5 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
6 - | _response_body: &[u8],
|
7 - | ) -> std::result::Result<crate::operation::replicate_key::ReplicateKeyOutput, crate::operation::replicate_key::ReplicateKeyError> {
|
8 - | #[allow(unused_mut)]
|
9 - | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
|
10 - | .map_err(crate::operation::replicate_key::ReplicateKeyError::unhandled)?;
|
11 - | generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
|
12 - | let generic = generic_builder.build();
|
13 - | let error_code = match generic.code() {
|
14 - | Some(code) => code,
|
15 - | None => return Err(crate::operation::replicate_key::ReplicateKeyError::unhandled(generic)),
|
16 - | };
|
17 - |
|
18 - | let _error_message = generic.message().map(|msg| msg.to_owned());
|
19 - | Err(match error_code {
|
20 - | "AlreadyExistsException" => crate::operation::replicate_key::ReplicateKeyError::AlreadyExistsException({
|
21 - | #[allow(unused_mut)]
|
22 - | let mut tmp = {
|
23 - | #[allow(unused_mut)]
|
24 - | let mut output = crate::types::error::builders::AlreadyExistsExceptionBuilder::default();
|
25 - | output = crate::protocol_serde::shape_already_exists_exception::de_already_exists_exception_json_err(_response_body, output)
|
26 - | .map_err(crate::operation::replicate_key::ReplicateKeyError::unhandled)?;
|
27 - | let output = output.meta(generic);
|
28 - | output.build()
|
29 - | };
|
30 - | if tmp.message.is_none() {
|
31 - | tmp.message = _error_message;
|
32 - | }
|
33 - | tmp
|
34 - | }),
|
35 - | "DisabledException" => crate::operation::replicate_key::ReplicateKeyError::DisabledException({
|
36 - | #[allow(unused_mut)]
|
37 - | let mut tmp = {
|
38 - | #[allow(unused_mut)]
|
39 - | let mut output = crate::types::error::builders::DisabledExceptionBuilder::default();
|
40 - | output = crate::protocol_serde::shape_disabled_exception::de_disabled_exception_json_err(_response_body, output)
|
41 - | .map_err(crate::operation::replicate_key::ReplicateKeyError::unhandled)?;
|
42 - | let output = output.meta(generic);
|
43 - | output.build()
|
44 - | };
|
45 - | if tmp.message.is_none() {
|
46 - | tmp.message = _error_message;
|
47 - | }
|
48 - | tmp
|
49 - | }),
|
50 - | "InvalidArnException" => crate::operation::replicate_key::ReplicateKeyError::InvalidArnException({
|
51 - | #[allow(unused_mut)]
|
52 - | let mut tmp = {
|
53 - | #[allow(unused_mut)]
|
54 - | let mut output = crate::types::error::builders::InvalidArnExceptionBuilder::default();
|
55 - | output = crate::protocol_serde::shape_invalid_arn_exception::de_invalid_arn_exception_json_err(_response_body, output)
|
56 - | .map_err(crate::operation::replicate_key::ReplicateKeyError::unhandled)?;
|
57 - | let output = output.meta(generic);
|
58 - | output.build()
|
59 - | };
|
60 - | if tmp.message.is_none() {
|
61 - | tmp.message = _error_message;
|
62 - | }
|
63 - | tmp
|
64 - | }),
|
65 - | "KMSInternalException" => crate::operation::replicate_key::ReplicateKeyError::KmsInternalException({
|
66 - | #[allow(unused_mut)]
|
67 - | let mut tmp = {
|
68 - | #[allow(unused_mut)]
|
69 - | let mut output = crate::types::error::builders::KmsInternalExceptionBuilder::default();
|
70 - | output = crate::protocol_serde::shape_kms_internal_exception::de_kms_internal_exception_json_err(_response_body, output)
|
71 - | .map_err(crate::operation::replicate_key::ReplicateKeyError::unhandled)?;
|
72 - | let output = output.meta(generic);
|
73 - | output.build()
|
74 - | };
|
75 - | if tmp.message.is_none() {
|
76 - | tmp.message = _error_message;
|
77 - | }
|
78 - | tmp
|
79 - | }),
|
80 - | "KMSInvalidStateException" => crate::operation::replicate_key::ReplicateKeyError::KmsInvalidStateException({
|
81 - | #[allow(unused_mut)]
|
82 - | let mut tmp = {
|
83 - | #[allow(unused_mut)]
|
84 - | let mut output = crate::types::error::builders::KmsInvalidStateExceptionBuilder::default();
|
85 - | output = crate::protocol_serde::shape_kms_invalid_state_exception::de_kms_invalid_state_exception_json_err(_response_body, output)
|
86 - | .map_err(crate::operation::replicate_key::ReplicateKeyError::unhandled)?;
|
87 - | let output = output.meta(generic);
|
88 - | output.build()
|
89 - | };
|
90 - | if tmp.message.is_none() {
|
91 - | tmp.message = _error_message;
|
92 - | }
|
93 - | tmp
|
94 - | }),
|
95 - | "LimitExceededException" => crate::operation::replicate_key::ReplicateKeyError::LimitExceededException({
|
96 - | #[allow(unused_mut)]
|
97 - | let mut tmp = {
|
98 - | #[allow(unused_mut)]
|
99 - | let mut output = crate::types::error::builders::LimitExceededExceptionBuilder::default();
|
100 - | output = crate::protocol_serde::shape_limit_exceeded_exception::de_limit_exceeded_exception_json_err(_response_body, output)
|
101 - | .map_err(crate::operation::replicate_key::ReplicateKeyError::unhandled)?;
|
102 - | let output = output.meta(generic);
|
103 - | output.build()
|
104 - | };
|
105 - | if tmp.message.is_none() {
|
106 - | tmp.message = _error_message;
|
107 - | }
|
108 - | tmp
|
109 - | }),
|
110 - | "MalformedPolicyDocumentException" => crate::operation::replicate_key::ReplicateKeyError::MalformedPolicyDocumentException({
|
111 - | #[allow(unused_mut)]
|
112 - | let mut tmp = {
|
113 - | #[allow(unused_mut)]
|
114 - | let mut output = crate::types::error::builders::MalformedPolicyDocumentExceptionBuilder::default();
|
115 - | output = crate::protocol_serde::shape_malformed_policy_document_exception::de_malformed_policy_document_exception_json_err(
|
116 - | _response_body,
|
117 - | output,
|
118 - | )
|
119 - | .map_err(crate::operation::replicate_key::ReplicateKeyError::unhandled)?;
|
120 - | let output = output.meta(generic);
|
121 - | output.build()
|
122 - | };
|
123 - | if tmp.message.is_none() {
|
124 - | tmp.message = _error_message;
|
125 - | }
|
126 - | tmp
|
127 - | }),
|
128 - | "NotFoundException" => crate::operation::replicate_key::ReplicateKeyError::NotFoundException({
|
129 - | #[allow(unused_mut)]
|
130 - | let mut tmp = {
|
131 - | #[allow(unused_mut)]
|
132 - | let mut output = crate::types::error::builders::NotFoundExceptionBuilder::default();
|
133 - | output = crate::protocol_serde::shape_not_found_exception::de_not_found_exception_json_err(_response_body, output)
|
134 - | .map_err(crate::operation::replicate_key::ReplicateKeyError::unhandled)?;
|
135 - | let output = output.meta(generic);
|
136 - | output.build()
|
137 - | };
|
138 - | if tmp.message.is_none() {
|
139 - | tmp.message = _error_message;
|
140 - | }
|
141 - | tmp
|
142 - | }),
|
143 - | "TagException" => crate::operation::replicate_key::ReplicateKeyError::TagException({
|
144 - | #[allow(unused_mut)]
|
145 - | let mut tmp = {
|
146 - | #[allow(unused_mut)]
|
147 - | let mut output = crate::types::error::builders::TagExceptionBuilder::default();
|
148 - | output = crate::protocol_serde::shape_tag_exception::de_tag_exception_json_err(_response_body, output)
|
149 - | .map_err(crate::operation::replicate_key::ReplicateKeyError::unhandled)?;
|
150 - | let output = output.meta(generic);
|
151 - | output.build()
|
152 - | };
|
153 - | if tmp.message.is_none() {
|
154 - | tmp.message = _error_message;
|
155 - | }
|
156 - | tmp
|
157 - | }),
|
158 - | "UnsupportedOperationException" => crate::operation::replicate_key::ReplicateKeyError::UnsupportedOperationException({
|
159 - | #[allow(unused_mut)]
|
160 - | let mut tmp = {
|
161 - | #[allow(unused_mut)]
|
162 - | let mut output = crate::types::error::builders::UnsupportedOperationExceptionBuilder::default();
|
163 - | output =
|
164 - | crate::protocol_serde::shape_unsupported_operation_exception::de_unsupported_operation_exception_json_err(_response_body, output)
|
165 - | .map_err(crate::operation::replicate_key::ReplicateKeyError::unhandled)?;
|
166 - | let output = output.meta(generic);
|
167 - | output.build()
|
168 - | };
|
169 - | if tmp.message.is_none() {
|
170 - | tmp.message = _error_message;
|
171 - | }
|
172 - | tmp
|
173 - | }),
|
174 - | _ => crate::operation::replicate_key::ReplicateKeyError::generic(generic),
|
175 - | })
|
176 - | }
|
177 - |
|
178 - | #[allow(clippy::unnecessary_wraps)]
|
179 - | pub fn de_replicate_key_http_response(
|
180 - | _response_status: u16,
|
181 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
182 - | _response_body: &[u8],
|
183 - | ) -> std::result::Result<crate::operation::replicate_key::ReplicateKeyOutput, crate::operation::replicate_key::ReplicateKeyError> {
|
184 - | Ok({
|
185 - | #[allow(unused_mut)]
|
186 - | let mut output = crate::operation::replicate_key::builders::ReplicateKeyOutputBuilder::default();
|
187 - | output = crate::protocol_serde::shape_replicate_key::de_replicate_key(_response_body, output)
|
188 - | .map_err(crate::operation::replicate_key::ReplicateKeyError::unhandled)?;
|
189 - | output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
|
190 - | output.build()
|
191 - | })
|
192 - | }
|
193 - |
|
194 - | pub fn ser_replicate_key_input(
|
195 - | input: &crate::operation::replicate_key::ReplicateKeyInput,
|
196 - | ) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
|
197 - | let mut out = String::new();
|
198 - | let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
|
199 - | crate::protocol_serde::shape_replicate_key_input::ser_replicate_key_input_input(&mut object, input)?;
|
200 - | object.finish();
|
201 - | Ok(::aws_smithy_types::body::SdkBody::from(out))
|
202 - | }
|
203 - |
|
204 - | pub(crate) fn de_replicate_key(
|
205 - | _value: &[u8],
|
206 - | mut builder: crate::operation::replicate_key::builders::ReplicateKeyOutputBuilder,
|
207 - | ) -> ::std::result::Result<
|
208 - | crate::operation::replicate_key::builders::ReplicateKeyOutputBuilder,
|
209 - | ::aws_smithy_json::deserialize::error::DeserializeError,
|
210 - | > {
|
211 - | let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
|
212 - | let tokens = &mut tokens_owned;
|
213 - | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
214 - | loop {
|
215 - | match tokens.next().transpose()? {
|
216 - | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
217 - | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
|
218 - | "ReplicaKeyMetadata" => {
|
219 - | builder = builder.set_replica_key_metadata(crate::protocol_serde::shape_key_metadata::de_key_metadata(tokens, _value)?);
|
220 - | }
|
221 - | "ReplicaPolicy" => {
|
222 - | builder = builder.set_replica_policy(
|
223 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
224 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
225 - | .transpose()?,
|
226 - | );
|
227 - | }
|
228 - | "ReplicaTags" => {
|
229 - | builder = builder.set_replica_tags(crate::protocol_serde::shape_tag_list::de_tag_list(tokens, _value)?);
|
230 - | }
|
231 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
232 - | },
|
233 - | other => {
|
234 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
235 - | "expected object key or end object, found: {other:?}"
|
236 - | )))
|
237 - | }
|
238 - | }
|
239 - | }
|
240 - | if tokens.next().is_some() {
|
241 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
242 - | "found more JSON tokens after completing parsing",
|
243 - | ));
|
244 - | }
|
245 - | Ok(builder)
|
246 - | }
|