aws_sdk_redshiftserverless/protocol_serde/
shape_update_snapshot_copy_configuration.rs1#[allow(clippy::unnecessary_wraps)]
3pub fn de_update_snapshot_copy_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::update_snapshot_copy_configuration::UpdateSnapshotCopyConfigurationOutput,
9 crate::operation::update_snapshot_copy_configuration::UpdateSnapshotCopyConfigurationError,
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_snapshot_copy_configuration::UpdateSnapshotCopyConfigurationError::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 => return Err(crate::operation::update_snapshot_copy_configuration::UpdateSnapshotCopyConfigurationError::unhandled(generic)),
19 };
20
21 let _error_message = generic.message().map(|msg| msg.to_owned());
22 Err(match error_code {
23 "AccessDeniedException" => {
24 crate::operation::update_snapshot_copy_configuration::UpdateSnapshotCopyConfigurationError::AccessDeniedException({
25 #[allow(unused_mut)]
26 let mut tmp = {
27 #[allow(unused_mut)]
28 let mut output = crate::types::error::builders::AccessDeniedExceptionBuilder::default();
29 output = crate::protocol_serde::shape_access_denied_exception::de_access_denied_exception_json_err(_response_body, output)
30 .map_err(crate::operation::update_snapshot_copy_configuration::UpdateSnapshotCopyConfigurationError::unhandled)?;
31 let output = output.meta(generic);
32 output.build()
33 };
34 if tmp.message.is_none() {
35 tmp.message = _error_message;
36 }
37 tmp
38 })
39 }
40 "ConflictException" => crate::operation::update_snapshot_copy_configuration::UpdateSnapshotCopyConfigurationError::ConflictException({
41 #[allow(unused_mut)]
42 let mut tmp = {
43 #[allow(unused_mut)]
44 let mut output = crate::types::error::builders::ConflictExceptionBuilder::default();
45 output = crate::protocol_serde::shape_conflict_exception::de_conflict_exception_json_err(_response_body, output)
46 .map_err(crate::operation::update_snapshot_copy_configuration::UpdateSnapshotCopyConfigurationError::unhandled)?;
47 let output = output.meta(generic);
48 crate::serde_util::conflict_exception_correct_errors(output)
49 .build()
50 .map_err(crate::operation::update_snapshot_copy_configuration::UpdateSnapshotCopyConfigurationError::unhandled)?
51 };
52 tmp
53 }),
54 "InternalServerException" => {
55 crate::operation::update_snapshot_copy_configuration::UpdateSnapshotCopyConfigurationError::InternalServerException({
56 #[allow(unused_mut)]
57 let mut tmp = {
58 #[allow(unused_mut)]
59 let mut output = crate::types::error::builders::InternalServerExceptionBuilder::default();
60 output = crate::protocol_serde::shape_internal_server_exception::de_internal_server_exception_json_err(_response_body, output)
61 .map_err(crate::operation::update_snapshot_copy_configuration::UpdateSnapshotCopyConfigurationError::unhandled)?;
62 let output = output.meta(generic);
63 crate::serde_util::internal_server_exception_correct_errors(output)
64 .build()
65 .map_err(crate::operation::update_snapshot_copy_configuration::UpdateSnapshotCopyConfigurationError::unhandled)?
66 };
67 tmp
68 })
69 }
70 "ResourceNotFoundException" => {
71 crate::operation::update_snapshot_copy_configuration::UpdateSnapshotCopyConfigurationError::ResourceNotFoundException({
72 #[allow(unused_mut)]
73 let mut tmp = {
74 #[allow(unused_mut)]
75 let mut output = crate::types::error::builders::ResourceNotFoundExceptionBuilder::default();
76 output =
77 crate::protocol_serde::shape_resource_not_found_exception::de_resource_not_found_exception_json_err(_response_body, output)
78 .map_err(crate::operation::update_snapshot_copy_configuration::UpdateSnapshotCopyConfigurationError::unhandled)?;
79 let output = output.meta(generic);
80 crate::serde_util::resource_not_found_exception_correct_errors(output)
81 .build()
82 .map_err(crate::operation::update_snapshot_copy_configuration::UpdateSnapshotCopyConfigurationError::unhandled)?
83 };
84 tmp
85 })
86 }
87 "ValidationException" => crate::operation::update_snapshot_copy_configuration::UpdateSnapshotCopyConfigurationError::ValidationException({
88 #[allow(unused_mut)]
89 let mut tmp = {
90 #[allow(unused_mut)]
91 let mut output = crate::types::error::builders::ValidationExceptionBuilder::default();
92 output = crate::protocol_serde::shape_validation_exception::de_validation_exception_json_err(_response_body, output)
93 .map_err(crate::operation::update_snapshot_copy_configuration::UpdateSnapshotCopyConfigurationError::unhandled)?;
94 let output = output.meta(generic);
95 crate::serde_util::validation_exception_correct_errors(output)
96 .build()
97 .map_err(crate::operation::update_snapshot_copy_configuration::UpdateSnapshotCopyConfigurationError::unhandled)?
98 };
99 tmp
100 }),
101 _ => crate::operation::update_snapshot_copy_configuration::UpdateSnapshotCopyConfigurationError::generic(generic),
102 })
103}
104
105#[allow(clippy::unnecessary_wraps)]
106pub fn de_update_snapshot_copy_configuration_http_response(
107 _response_status: u16,
108 _response_headers: &::aws_smithy_runtime_api::http::Headers,
109 _response_body: &[u8],
110) -> std::result::Result<
111 crate::operation::update_snapshot_copy_configuration::UpdateSnapshotCopyConfigurationOutput,
112 crate::operation::update_snapshot_copy_configuration::UpdateSnapshotCopyConfigurationError,
113> {
114 Ok({
115 #[allow(unused_mut)]
116 let mut output = crate::operation::update_snapshot_copy_configuration::builders::UpdateSnapshotCopyConfigurationOutputBuilder::default();
117 output = crate::protocol_serde::shape_update_snapshot_copy_configuration::de_update_snapshot_copy_configuration(_response_body, output)
118 .map_err(crate::operation::update_snapshot_copy_configuration::UpdateSnapshotCopyConfigurationError::unhandled)?;
119 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
120 crate::serde_util::update_snapshot_copy_configuration_output_output_correct_errors(output).build()
121 })
122}
123
124pub fn ser_update_snapshot_copy_configuration_input(
125 input: &crate::operation::update_snapshot_copy_configuration::UpdateSnapshotCopyConfigurationInput,
126) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
127 let mut out = String::new();
128 let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
129 crate::protocol_serde::shape_update_snapshot_copy_configuration_input::ser_update_snapshot_copy_configuration_input_input(&mut object, input)?;
130 object.finish();
131 Ok(::aws_smithy_types::body::SdkBody::from(out))
132}
133
134pub(crate) fn de_update_snapshot_copy_configuration(
135 value: &[u8],
136 mut builder: crate::operation::update_snapshot_copy_configuration::builders::UpdateSnapshotCopyConfigurationOutputBuilder,
137) -> ::std::result::Result<
138 crate::operation::update_snapshot_copy_configuration::builders::UpdateSnapshotCopyConfigurationOutputBuilder,
139 ::aws_smithy_json::deserialize::error::DeserializeError,
140> {
141 let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable();
142 let tokens = &mut tokens_owned;
143 ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
144 loop {
145 match tokens.next().transpose()? {
146 Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
147 Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
148 "snapshotCopyConfiguration" => {
149 builder = builder.set_snapshot_copy_configuration(
150 crate::protocol_serde::shape_snapshot_copy_configuration::de_snapshot_copy_configuration(tokens)?,
151 );
152 }
153 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
154 },
155 other => {
156 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
157 "expected object key or end object, found: {other:?}"
158 )))
159 }
160 }
161 }
162 if tokens.next().is_some() {
163 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
164 "found more JSON tokens after completing parsing",
165 ));
166 }
167 Ok(builder)
168}