aws_sdk_databasemigration/protocol_serde/
shape_data_migration.rs1pub(crate) fn de_data_migration<'a, I>(
3 tokens: &mut ::std::iter::Peekable<I>,
4) -> ::std::result::Result<Option<crate::types::DataMigration>, ::aws_smithy_json::deserialize::error::DeserializeError>
5where
6 I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
7{
8 match tokens.next().transpose()? {
9 Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
10 Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
11 #[allow(unused_mut)]
12 let mut builder = crate::types::builders::DataMigrationBuilder::default();
13 loop {
14 match tokens.next().transpose()? {
15 Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
16 Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
17 "DataMigrationName" => {
18 builder = builder.set_data_migration_name(
19 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
20 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
21 .transpose()?,
22 );
23 }
24 "DataMigrationArn" => {
25 builder = builder.set_data_migration_arn(
26 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
27 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
28 .transpose()?,
29 );
30 }
31 "DataMigrationCreateTime" => {
32 builder = builder.set_data_migration_create_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
33 tokens.next(),
34 ::aws_smithy_types::date_time::Format::DateTimeWithOffset,
35 )?);
36 }
37 "DataMigrationStartTime" => {
38 builder = builder.set_data_migration_start_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
39 tokens.next(),
40 ::aws_smithy_types::date_time::Format::DateTimeWithOffset,
41 )?);
42 }
43 "DataMigrationEndTime" => {
44 builder = builder.set_data_migration_end_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
45 tokens.next(),
46 ::aws_smithy_types::date_time::Format::DateTimeWithOffset,
47 )?);
48 }
49 "ServiceAccessRoleArn" => {
50 builder = builder.set_service_access_role_arn(
51 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
52 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
53 .transpose()?,
54 );
55 }
56 "MigrationProjectArn" => {
57 builder = builder.set_migration_project_arn(
58 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
59 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
60 .transpose()?,
61 );
62 }
63 "DataMigrationType" => {
64 builder = builder.set_data_migration_type(
65 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
66 .map(|s| s.to_unescaped().map(|u| crate::types::MigrationTypeValue::from(u.as_ref())))
67 .transpose()?,
68 );
69 }
70 "DataMigrationSettings" => {
71 builder = builder.set_data_migration_settings(
72 crate::protocol_serde::shape_data_migration_settings::de_data_migration_settings(tokens)?,
73 );
74 }
75 "SourceDataSettings" => {
76 builder =
77 builder.set_source_data_settings(crate::protocol_serde::shape_source_data_settings::de_source_data_settings(tokens)?);
78 }
79 "TargetDataSettings" => {
80 builder =
81 builder.set_target_data_settings(crate::protocol_serde::shape_target_data_settings::de_target_data_settings(tokens)?);
82 }
83 "DataMigrationStatistics" => {
84 builder = builder.set_data_migration_statistics(
85 crate::protocol_serde::shape_data_migration_statistics::de_data_migration_statistics(tokens)?,
86 );
87 }
88 "DataMigrationStatus" => {
89 builder = builder.set_data_migration_status(
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 "PublicIpAddresses" => {
96 builder = builder
97 .set_public_ip_addresses(crate::protocol_serde::shape_public_ip_address_list::de_public_ip_address_list(tokens)?);
98 }
99 "DataMigrationCidrBlocks" => {
100 builder = builder.set_data_migration_cidr_blocks(
101 crate::protocol_serde::shape_data_migration_cidr_block::de_data_migration_cidr_block(tokens)?,
102 );
103 }
104 "LastFailureMessage" => {
105 builder = builder.set_last_failure_message(
106 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
107 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
108 .transpose()?,
109 );
110 }
111 "StopReason" => {
112 builder = builder.set_stop_reason(
113 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
114 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
115 .transpose()?,
116 );
117 }
118 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
119 },
120 other => {
121 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
122 "expected object key or end object, found: {:?}",
123 other
124 )))
125 }
126 }
127 }
128 Ok(Some(builder.build()))
129 }
130 _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
131 "expected start object or null",
132 )),
133 }
134}