1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | #[allow(clippy::unnecessary_wraps)]
|
3 - | pub fn de_list_service_deployments_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::list_service_deployments::ListServiceDeploymentsOutput,
|
9 - | crate::operation::list_service_deployments::ListServiceDeploymentsError,
|
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::list_service_deployments::ListServiceDeploymentsError::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::list_service_deployments::ListServiceDeploymentsError::unhandled(
|
20 - | generic,
|
21 - | ))
|
22 - | }
|
23 - | };
|
24 - |
|
25 - | let _error_message = generic.message().map(|msg| msg.to_owned());
|
26 - | Err(match error_code {
|
27 - | "AccessDeniedException" => crate::operation::list_service_deployments::ListServiceDeploymentsError::AccessDeniedException({
|
28 - | #[allow(unused_mut)]
|
29 - | let mut tmp = {
|
30 - | #[allow(unused_mut)]
|
31 - | let mut output = crate::types::error::builders::AccessDeniedExceptionBuilder::default();
|
32 - | output = crate::protocol_serde::shape_access_denied_exception::de_access_denied_exception_json_err(_response_body, output)
|
33 - | .map_err(crate::operation::list_service_deployments::ListServiceDeploymentsError::unhandled)?;
|
34 - | let output = output.meta(generic);
|
35 - | output.build()
|
36 - | };
|
37 - | if tmp.message.is_none() {
|
38 - | tmp.message = _error_message;
|
39 - | }
|
40 - | tmp
|
41 - | }),
|
42 - | "ClientException" => crate::operation::list_service_deployments::ListServiceDeploymentsError::ClientException({
|
43 - | #[allow(unused_mut)]
|
44 - | let mut tmp = {
|
45 - | #[allow(unused_mut)]
|
46 - | let mut output = crate::types::error::builders::ClientExceptionBuilder::default();
|
47 - | output = crate::protocol_serde::shape_client_exception::de_client_exception_json_err(_response_body, output)
|
48 - | .map_err(crate::operation::list_service_deployments::ListServiceDeploymentsError::unhandled)?;
|
49 - | let output = output.meta(generic);
|
50 - | output.build()
|
51 - | };
|
52 - | if tmp.message.is_none() {
|
53 - | tmp.message = _error_message;
|
54 - | }
|
55 - | tmp
|
56 - | }),
|
57 - | "InvalidParameterException" => crate::operation::list_service_deployments::ListServiceDeploymentsError::InvalidParameterException({
|
58 - | #[allow(unused_mut)]
|
59 - | let mut tmp = {
|
60 - | #[allow(unused_mut)]
|
61 - | let mut output = crate::types::error::builders::InvalidParameterExceptionBuilder::default();
|
62 - | output = crate::protocol_serde::shape_invalid_parameter_exception::de_invalid_parameter_exception_json_err(_response_body, output)
|
63 - | .map_err(crate::operation::list_service_deployments::ListServiceDeploymentsError::unhandled)?;
|
64 - | let output = output.meta(generic);
|
65 - | output.build()
|
66 - | };
|
67 - | if tmp.message.is_none() {
|
68 - | tmp.message = _error_message;
|
69 - | }
|
70 - | tmp
|
71 - | }),
|
72 - | "ServerException" => crate::operation::list_service_deployments::ListServiceDeploymentsError::ServerException({
|
73 - | #[allow(unused_mut)]
|
74 - | let mut tmp = {
|
75 - | #[allow(unused_mut)]
|
76 - | let mut output = crate::types::error::builders::ServerExceptionBuilder::default();
|
77 - | output = crate::protocol_serde::shape_server_exception::de_server_exception_json_err(_response_body, output)
|
78 - | .map_err(crate::operation::list_service_deployments::ListServiceDeploymentsError::unhandled)?;
|
79 - | let output = output.meta(generic);
|
80 - | output.build()
|
81 - | };
|
82 - | if tmp.message.is_none() {
|
83 - | tmp.message = _error_message;
|
84 - | }
|
85 - | tmp
|
86 - | }),
|
87 - | "ServiceNotFoundException" => crate::operation::list_service_deployments::ListServiceDeploymentsError::ServiceNotFoundException({
|
88 - | #[allow(unused_mut)]
|
89 - | let mut tmp = {
|
90 - | #[allow(unused_mut)]
|
91 - | let mut output = crate::types::error::builders::ServiceNotFoundExceptionBuilder::default();
|
92 - | output = crate::protocol_serde::shape_service_not_found_exception::de_service_not_found_exception_json_err(_response_body, output)
|
93 - | .map_err(crate::operation::list_service_deployments::ListServiceDeploymentsError::unhandled)?;
|
94 - | let output = output.meta(generic);
|
95 - | output.build()
|
96 - | };
|
97 - | if tmp.message.is_none() {
|
98 - | tmp.message = _error_message;
|
99 - | }
|
100 - | tmp
|
101 - | }),
|
102 - | "UnsupportedFeatureException" => crate::operation::list_service_deployments::ListServiceDeploymentsError::UnsupportedFeatureException({
|
103 - | #[allow(unused_mut)]
|
104 - | let mut tmp = {
|
105 - | #[allow(unused_mut)]
|
106 - | let mut output = crate::types::error::builders::UnsupportedFeatureExceptionBuilder::default();
|
107 - | output =
|
108 - | crate::protocol_serde::shape_unsupported_feature_exception::de_unsupported_feature_exception_json_err(_response_body, output)
|
109 - | .map_err(crate::operation::list_service_deployments::ListServiceDeploymentsError::unhandled)?;
|
110 - | let output = output.meta(generic);
|
111 - | output.build()
|
112 - | };
|
113 - | if tmp.message.is_none() {
|
114 - | tmp.message = _error_message;
|
115 - | }
|
116 - | tmp
|
117 - | }),
|
118 - | _ => crate::operation::list_service_deployments::ListServiceDeploymentsError::generic(generic),
|
119 - | })
|
120 - | }
|
121 - |
|
122 - | #[allow(clippy::unnecessary_wraps)]
|
123 - | pub fn de_list_service_deployments_http_response(
|
124 - | _response_status: u16,
|
125 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
126 - | _response_body: &[u8],
|
127 - | ) -> std::result::Result<
|
128 - | crate::operation::list_service_deployments::ListServiceDeploymentsOutput,
|
129 - | crate::operation::list_service_deployments::ListServiceDeploymentsError,
|
130 - | > {
|
131 - | Ok({
|
132 - | #[allow(unused_mut)]
|
133 - | let mut output = crate::operation::list_service_deployments::builders::ListServiceDeploymentsOutputBuilder::default();
|
134 - | output = crate::protocol_serde::shape_list_service_deployments::de_list_service_deployments(_response_body, output)
|
135 - | .map_err(crate::operation::list_service_deployments::ListServiceDeploymentsError::unhandled)?;
|
136 - | output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
|
137 - | output.build()
|
138 - | })
|
139 - | }
|
140 - |
|
141 - | pub fn ser_list_service_deployments_input(
|
142 - | input: &crate::operation::list_service_deployments::ListServiceDeploymentsInput,
|
143 - | ) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
|
144 - | let mut out = String::new();
|
145 - | let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
|
146 - | crate::protocol_serde::shape_list_service_deployments_input::ser_list_service_deployments_input_input(&mut object, input)?;
|
147 - | object.finish();
|
148 - | Ok(::aws_smithy_types::body::SdkBody::from(out))
|
149 - | }
|
150 - |
|
151 - | pub(crate) fn de_list_service_deployments(
|
152 - | _value: &[u8],
|
153 - | mut builder: crate::operation::list_service_deployments::builders::ListServiceDeploymentsOutputBuilder,
|
154 - | ) -> ::std::result::Result<
|
155 - | crate::operation::list_service_deployments::builders::ListServiceDeploymentsOutputBuilder,
|
156 - | ::aws_smithy_json::deserialize::error::DeserializeError,
|
157 - | > {
|
158 - | let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
|
159 - | let tokens = &mut tokens_owned;
|
160 - | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
161 - | loop {
|
162 - | match tokens.next().transpose()? {
|
163 - | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
164 - | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
|
165 - | "serviceDeployments" => {
|
166 - | builder = builder.set_service_deployments(crate::protocol_serde::shape_service_deployments_brief::de_service_deployments_brief(
|
167 - | tokens, _value,
|
168 - | )?);
|
169 - | }
|
170 - | "nextToken" => {
|
171 - | builder = builder.set_next_token(
|
172 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
173 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
174 - | .transpose()?,
|
175 - | );
|
176 - | }
|
177 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
178 - | },
|
179 - | other => {
|
180 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
181 - | "expected object key or end object, found: {other:?}"
|
182 - | )))
|
183 - | }
|
184 - | }
|
185 - | }
|
186 - | if tokens.next().is_some() {
|
187 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
188 - | "found more JSON tokens after completing parsing",
|
189 - | ));
|
190 - | }
|
191 - | Ok(builder)
|
192 - | }
|