1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | #[allow(clippy::unnecessary_wraps)]
|
3 - | pub fn de_register_client_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::register_client::RegisterClientOutput, crate::operation::register_client::RegisterClientError> {
|
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::register_client::RegisterClientError::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::register_client::RegisterClientError::unhandled(generic)),
|
16 - | };
|
17 - |
|
18 - | let _error_message = generic.message().map(|msg| msg.to_owned());
|
19 - | Err(match error_code {
|
20 - | "InternalServerException" => crate::operation::register_client::RegisterClientError::InternalServerException({
|
21 - | #[allow(unused_mut)]
|
22 - | let mut tmp = {
|
23 - | #[allow(unused_mut)]
|
24 - | let mut output = crate::types::error::builders::InternalServerExceptionBuilder::default();
|
25 - | output = crate::protocol_serde::shape_internal_server_exception::de_internal_server_exception_json_err(_response_body, output)
|
26 - | .map_err(crate::operation::register_client::RegisterClientError::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 - | "InvalidClientMetadataException" => crate::operation::register_client::RegisterClientError::InvalidClientMetadataException({
|
36 - | #[allow(unused_mut)]
|
37 - | let mut tmp = {
|
38 - | #[allow(unused_mut)]
|
39 - | let mut output = crate::types::error::builders::InvalidClientMetadataExceptionBuilder::default();
|
40 - | output = crate::protocol_serde::shape_invalid_client_metadata_exception::de_invalid_client_metadata_exception_json_err(
|
41 - | _response_body,
|
42 - | output,
|
43 - | )
|
44 - | .map_err(crate::operation::register_client::RegisterClientError::unhandled)?;
|
45 - | let output = output.meta(generic);
|
46 - | output.build()
|
47 - | };
|
48 - | if tmp.message.is_none() {
|
49 - | tmp.message = _error_message;
|
50 - | }
|
51 - | tmp
|
52 - | }),
|
53 - | "InvalidRedirectUriException" => crate::operation::register_client::RegisterClientError::InvalidRedirectUriException({
|
54 - | #[allow(unused_mut)]
|
55 - | let mut tmp = {
|
56 - | #[allow(unused_mut)]
|
57 - | let mut output = crate::types::error::builders::InvalidRedirectUriExceptionBuilder::default();
|
58 - | output =
|
59 - | crate::protocol_serde::shape_invalid_redirect_uri_exception::de_invalid_redirect_uri_exception_json_err(_response_body, output)
|
60 - | .map_err(crate::operation::register_client::RegisterClientError::unhandled)?;
|
61 - | let output = output.meta(generic);
|
62 - | output.build()
|
63 - | };
|
64 - | if tmp.message.is_none() {
|
65 - | tmp.message = _error_message;
|
66 - | }
|
67 - | tmp
|
68 - | }),
|
69 - | "InvalidRequestException" => crate::operation::register_client::RegisterClientError::InvalidRequestException({
|
70 - | #[allow(unused_mut)]
|
71 - | let mut tmp = {
|
72 - | #[allow(unused_mut)]
|
73 - | let mut output = crate::types::error::builders::InvalidRequestExceptionBuilder::default();
|
74 - | output = crate::protocol_serde::shape_invalid_request_exception::de_invalid_request_exception_json_err(_response_body, output)
|
75 - | .map_err(crate::operation::register_client::RegisterClientError::unhandled)?;
|
76 - | let output = output.meta(generic);
|
77 - | output.build()
|
78 - | };
|
79 - | if tmp.message.is_none() {
|
80 - | tmp.message = _error_message;
|
81 - | }
|
82 - | tmp
|
83 - | }),
|
84 - | "InvalidScopeException" => crate::operation::register_client::RegisterClientError::InvalidScopeException({
|
85 - | #[allow(unused_mut)]
|
86 - | let mut tmp = {
|
87 - | #[allow(unused_mut)]
|
88 - | let mut output = crate::types::error::builders::InvalidScopeExceptionBuilder::default();
|
89 - | output = crate::protocol_serde::shape_invalid_scope_exception::de_invalid_scope_exception_json_err(_response_body, output)
|
90 - | .map_err(crate::operation::register_client::RegisterClientError::unhandled)?;
|
91 - | let output = output.meta(generic);
|
92 - | output.build()
|
93 - | };
|
94 - | if tmp.message.is_none() {
|
95 - | tmp.message = _error_message;
|
96 - | }
|
97 - | tmp
|
98 - | }),
|
99 - | "SlowDownException" => crate::operation::register_client::RegisterClientError::SlowDownException({
|
100 - | #[allow(unused_mut)]
|
101 - | let mut tmp = {
|
102 - | #[allow(unused_mut)]
|
103 - | let mut output = crate::types::error::builders::SlowDownExceptionBuilder::default();
|
104 - | output = crate::protocol_serde::shape_slow_down_exception::de_slow_down_exception_json_err(_response_body, output)
|
105 - | .map_err(crate::operation::register_client::RegisterClientError::unhandled)?;
|
106 - | let output = output.meta(generic);
|
107 - | output.build()
|
108 - | };
|
109 - | if tmp.message.is_none() {
|
110 - | tmp.message = _error_message;
|
111 - | }
|
112 - | tmp
|
113 - | }),
|
114 - | "UnsupportedGrantTypeException" => crate::operation::register_client::RegisterClientError::UnsupportedGrantTypeException({
|
115 - | #[allow(unused_mut)]
|
116 - | let mut tmp = {
|
117 - | #[allow(unused_mut)]
|
118 - | let mut output = crate::types::error::builders::UnsupportedGrantTypeExceptionBuilder::default();
|
119 - | output = crate::protocol_serde::shape_unsupported_grant_type_exception::de_unsupported_grant_type_exception_json_err(
|
120 - | _response_body,
|
121 - | output,
|
122 - | )
|
123 - | .map_err(crate::operation::register_client::RegisterClientError::unhandled)?;
|
124 - | let output = output.meta(generic);
|
125 - | output.build()
|
126 - | };
|
127 - | if tmp.message.is_none() {
|
128 - | tmp.message = _error_message;
|
129 - | }
|
130 - | tmp
|
131 - | }),
|
132 - | _ => crate::operation::register_client::RegisterClientError::generic(generic),
|
133 - | })
|
134 - | }
|
135 - |
|
136 - | #[allow(clippy::unnecessary_wraps)]
|
137 - | pub fn de_register_client_http_response(
|
138 - | _response_status: u16,
|
139 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
140 - | _response_body: &[u8],
|
141 - | ) -> std::result::Result<crate::operation::register_client::RegisterClientOutput, crate::operation::register_client::RegisterClientError> {
|
142 - | Ok({
|
143 - | #[allow(unused_mut)]
|
144 - | let mut output = crate::operation::register_client::builders::RegisterClientOutputBuilder::default();
|
145 - | output = crate::protocol_serde::shape_register_client::de_register_client(_response_body, output)
|
146 - | .map_err(crate::operation::register_client::RegisterClientError::unhandled)?;
|
147 - | output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
|
148 - | output.build()
|
149 - | })
|
150 - | }
|
151 - |
|
152 - | pub fn ser_register_client_input(
|
153 - | input: &crate::operation::register_client::RegisterClientInput,
|
154 - | ) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
|
155 - | let mut out = String::new();
|
156 - | let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
|
157 - | crate::protocol_serde::shape_register_client_input::ser_register_client_input_input(&mut object, input)?;
|
158 - | object.finish();
|
159 - | Ok(::aws_smithy_types::body::SdkBody::from(out))
|
160 - | }
|
161 - |
|
162 - | pub(crate) fn de_register_client(
|
163 - | _value: &[u8],
|
164 - | mut builder: crate::operation::register_client::builders::RegisterClientOutputBuilder,
|
165 - | ) -> ::std::result::Result<
|
166 - | crate::operation::register_client::builders::RegisterClientOutputBuilder,
|
167 - | ::aws_smithy_json::deserialize::error::DeserializeError,
|
168 - | > {
|
169 - | let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
|
170 - | let tokens = &mut tokens_owned;
|
171 - | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
172 - | loop {
|
173 - | match tokens.next().transpose()? {
|
174 - | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
175 - | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
|
176 - | "authorizationEndpoint" => {
|
177 - | builder = builder.set_authorization_endpoint(
|
178 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
179 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
180 - | .transpose()?,
|
181 - | );
|
182 - | }
|
183 - | "clientId" => {
|
184 - | builder = builder.set_client_id(
|
185 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
186 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
187 - | .transpose()?,
|
188 - | );
|
189 - | }
|
190 - | "clientIdIssuedAt" => {
|
191 - | builder = builder.set_client_id_issued_at(
|
192 - | ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
|
193 - | .map(i64::try_from)
|
194 - | .transpose()?,
|
195 - | );
|
196 - | }
|
197 - | "clientSecret" => {
|
198 - | builder = builder.set_client_secret(
|
199 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
200 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
201 - | .transpose()?,
|
202 - | );
|
203 - | }
|
204 - | "clientSecretExpiresAt" => {
|
205 - | builder = builder.set_client_secret_expires_at(
|
206 - | ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
|
207 - | .map(i64::try_from)
|
208 - | .transpose()?,
|
209 - | );
|
210 - | }
|
211 - | "tokenEndpoint" => {
|
212 - | builder = builder.set_token_endpoint(
|
213 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
214 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
215 - | .transpose()?,
|
216 - | );
|
217 - | }
|
218 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
219 - | },
|
220 - | other => {
|
221 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
222 - | "expected object key or end object, found: {other:?}"
|
223 - | )))
|
224 - | }
|
225 - | }
|
226 - | }
|
227 - | if tokens.next().is_some() {
|
228 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
229 - | "found more JSON tokens after completing parsing",
|
230 - | ));
|
231 - | }
|
232 - | Ok(builder)
|
233 - | }
|