1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | pub(crate) fn de_key_metadata<'a, I>(
|
3 - | tokens: &mut ::std::iter::Peekable<I>,
|
4 - | _value: &'a [u8],
|
5 - | ) -> ::std::result::Result<Option<crate::types::KeyMetadata>, ::aws_smithy_json::deserialize::error::DeserializeError>
|
6 - | where
|
7 - | I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
|
8 - | {
|
9 - | match tokens.next().transpose()? {
|
10 - | Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
|
11 - | Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
|
12 - | #[allow(unused_mut)]
|
13 - | let mut builder = crate::types::builders::KeyMetadataBuilder::default();
|
14 - | loop {
|
15 - | match tokens.next().transpose()? {
|
16 - | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
17 - | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
|
18 - | "AWSAccountId" => {
|
19 - | builder = builder.set_aws_account_id(
|
20 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
21 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
22 - | .transpose()?,
|
23 - | );
|
24 - | }
|
25 - | "KeyId" => {
|
26 - | builder = builder.set_key_id(
|
27 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
28 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
29 - | .transpose()?,
|
30 - | );
|
31 - | }
|
32 - | "Arn" => {
|
33 - | builder = builder.set_arn(
|
34 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
35 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
36 - | .transpose()?,
|
37 - | );
|
38 - | }
|
39 - | "CreationDate" => {
|
40 - | builder = builder.set_creation_date(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
|
41 - | tokens.next(),
|
42 - | ::aws_smithy_types::date_time::Format::EpochSeconds,
|
43 - | )?);
|
44 - | }
|
45 - | "Enabled" => {
|
46 - | builder = builder.set_enabled(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
|
47 - | }
|
48 - | "Description" => {
|
49 - | builder = builder.set_description(
|
50 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
51 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
52 - | .transpose()?,
|
53 - | );
|
54 - | }
|
55 - | "KeyUsage" => {
|
56 - | builder = builder.set_key_usage(
|
57 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
58 - | .map(|s| s.to_unescaped().map(|u| crate::types::KeyUsageType::from(u.as_ref())))
|
59 - | .transpose()?,
|
60 - | );
|
61 - | }
|
62 - | "KeyState" => {
|
63 - | builder = builder.set_key_state(
|
64 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
65 - | .map(|s| s.to_unescaped().map(|u| crate::types::KeyState::from(u.as_ref())))
|
66 - | .transpose()?,
|
67 - | );
|
68 - | }
|
69 - | "DeletionDate" => {
|
70 - | builder = builder.set_deletion_date(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
|
71 - | tokens.next(),
|
72 - | ::aws_smithy_types::date_time::Format::EpochSeconds,
|
73 - | )?);
|
74 - | }
|
75 - | "ValidTo" => {
|
76 - | builder = builder.set_valid_to(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
|
77 - | tokens.next(),
|
78 - | ::aws_smithy_types::date_time::Format::EpochSeconds,
|
79 - | )?);
|
80 - | }
|
81 - | "Origin" => {
|
82 - | builder = builder.set_origin(
|
83 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
84 - | .map(|s| s.to_unescaped().map(|u| crate::types::OriginType::from(u.as_ref())))
|
85 - | .transpose()?,
|
86 - | );
|
87 - | }
|
88 - | "CustomKeyStoreId" => {
|
89 - | builder = builder.set_custom_key_store_id(
|
90 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
91 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
92 - | .transpose()?,
|
93 - | );
|
94 - | }
|
95 - | "CloudHsmClusterId" => {
|
96 - | builder = builder.set_cloud_hsm_cluster_id(
|
97 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
98 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
99 - | .transpose()?,
|
100 - | );
|
101 - | }
|
102 - | "ExpirationModel" => {
|
103 - | builder = builder.set_expiration_model(
|
104 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
105 - | .map(|s| s.to_unescaped().map(|u| crate::types::ExpirationModelType::from(u.as_ref())))
|
106 - | .transpose()?,
|
107 - | );
|
108 - | }
|
109 - | "KeyManager" => {
|
110 - | builder = builder.set_key_manager(
|
111 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
112 - | .map(|s| s.to_unescaped().map(|u| crate::types::KeyManagerType::from(u.as_ref())))
|
113 - | .transpose()?,
|
114 - | );
|
115 - | }
|
116 - | "CustomerMasterKeySpec" => {
|
117 - | builder = builder.set_customer_master_key_spec(
|
118 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
119 - | .map(|s| s.to_unescaped().map(|u| crate::types::CustomerMasterKeySpec::from(u.as_ref())))
|
120 - | .transpose()?,
|
121 - | );
|
122 - | }
|
123 - | "KeySpec" => {
|
124 - | builder = builder.set_key_spec(
|
125 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
126 - | .map(|s| s.to_unescaped().map(|u| crate::types::KeySpec::from(u.as_ref())))
|
127 - | .transpose()?,
|
128 - | );
|
129 - | }
|
130 - | "EncryptionAlgorithms" => {
|
131 - | builder = builder.set_encryption_algorithms(
|
132 - | crate::protocol_serde::shape_encryption_algorithm_spec_list::de_encryption_algorithm_spec_list(tokens, _value)?,
|
133 - | );
|
134 - | }
|
135 - | "SigningAlgorithms" => {
|
136 - | builder = builder.set_signing_algorithms(
|
137 - | crate::protocol_serde::shape_signing_algorithm_spec_list::de_signing_algorithm_spec_list(tokens, _value)?,
|
138 - | );
|
139 - | }
|
140 - | "KeyAgreementAlgorithms" => {
|
141 - | builder = builder.set_key_agreement_algorithms(
|
142 - | crate::protocol_serde::shape_key_agreement_algorithm_spec_list::de_key_agreement_algorithm_spec_list(tokens, _value)?,
|
143 - | );
|
144 - | }
|
145 - | "MultiRegion" => {
|
146 - | builder = builder.set_multi_region(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
|
147 - | }
|
148 - | "MultiRegionConfiguration" => {
|
149 - | builder = builder.set_multi_region_configuration(
|
150 - | crate::protocol_serde::shape_multi_region_configuration::de_multi_region_configuration(tokens, _value)?,
|
151 - | );
|
152 - | }
|
153 - | "PendingDeletionWindowInDays" => {
|
154 - | builder = builder.set_pending_deletion_window_in_days(
|
155 - | ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
|
156 - | .map(i32::try_from)
|
157 - | .transpose()?,
|
158 - | );
|
159 - | }
|
160 - | "MacAlgorithms" => {
|
161 - | builder = builder.set_mac_algorithms(crate::protocol_serde::shape_mac_algorithm_spec_list::de_mac_algorithm_spec_list(
|
162 - | tokens, _value,
|
163 - | )?);
|
164 - | }
|
165 - | "XksKeyConfiguration" => {
|
166 - | builder = builder.set_xks_key_configuration(
|
167 - | crate::protocol_serde::shape_xks_key_configuration_type::de_xks_key_configuration_type(tokens, _value)?,
|
168 - | );
|
169 - | }
|
170 - | "CurrentKeyMaterialId" => {
|
171 - | builder = builder.set_current_key_material_id(
|
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 - | Ok(Some(crate::serde_util::key_metadata_correct_errors(builder).build().map_err(|err| {
|
187 - | ::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err)
|
188 - | })?))
|
189 - | }
|
190 - | _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
191 - | "expected start object or null",
|
192 - | )),
|
193 - | }
|
194 - | }
|