1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | #[allow(clippy::unnecessary_wraps)]
|
3 - | pub fn de_describe_contributor_insights_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::describe_contributor_insights::DescribeContributorInsightsOutput,
|
9 - | crate::operation::describe_contributor_insights::DescribeContributorInsightsError,
|
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::describe_contributor_insights::DescribeContributorInsightsError::unhandled)?;
|
14 - | let generic = generic_builder.build();
|
15 - | let error_code = match generic.code() {
|
16 - | Some(code) => code,
|
17 - | None => return Err(crate::operation::describe_contributor_insights::DescribeContributorInsightsError::unhandled(generic)),
|
18 - | };
|
19 - |
|
20 - | let _error_message = generic.message().map(|msg| msg.to_owned());
|
21 - | Err(match error_code {
|
22 - | "InternalServerError" => crate::operation::describe_contributor_insights::DescribeContributorInsightsError::InternalServerError({
|
23 - | #[allow(unused_mut)]
|
24 - | let mut tmp = {
|
25 - | #[allow(unused_mut)]
|
26 - | let mut output = crate::types::error::builders::InternalServerErrorBuilder::default();
|
27 - | output = crate::protocol_serde::shape_internal_server_error::de_internal_server_error_json_err(_response_body, output)
|
28 - | .map_err(crate::operation::describe_contributor_insights::DescribeContributorInsightsError::unhandled)?;
|
29 - | let output = output.meta(generic);
|
30 - | output.build()
|
31 - | };
|
32 - | if tmp.message.is_none() {
|
33 - | tmp.message = _error_message;
|
34 - | }
|
35 - | tmp
|
36 - | }),
|
37 - | "ResourceNotFoundException" => crate::operation::describe_contributor_insights::DescribeContributorInsightsError::ResourceNotFoundError({
|
38 - | #[allow(unused_mut)]
|
39 - | let mut tmp = {
|
40 - | #[allow(unused_mut)]
|
41 - | let mut output = crate::types::error::builders::ResourceNotFoundErrorBuilder::default();
|
42 - | output = crate::protocol_serde::shape_resource_not_found_exception::de_resource_not_found_exception_json_err(_response_body, output)
|
43 - | .map_err(crate::operation::describe_contributor_insights::DescribeContributorInsightsError::unhandled)?;
|
44 - | let output = output.meta(generic);
|
45 - | output.build()
|
46 - | };
|
47 - | if tmp.message.is_none() {
|
48 - | tmp.message = _error_message;
|
49 - | }
|
50 - | tmp
|
51 - | }),
|
52 - | _ => crate::operation::describe_contributor_insights::DescribeContributorInsightsError::generic(generic),
|
53 - | })
|
54 - | }
|
55 - |
|
56 - | #[allow(clippy::unnecessary_wraps)]
|
57 - | pub fn de_describe_contributor_insights_http_response(
|
58 - | _response_status: u16,
|
59 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
60 - | _response_body: &[u8],
|
61 - | ) -> std::result::Result<
|
62 - | crate::operation::describe_contributor_insights::DescribeContributorInsightsOutput,
|
63 - | crate::operation::describe_contributor_insights::DescribeContributorInsightsError,
|
64 - | > {
|
65 - | Ok({
|
66 - | #[allow(unused_mut)]
|
67 - | let mut output = crate::operation::describe_contributor_insights::builders::DescribeContributorInsightsOutputBuilder::default();
|
68 - | output = crate::protocol_serde::shape_describe_contributor_insights::de_describe_contributor_insights(_response_body, output)
|
69 - | .map_err(crate::operation::describe_contributor_insights::DescribeContributorInsightsError::unhandled)?;
|
70 - | output.build()
|
71 - | })
|
72 - | }
|
73 - |
|
74 - | pub fn ser_describe_contributor_insights_input(
|
75 - | input: &crate::operation::describe_contributor_insights::DescribeContributorInsightsInput,
|
76 - | ) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
|
77 - | let mut out = String::new();
|
78 - | let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
|
79 - | crate::protocol_serde::shape_describe_contributor_insights_input::ser_describe_contributor_insights_input_input(&mut object, input)?;
|
80 - | object.finish();
|
81 - | Ok(::aws_smithy_types::body::SdkBody::from(out))
|
82 - | }
|
83 - |
|
84 - | pub(crate) fn de_describe_contributor_insights(
|
85 - | _value: &[u8],
|
86 - | mut builder: crate::operation::describe_contributor_insights::builders::DescribeContributorInsightsOutputBuilder,
|
87 - | ) -> ::std::result::Result<
|
88 - | crate::operation::describe_contributor_insights::builders::DescribeContributorInsightsOutputBuilder,
|
89 - | ::aws_smithy_json::deserialize::error::DeserializeError,
|
90 - | > {
|
91 - | let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
|
92 - | let tokens = &mut tokens_owned;
|
93 - | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
94 - | loop {
|
95 - | match tokens.next().transpose()? {
|
96 - | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
97 - | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
|
98 - | "TableName" => {
|
99 - | builder = builder.set_table_name(
|
100 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
101 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
102 - | .transpose()?,
|
103 - | );
|
104 - | }
|
105 - | "IndexName" => {
|
106 - | builder = builder.set_index_name(
|
107 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
108 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
109 - | .transpose()?,
|
110 - | );
|
111 - | }
|
112 - | "ContributorInsightsRuleList" => {
|
113 - | builder = builder.set_contributor_insights_rule_list(
|
114 - | crate::protocol_serde::shape_contributor_insights_rule_list::de_contributor_insights_rule_list(tokens, _value)?,
|
115 - | );
|
116 - | }
|
117 - | "ContributorInsightsStatus" => {
|
118 - | builder = builder.set_contributor_insights_status(
|
119 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
120 - | .map(|s| s.to_unescaped().map(|u| crate::types::ContributorInsightsStatus::from(u.as_ref())))
|
121 - | .transpose()?,
|
122 - | );
|
123 - | }
|
124 - | "LastUpdateDateTime" => {
|
125 - | builder = builder.set_last_update_date_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
|
126 - | tokens.next(),
|
127 - | ::aws_smithy_types::date_time::Format::EpochSeconds,
|
128 - | )?);
|
129 - | }
|
130 - | "FailureException" => {
|
131 - | builder = builder.set_failure_exception(crate::protocol_serde::shape_failure_exception::de_failure_exception(tokens, _value)?);
|
132 - | }
|
133 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
134 - | },
|
135 - | other => {
|
136 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
137 - | "expected object key or end object, found: {other:?}"
|
138 - | )))
|
139 - | }
|
140 - | }
|
141 - | }
|
142 - | if tokens.next().is_some() {
|
143 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
144 - | "found more JSON tokens after completing parsing",
|
145 - | ));
|
146 - | }
|
147 - | Ok(builder)
|
148 - | }
|