1 1 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 2 | #[allow(clippy::unnecessary_wraps)]
|
3 3 | pub fn de_start_snapshot_http_error(
|
4 4 | _response_status: u16,
|
5 5 | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
6 6 | _response_body: &[u8],
|
7 7 | ) -> std::result::Result<crate::operation::start_snapshot::StartSnapshotOutput, crate::operation::start_snapshot::StartSnapshotError> {
|
8 8 | #[allow(unused_mut)]
|
9 9 | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
|
10 10 | .map_err(crate::operation::start_snapshot::StartSnapshotError::unhandled)?;
|
11 11 | let generic = generic_builder.build();
|
12 12 | let error_code = match generic.code() {
|
13 13 | Some(code) => code,
|
14 14 | None => return Err(crate::operation::start_snapshot::StartSnapshotError::unhandled(generic)),
|
15 15 | };
|
16 16 |
|
17 17 | let _error_message = generic.message().map(|msg| msg.to_owned());
|
18 18 | Err(match error_code {
|
19 19 | "AccessDeniedException" => crate::operation::start_snapshot::StartSnapshotError::AccessDeniedError({
|
20 20 | #[allow(unused_mut)]
|
21 21 | let mut tmp = {
|
22 22 | #[allow(unused_mut)]
|
23 23 | let mut output = crate::types::error::builders::AccessDeniedErrorBuilder::default();
|
24 24 | output = crate::protocol_serde::shape_access_denied_exception::de_access_denied_exception_json_err(_response_body, output)
|
25 25 | .map_err(crate::operation::start_snapshot::StartSnapshotError::unhandled)?;
|
26 26 | let output = output.meta(generic);
|
27 27 | crate::serde_util::access_denied_exception_correct_errors(output)
|
28 28 | .build()
|
29 29 | .map_err(crate::operation::start_snapshot::StartSnapshotError::unhandled)?
|
30 30 | };
|
31 - | if tmp.message.is_none() {
|
32 - | tmp.message = _error_message;
|
33 - | }
|
34 31 | tmp
|
35 32 | }),
|
36 33 | "ConcurrentLimitExceededException" => crate::operation::start_snapshot::StartSnapshotError::ConcurrentLimitExceededError({
|
37 34 | #[allow(unused_mut)]
|
38 35 | let mut tmp = {
|
39 36 | #[allow(unused_mut)]
|
40 37 | let mut output = crate::types::error::builders::ConcurrentLimitExceededErrorBuilder::default();
|
41 38 | output = crate::protocol_serde::shape_concurrent_limit_exceeded_exception::de_concurrent_limit_exceeded_exception_json_err(
|
42 39 | _response_body,
|
43 40 | output,
|
44 41 | )
|
45 42 | .map_err(crate::operation::start_snapshot::StartSnapshotError::unhandled)?;
|
46 43 | let output = output.meta(generic);
|
47 44 | output.build()
|
48 45 | };
|
49 - | if tmp.message.is_none() {
|
50 - | tmp.message = _error_message;
|
51 - | }
|
52 46 | tmp
|
53 47 | }),
|
54 48 | "ConflictException" => crate::operation::start_snapshot::StartSnapshotError::ConflictError({
|
55 49 | #[allow(unused_mut)]
|
56 50 | let mut tmp = {
|
57 51 | #[allow(unused_mut)]
|
58 52 | let mut output = crate::types::error::builders::ConflictErrorBuilder::default();
|
59 53 | output = crate::protocol_serde::shape_conflict_exception::de_conflict_exception_json_err(_response_body, output)
|
60 54 | .map_err(crate::operation::start_snapshot::StartSnapshotError::unhandled)?;
|
61 55 | let output = output.meta(generic);
|
62 56 | output.build()
|
63 57 | };
|
64 - | if tmp.message.is_none() {
|
65 - | tmp.message = _error_message;
|
66 - | }
|
67 58 | tmp
|
68 59 | }),
|
69 60 | "InternalServerException" => crate::operation::start_snapshot::StartSnapshotError::InternalServerError({
|
70 61 | #[allow(unused_mut)]
|
71 62 | let mut tmp = {
|
72 63 | #[allow(unused_mut)]
|
73 64 | let mut output = crate::types::error::builders::InternalServerErrorBuilder::default();
|
74 65 | output = crate::protocol_serde::shape_internal_server_exception::de_internal_server_exception_json_err(_response_body, output)
|
75 66 | .map_err(crate::operation::start_snapshot::StartSnapshotError::unhandled)?;
|
76 67 | let output = output.meta(generic);
|
77 68 | output.build()
|
78 69 | };
|
79 - | if tmp.message.is_none() {
|
80 - | tmp.message = _error_message;
|
81 - | }
|
82 70 | tmp
|
83 71 | }),
|
84 72 | "RequestThrottledException" => crate::operation::start_snapshot::StartSnapshotError::RequestThrottledError({
|
85 73 | #[allow(unused_mut)]
|
86 74 | let mut tmp = {
|
87 75 | #[allow(unused_mut)]
|
88 76 | let mut output = crate::types::error::builders::RequestThrottledErrorBuilder::default();
|
89 77 | output = crate::protocol_serde::shape_request_throttled_exception::de_request_throttled_exception_json_err(_response_body, output)
|
90 78 | .map_err(crate::operation::start_snapshot::StartSnapshotError::unhandled)?;
|
91 79 | let output = output.meta(generic);
|
92 80 | output.build()
|
93 81 | };
|
94 - | if tmp.message.is_none() {
|
95 - | tmp.message = _error_message;
|
96 - | }
|
97 82 | tmp
|
98 83 | }),
|
99 84 | "ResourceNotFoundException" => crate::operation::start_snapshot::StartSnapshotError::ResourceNotFoundError({
|
100 85 | #[allow(unused_mut)]
|
101 86 | let mut tmp = {
|
102 87 | #[allow(unused_mut)]
|
103 88 | let mut output = crate::types::error::builders::ResourceNotFoundErrorBuilder::default();
|
104 89 | output = crate::protocol_serde::shape_resource_not_found_exception::de_resource_not_found_exception_json_err(_response_body, output)
|
105 90 | .map_err(crate::operation::start_snapshot::StartSnapshotError::unhandled)?;
|
106 91 | let output = output.meta(generic);
|
107 92 | output.build()
|
108 93 | };
|
109 - | if tmp.message.is_none() {
|
110 - | tmp.message = _error_message;
|
111 - | }
|
112 94 | tmp
|
113 95 | }),
|
114 96 | "ServiceQuotaExceededException" => crate::operation::start_snapshot::StartSnapshotError::ServiceQuotaExceededError({
|
115 97 | #[allow(unused_mut)]
|
116 98 | let mut tmp = {
|
117 99 | #[allow(unused_mut)]
|
118 100 | let mut output = crate::types::error::builders::ServiceQuotaExceededErrorBuilder::default();
|
119 101 | output = crate::protocol_serde::shape_service_quota_exceeded_exception::de_service_quota_exceeded_exception_json_err(
|
120 102 | _response_body,
|
121 103 | output,
|
122 104 | )
|
123 105 | .map_err(crate::operation::start_snapshot::StartSnapshotError::unhandled)?;
|
124 106 | let output = output.meta(generic);
|
125 107 | output.build()
|
126 108 | };
|
127 - | if tmp.message.is_none() {
|
128 - | tmp.message = _error_message;
|
129 - | }
|
130 109 | tmp
|
131 110 | }),
|
132 111 | "ValidationException" => crate::operation::start_snapshot::StartSnapshotError::ValidationError({
|
133 112 | #[allow(unused_mut)]
|
134 113 | let mut tmp = {
|
135 114 | #[allow(unused_mut)]
|
136 115 | let mut output = crate::types::error::builders::ValidationErrorBuilder::default();
|
137 116 | output = crate::protocol_serde::shape_validation_exception::de_validation_exception_json_err(_response_body, output)
|
138 117 | .map_err(crate::operation::start_snapshot::StartSnapshotError::unhandled)?;
|
139 118 | let output = output.meta(generic);
|
140 119 | output.build()
|
141 120 | };
|
142 - | if tmp.message.is_none() {
|
143 - | tmp.message = _error_message;
|
144 - | }
|
145 121 | tmp
|
146 122 | }),
|
147 123 | _ => crate::operation::start_snapshot::StartSnapshotError::generic(generic),
|
148 124 | })
|
149 125 | }
|
150 126 |
|
151 127 | #[allow(clippy::unnecessary_wraps)]
|
152 128 | pub fn de_start_snapshot_http_response(
|
153 129 | _response_status: u16,
|
154 130 | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
155 131 | _response_body: &[u8],
|
156 132 | ) -> std::result::Result<crate::operation::start_snapshot::StartSnapshotOutput, crate::operation::start_snapshot::StartSnapshotError> {
|
157 133 | Ok({
|
158 134 | #[allow(unused_mut)]
|
159 135 | let mut output = crate::operation::start_snapshot::builders::StartSnapshotOutputBuilder::default();
|
160 136 | output = crate::protocol_serde::shape_start_snapshot::de_start_snapshot(_response_body, output)
|
161 137 | .map_err(crate::operation::start_snapshot::StartSnapshotError::unhandled)?;
|
162 138 | output.build()
|
163 139 | })
|
164 140 | }
|
165 141 |
|
166 142 | pub fn ser_start_snapshot_input(
|
167 143 | input: &crate::operation::start_snapshot::StartSnapshotInput,
|
168 144 | ) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
|
169 145 | let mut out = String::new();
|
170 146 | let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
|
171 147 | crate::protocol_serde::shape_start_snapshot_input::ser_start_snapshot_input_input(&mut object, input)?;
|
172 148 | object.finish();
|
173 149 | Ok(::aws_smithy_types::body::SdkBody::from(out))
|
174 150 | }
|