aws_sdk_ecs/protocol_serde/
shape_deployment.rs1pub(crate) fn de_deployment<'a, I>(
3 tokens: &mut ::std::iter::Peekable<I>,
4) -> ::std::result::Result<Option<crate::types::Deployment>, ::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::DeploymentBuilder::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 "id" => {
18 builder = builder.set_id(
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 "status" => {
25 builder = builder.set_status(
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 "taskDefinition" => {
32 builder = builder.set_task_definition(
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 "desiredCount" => {
39 builder = builder.set_desired_count(
40 ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
41 .map(i32::try_from)
42 .transpose()?,
43 );
44 }
45 "pendingCount" => {
46 builder = builder.set_pending_count(
47 ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
48 .map(i32::try_from)
49 .transpose()?,
50 );
51 }
52 "runningCount" => {
53 builder = builder.set_running_count(
54 ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
55 .map(i32::try_from)
56 .transpose()?,
57 );
58 }
59 "failedTasks" => {
60 builder = builder.set_failed_tasks(
61 ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
62 .map(i32::try_from)
63 .transpose()?,
64 );
65 }
66 "createdAt" => {
67 builder = builder.set_created_at(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
68 tokens.next(),
69 ::aws_smithy_types::date_time::Format::EpochSeconds,
70 )?);
71 }
72 "updatedAt" => {
73 builder = builder.set_updated_at(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
74 tokens.next(),
75 ::aws_smithy_types::date_time::Format::EpochSeconds,
76 )?);
77 }
78 "capacityProviderStrategy" => {
79 builder = builder.set_capacity_provider_strategy(
80 crate::protocol_serde::shape_capacity_provider_strategy::de_capacity_provider_strategy(tokens)?,
81 );
82 }
83 "launchType" => {
84 builder = builder.set_launch_type(
85 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
86 .map(|s| s.to_unescaped().map(|u| crate::types::LaunchType::from(u.as_ref())))
87 .transpose()?,
88 );
89 }
90 "platformVersion" => {
91 builder = builder.set_platform_version(
92 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
93 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
94 .transpose()?,
95 );
96 }
97 "platformFamily" => {
98 builder = builder.set_platform_family(
99 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
100 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
101 .transpose()?,
102 );
103 }
104 "networkConfiguration" => {
105 builder = builder
106 .set_network_configuration(crate::protocol_serde::shape_network_configuration::de_network_configuration(tokens)?);
107 }
108 "rolloutState" => {
109 builder = builder.set_rollout_state(
110 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
111 .map(|s| s.to_unescaped().map(|u| crate::types::DeploymentRolloutState::from(u.as_ref())))
112 .transpose()?,
113 );
114 }
115 "rolloutStateReason" => {
116 builder = builder.set_rollout_state_reason(
117 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
118 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
119 .transpose()?,
120 );
121 }
122 "serviceConnectConfiguration" => {
123 builder = builder.set_service_connect_configuration(
124 crate::protocol_serde::shape_service_connect_configuration::de_service_connect_configuration(tokens)?,
125 );
126 }
127 "serviceConnectResources" => {
128 builder = builder.set_service_connect_resources(
129 crate::protocol_serde::shape_service_connect_service_resource_list::de_service_connect_service_resource_list(tokens)?,
130 );
131 }
132 "volumeConfigurations" => {
133 builder = builder.set_volume_configurations(
134 crate::protocol_serde::shape_service_volume_configurations::de_service_volume_configurations(tokens)?,
135 );
136 }
137 "fargateEphemeralStorage" => {
138 builder = builder.set_fargate_ephemeral_storage(
139 crate::protocol_serde::shape_deployment_ephemeral_storage::de_deployment_ephemeral_storage(tokens)?,
140 );
141 }
142 "vpcLatticeConfigurations" => {
143 builder = builder.set_vpc_lattice_configurations(
144 crate::protocol_serde::shape_vpc_lattice_configurations::de_vpc_lattice_configurations(tokens)?,
145 );
146 }
147 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
148 },
149 other => {
150 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
151 "expected object key or end object, found: {:?}",
152 other
153 )))
154 }
155 }
156 }
157 Ok(Some(builder.build()))
158 }
159 _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
160 "expected start object or null",
161 )),
162 }
163}