aws_sdk_finspace/protocol_serde/
shape_create_kx_changeset.rs1#[allow(clippy::unnecessary_wraps)]
3pub fn de_create_kx_changeset_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::create_kx_changeset::CreateKxChangesetOutput, crate::operation::create_kx_changeset::CreateKxChangesetError>
8{
9 #[allow(unused_mut)]
10 let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
11 .map_err(crate::operation::create_kx_changeset::CreateKxChangesetError::unhandled)?;
12 generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
13 let generic = generic_builder.build();
14 let error_code = match generic.code() {
15 Some(code) => code,
16 None => return Err(crate::operation::create_kx_changeset::CreateKxChangesetError::unhandled(generic)),
17 };
18
19 let _error_message = generic.message().map(|msg| msg.to_owned());
20 Err(match error_code {
21 "AccessDeniedException" => crate::operation::create_kx_changeset::CreateKxChangesetError::AccessDeniedException({
22 #[allow(unused_mut)]
23 let mut tmp = {
24 #[allow(unused_mut)]
25 let mut output = crate::types::error::builders::AccessDeniedExceptionBuilder::default();
26 output = crate::protocol_serde::shape_access_denied_exception::de_access_denied_exception_json_err(_response_body, output)
27 .map_err(crate::operation::create_kx_changeset::CreateKxChangesetError::unhandled)?;
28 let output = output.meta(generic);
29 output.build()
30 };
31 if tmp.message.is_none() {
32 tmp.message = _error_message;
33 }
34 tmp
35 }),
36 "ConflictException" => crate::operation::create_kx_changeset::CreateKxChangesetError::ConflictException({
37 #[allow(unused_mut)]
38 let mut tmp = {
39 #[allow(unused_mut)]
40 let mut output = crate::types::error::builders::ConflictExceptionBuilder::default();
41 output = crate::protocol_serde::shape_conflict_exception::de_conflict_exception_json_err(_response_body, output)
42 .map_err(crate::operation::create_kx_changeset::CreateKxChangesetError::unhandled)?;
43 let output = output.meta(generic);
44 output.build()
45 };
46 if tmp.message.is_none() {
47 tmp.message = _error_message;
48 }
49 tmp
50 }),
51 "InternalServerException" => crate::operation::create_kx_changeset::CreateKxChangesetError::InternalServerException({
52 #[allow(unused_mut)]
53 let mut tmp = {
54 #[allow(unused_mut)]
55 let mut output = crate::types::error::builders::InternalServerExceptionBuilder::default();
56 output = crate::protocol_serde::shape_internal_server_exception::de_internal_server_exception_json_err(_response_body, output)
57 .map_err(crate::operation::create_kx_changeset::CreateKxChangesetError::unhandled)?;
58 let output = output.meta(generic);
59 output.build()
60 };
61 if tmp.message.is_none() {
62 tmp.message = _error_message;
63 }
64 tmp
65 }),
66 "LimitExceededException" => crate::operation::create_kx_changeset::CreateKxChangesetError::LimitExceededException({
67 #[allow(unused_mut)]
68 let mut tmp = {
69 #[allow(unused_mut)]
70 let mut output = crate::types::error::builders::LimitExceededExceptionBuilder::default();
71 output = crate::protocol_serde::shape_limit_exceeded_exception::de_limit_exceeded_exception_json_err(_response_body, output)
72 .map_err(crate::operation::create_kx_changeset::CreateKxChangesetError::unhandled)?;
73 let output = output.meta(generic);
74 output.build()
75 };
76 if tmp.message.is_none() {
77 tmp.message = _error_message;
78 }
79 tmp
80 }),
81 "ResourceNotFoundException" => crate::operation::create_kx_changeset::CreateKxChangesetError::ResourceNotFoundException({
82 #[allow(unused_mut)]
83 let mut tmp = {
84 #[allow(unused_mut)]
85 let mut output = crate::types::error::builders::ResourceNotFoundExceptionBuilder::default();
86 output = crate::protocol_serde::shape_resource_not_found_exception::de_resource_not_found_exception_json_err(_response_body, output)
87 .map_err(crate::operation::create_kx_changeset::CreateKxChangesetError::unhandled)?;
88 let output = output.meta(generic);
89 output.build()
90 };
91 if tmp.message.is_none() {
92 tmp.message = _error_message;
93 }
94 tmp
95 }),
96 "ThrottlingException" => crate::operation::create_kx_changeset::CreateKxChangesetError::ThrottlingException({
97 #[allow(unused_mut)]
98 let mut tmp = {
99 #[allow(unused_mut)]
100 let mut output = crate::types::error::builders::ThrottlingExceptionBuilder::default();
101 output = crate::protocol_serde::shape_throttling_exception::de_throttling_exception_json_err(_response_body, output)
102 .map_err(crate::operation::create_kx_changeset::CreateKxChangesetError::unhandled)?;
103 let output = output.meta(generic);
104 output.build()
105 };
106 if tmp.message.is_none() {
107 tmp.message = _error_message;
108 }
109 tmp
110 }),
111 "ValidationException" => crate::operation::create_kx_changeset::CreateKxChangesetError::ValidationException({
112 #[allow(unused_mut)]
113 let mut tmp = {
114 #[allow(unused_mut)]
115 let mut output = crate::types::error::builders::ValidationExceptionBuilder::default();
116 output = crate::protocol_serde::shape_validation_exception::de_validation_exception_json_err(_response_body, output)
117 .map_err(crate::operation::create_kx_changeset::CreateKxChangesetError::unhandled)?;
118 let output = output.meta(generic);
119 output.build()
120 };
121 if tmp.message.is_none() {
122 tmp.message = _error_message;
123 }
124 tmp
125 }),
126 _ => crate::operation::create_kx_changeset::CreateKxChangesetError::generic(generic),
127 })
128}
129
130#[allow(clippy::unnecessary_wraps)]
131pub fn de_create_kx_changeset_http_response(
132 _response_status: u16,
133 _response_headers: &::aws_smithy_runtime_api::http::Headers,
134 _response_body: &[u8],
135) -> std::result::Result<crate::operation::create_kx_changeset::CreateKxChangesetOutput, crate::operation::create_kx_changeset::CreateKxChangesetError>
136{
137 Ok({
138 #[allow(unused_mut)]
139 let mut output = crate::operation::create_kx_changeset::builders::CreateKxChangesetOutputBuilder::default();
140 output = crate::protocol_serde::shape_create_kx_changeset::de_create_kx_changeset(_response_body, output)
141 .map_err(crate::operation::create_kx_changeset::CreateKxChangesetError::unhandled)?;
142 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
143 output.build()
144 })
145}
146
147pub fn ser_create_kx_changeset_input(
148 input: &crate::operation::create_kx_changeset::CreateKxChangesetInput,
149) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
150 let mut out = String::new();
151 let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
152 crate::protocol_serde::shape_create_kx_changeset_input::ser_create_kx_changeset_input_input(&mut object, input)?;
153 object.finish();
154 Ok(::aws_smithy_types::body::SdkBody::from(out))
155}
156
157pub(crate) fn de_create_kx_changeset(
158 value: &[u8],
159 mut builder: crate::operation::create_kx_changeset::builders::CreateKxChangesetOutputBuilder,
160) -> ::std::result::Result<
161 crate::operation::create_kx_changeset::builders::CreateKxChangesetOutputBuilder,
162 ::aws_smithy_json::deserialize::error::DeserializeError,
163> {
164 let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable();
165 let tokens = &mut tokens_owned;
166 ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
167 loop {
168 match tokens.next().transpose()? {
169 Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
170 Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
171 "changeRequests" => {
172 builder = builder.set_change_requests(crate::protocol_serde::shape_change_requests::de_change_requests(tokens)?);
173 }
174 "changesetId" => {
175 builder = builder.set_changeset_id(
176 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
177 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
178 .transpose()?,
179 );
180 }
181 "createdTimestamp" => {
182 builder = builder.set_created_timestamp(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
183 tokens.next(),
184 ::aws_smithy_types::date_time::Format::EpochSeconds,
185 )?);
186 }
187 "databaseName" => {
188 builder = builder.set_database_name(
189 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
190 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
191 .transpose()?,
192 );
193 }
194 "environmentId" => {
195 builder = builder.set_environment_id(
196 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
197 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
198 .transpose()?,
199 );
200 }
201 "errorInfo" => {
202 builder = builder.set_error_info(crate::protocol_serde::shape_error_info::de_error_info(tokens)?);
203 }
204 "lastModifiedTimestamp" => {
205 builder = builder.set_last_modified_timestamp(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
206 tokens.next(),
207 ::aws_smithy_types::date_time::Format::EpochSeconds,
208 )?);
209 }
210 "status" => {
211 builder = builder.set_status(
212 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
213 .map(|s| s.to_unescaped().map(|u| crate::types::ChangesetStatus::from(u.as_ref())))
214 .transpose()?,
215 );
216 }
217 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
218 },
219 other => {
220 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
221 "expected object key or end object, found: {other:?}"
222 )))
223 }
224 }
225 }
226 if tokens.next().is_some() {
227 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
228 "found more JSON tokens after completing parsing",
229 ));
230 }
231 Ok(builder)
232}