aws_sdk_databasemigration/protocol_serde/
shape_replication_task.rs1pub(crate) fn de_replication_task<'a, I>(
3 tokens: &mut ::std::iter::Peekable<I>,
4) -> ::std::result::Result<Option<crate::types::ReplicationTask>, ::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::ReplicationTaskBuilder::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 "ReplicationTaskIdentifier" => {
18 builder = builder.set_replication_task_identifier(
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 "SourceEndpointArn" => {
25 builder = builder.set_source_endpoint_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 "TargetEndpointArn" => {
32 builder = builder.set_target_endpoint_arn(
33 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
34 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
35 .transpose()?,
36 );
37 }
38 "ReplicationInstanceArn" => {
39 builder = builder.set_replication_instance_arn(
40 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
41 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
42 .transpose()?,
43 );
44 }
45 "MigrationType" => {
46 builder = builder.set_migration_type(
47 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
48 .map(|s| s.to_unescaped().map(|u| crate::types::MigrationTypeValue::from(u.as_ref())))
49 .transpose()?,
50 );
51 }
52 "TableMappings" => {
53 builder = builder.set_table_mappings(
54 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
55 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
56 .transpose()?,
57 );
58 }
59 "ReplicationTaskSettings" => {
60 builder = builder.set_replication_task_settings(
61 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
62 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
63 .transpose()?,
64 );
65 }
66 "Status" => {
67 builder = builder.set_status(
68 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
69 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
70 .transpose()?,
71 );
72 }
73 "LastFailureMessage" => {
74 builder = builder.set_last_failure_message(
75 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
76 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
77 .transpose()?,
78 );
79 }
80 "StopReason" => {
81 builder = builder.set_stop_reason(
82 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
83 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
84 .transpose()?,
85 );
86 }
87 "ReplicationTaskCreationDate" => {
88 builder = builder.set_replication_task_creation_date(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
89 tokens.next(),
90 ::aws_smithy_types::date_time::Format::EpochSeconds,
91 )?);
92 }
93 "ReplicationTaskStartDate" => {
94 builder = builder.set_replication_task_start_date(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
95 tokens.next(),
96 ::aws_smithy_types::date_time::Format::EpochSeconds,
97 )?);
98 }
99 "CdcStartPosition" => {
100 builder = builder.set_cdc_start_position(
101 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
102 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
103 .transpose()?,
104 );
105 }
106 "CdcStopPosition" => {
107 builder = builder.set_cdc_stop_position(
108 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
109 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
110 .transpose()?,
111 );
112 }
113 "RecoveryCheckpoint" => {
114 builder = builder.set_recovery_checkpoint(
115 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
116 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
117 .transpose()?,
118 );
119 }
120 "ReplicationTaskArn" => {
121 builder = builder.set_replication_task_arn(
122 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
123 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
124 .transpose()?,
125 );
126 }
127 "ReplicationTaskStats" => {
128 builder = builder
129 .set_replication_task_stats(crate::protocol_serde::shape_replication_task_stats::de_replication_task_stats(tokens)?);
130 }
131 "TaskData" => {
132 builder = builder.set_task_data(
133 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
134 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
135 .transpose()?,
136 );
137 }
138 "TargetReplicationInstanceArn" => {
139 builder = builder.set_target_replication_instance_arn(
140 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
141 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
142 .transpose()?,
143 );
144 }
145 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
146 },
147 other => {
148 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
149 "expected object key or end object, found: {:?}",
150 other
151 )))
152 }
153 }
154 }
155 Ok(Some(builder.build()))
156 }
157 _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
158 "expected start object or null",
159 )),
160 }
161}