1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | #[allow(clippy::unnecessary_wraps)]
|
3 - | pub fn de_get_workflow_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::get_workflow::GetWorkflowOutput, crate::operation::get_workflow::GetWorkflowError> {
|
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::get_workflow::GetWorkflowError::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::get_workflow::GetWorkflowError::unhandled(generic)),
|
16 - | };
|
17 - |
|
18 - | let _error_message = generic.message().map(|msg| msg.to_owned());
|
19 - | Err(match error_code {
|
20 - | "AccessDeniedException" => crate::operation::get_workflow::GetWorkflowError::AccessDeniedException({
|
21 - | #[allow(unused_mut)]
|
22 - | let mut tmp = {
|
23 - | #[allow(unused_mut)]
|
24 - | let mut output = crate::types::error::builders::AccessDeniedExceptionBuilder::default();
|
25 - | output = crate::protocol_serde::shape_access_denied_exception::de_access_denied_exception_json_err(_response_body, output)
|
26 - | .map_err(crate::operation::get_workflow::GetWorkflowError::unhandled)?;
|
27 - | let output = output.meta(generic);
|
28 - | crate::serde_util::access_denied_exception_correct_errors(output)
|
29 - | .build()
|
30 - | .map_err(crate::operation::get_workflow::GetWorkflowError::unhandled)?
|
31 - | };
|
32 - | tmp
|
33 - | }),
|
34 - | "ConflictException" => crate::operation::get_workflow::GetWorkflowError::ConflictException({
|
35 - | #[allow(unused_mut)]
|
36 - | let mut tmp = {
|
37 - | #[allow(unused_mut)]
|
38 - | let mut output = crate::types::error::builders::ConflictExceptionBuilder::default();
|
39 - | output = crate::protocol_serde::shape_conflict_exception::de_conflict_exception_json_err(_response_body, output)
|
40 - | .map_err(crate::operation::get_workflow::GetWorkflowError::unhandled)?;
|
41 - | let output = output.meta(generic);
|
42 - | crate::serde_util::conflict_exception_correct_errors(output)
|
43 - | .build()
|
44 - | .map_err(crate::operation::get_workflow::GetWorkflowError::unhandled)?
|
45 - | };
|
46 - | tmp
|
47 - | }),
|
48 - | "ResourceNotFoundException" => crate::operation::get_workflow::GetWorkflowError::ResourceNotFoundException({
|
49 - | #[allow(unused_mut)]
|
50 - | let mut tmp = {
|
51 - | #[allow(unused_mut)]
|
52 - | let mut output = crate::types::error::builders::ResourceNotFoundExceptionBuilder::default();
|
53 - | output = crate::protocol_serde::shape_resource_not_found_exception::de_resource_not_found_exception_json_err(_response_body, output)
|
54 - | .map_err(crate::operation::get_workflow::GetWorkflowError::unhandled)?;
|
55 - | let output = output.meta(generic);
|
56 - | crate::serde_util::resource_not_found_exception_correct_errors(output)
|
57 - | .build()
|
58 - | .map_err(crate::operation::get_workflow::GetWorkflowError::unhandled)?
|
59 - | };
|
60 - | tmp
|
61 - | }),
|
62 - | "ServiceQuotaExceededException" => crate::operation::get_workflow::GetWorkflowError::ServiceQuotaExceededException({
|
63 - | #[allow(unused_mut)]
|
64 - | let mut tmp = {
|
65 - | #[allow(unused_mut)]
|
66 - | let mut output = crate::types::error::builders::ServiceQuotaExceededExceptionBuilder::default();
|
67 - | output = crate::protocol_serde::shape_service_quota_exceeded_exception::de_service_quota_exceeded_exception_json_err(
|
68 - | _response_body,
|
69 - | output,
|
70 - | )
|
71 - | .map_err(crate::operation::get_workflow::GetWorkflowError::unhandled)?;
|
72 - | let output = output.meta(generic);
|
73 - | crate::serde_util::service_quota_exceeded_exception_correct_errors(output)
|
74 - | .build()
|
75 - | .map_err(crate::operation::get_workflow::GetWorkflowError::unhandled)?
|
76 - | };
|
77 - | tmp
|
78 - | }),
|
79 - | "ThrottlingException" => crate::operation::get_workflow::GetWorkflowError::ThrottlingException({
|
80 - | #[allow(unused_mut)]
|
81 - | let mut tmp = {
|
82 - | #[allow(unused_mut)]
|
83 - | let mut output = crate::types::error::builders::ThrottlingExceptionBuilder::default();
|
84 - | output = crate::protocol_serde::shape_throttling_exception::de_throttling_exception_json_err(_response_body, output)
|
85 - | .map_err(crate::operation::get_workflow::GetWorkflowError::unhandled)?;
|
86 - | let output = output.meta(generic);
|
87 - | crate::serde_util::throttling_exception_correct_errors(output)
|
88 - | .build()
|
89 - | .map_err(crate::operation::get_workflow::GetWorkflowError::unhandled)?
|
90 - | };
|
91 - | tmp
|
92 - | }),
|
93 - | "ValidationException" => crate::operation::get_workflow::GetWorkflowError::ValidationException({
|
94 - | #[allow(unused_mut)]
|
95 - | let mut tmp = {
|
96 - | #[allow(unused_mut)]
|
97 - | let mut output = crate::types::error::builders::ValidationExceptionBuilder::default();
|
98 - | output = crate::protocol_serde::shape_validation_exception::de_validation_exception_json_err(_response_body, output)
|
99 - | .map_err(crate::operation::get_workflow::GetWorkflowError::unhandled)?;
|
100 - | let output = output.meta(generic);
|
101 - | crate::serde_util::validation_exception_correct_errors(output)
|
102 - | .build()
|
103 - | .map_err(crate::operation::get_workflow::GetWorkflowError::unhandled)?
|
104 - | };
|
105 - | tmp
|
106 - | }),
|
107 - | _ => crate::operation::get_workflow::GetWorkflowError::generic(generic),
|
108 - | })
|
109 - | }
|
110 - |
|
111 - | #[allow(clippy::unnecessary_wraps)]
|
112 - | pub fn de_get_workflow_http_response(
|
113 - | _response_status: u16,
|
114 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
115 - | _response_body: &[u8],
|
116 - | ) -> std::result::Result<crate::operation::get_workflow::GetWorkflowOutput, crate::operation::get_workflow::GetWorkflowError> {
|
117 - | Ok({
|
118 - | #[allow(unused_mut)]
|
119 - | let mut output = crate::operation::get_workflow::builders::GetWorkflowOutputBuilder::default();
|
120 - | output = crate::protocol_serde::shape_get_workflow::de_get_workflow(_response_body, output)
|
121 - | .map_err(crate::operation::get_workflow::GetWorkflowError::unhandled)?;
|
122 - | output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
|
123 - | crate::serde_util::get_workflow_output_output_correct_errors(output)
|
124 - | .build()
|
125 - | .map_err(crate::operation::get_workflow::GetWorkflowError::unhandled)?
|
126 - | })
|
127 - | }
|
128 - |
|
129 - | pub(crate) fn de_get_workflow(
|
130 - | _value: &[u8],
|
131 - | mut builder: crate::operation::get_workflow::builders::GetWorkflowOutputBuilder,
|
132 - | ) -> ::std::result::Result<crate::operation::get_workflow::builders::GetWorkflowOutputBuilder, ::aws_smithy_json::deserialize::error::DeserializeError>
|
133 - | {
|
134 - | let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
|
135 - | let tokens = &mut tokens_owned;
|
136 - | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
137 - | loop {
|
138 - | match tokens.next().transpose()? {
|
139 - | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
140 - | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
|
141 - | "createdTime" => {
|
142 - | builder = builder.set_created_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
|
143 - | tokens.next(),
|
144 - | ::aws_smithy_types::date_time::Format::DateTimeWithOffset,
|
145 - | )?);
|
146 - | }
|
147 - | "definition" => {
|
148 - | builder = builder.set_definition(crate::protocol_serde::shape_workflow_definition::de_workflow_definition(tokens, _value)?);
|
149 - | }
|
150 - | "id" => {
|
151 - | builder = builder.set_id(
|
152 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
153 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
154 - | .transpose()?,
|
155 - | );
|
156 - | }
|
157 - | "lastUpdatedTime" => {
|
158 - | builder = builder.set_last_updated_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
|
159 - | tokens.next(),
|
160 - | ::aws_smithy_types::date_time::Format::DateTimeWithOffset,
|
161 - | )?);
|
162 - | }
|
163 - | "name" => {
|
164 - | builder = builder.set_name(
|
165 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
166 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
167 - | .transpose()?,
|
168 - | );
|
169 - | }
|
170 - | "projectName" => {
|
171 - | builder = builder.set_project_name(
|
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 - | "runMode" => {
|
178 - | builder = builder.set_run_mode(
|
179 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
180 - | .map(|s| s.to_unescaped().map(|u| crate::types::WorkflowRunMode::from(u.as_ref())))
|
181 - | .transpose()?,
|
182 - | );
|
183 - | }
|
184 - | "sourceBranchName" => {
|
185 - | builder = builder.set_source_branch_name(
|
186 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
187 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
188 - | .transpose()?,
|
189 - | );
|
190 - | }
|
191 - | "sourceRepositoryName" => {
|
192 - | builder = builder.set_source_repository_name(
|
193 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
194 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
195 - | .transpose()?,
|
196 - | );
|
197 - | }
|
198 - | "spaceName" => {
|
199 - | builder = builder.set_space_name(
|
200 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
201 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
202 - | .transpose()?,
|
203 - | );
|
204 - | }
|
205 - | "status" => {
|
206 - | builder = builder.set_status(
|
207 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
208 - | .map(|s| s.to_unescaped().map(|u| crate::types::WorkflowStatus::from(u.as_ref())))
|
209 - | .transpose()?,
|
210 - | );
|
211 - | }
|
212 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
213 - | },
|
214 - | other => {
|
215 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
216 - | "expected object key or end object, found: {other:?}"
|
217 - | )))
|
218 - | }
|
219 - | }
|
220 - | }
|
221 - | if tokens.next().is_some() {
|
222 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
223 - | "found more JSON tokens after completing parsing",
|
224 - | ));
|
225 - | }
|
226 - | Ok(builder)
|
227 - | }
|