aws_sdk_robomaker/protocol_serde/
shape_simulation_job.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub(crate) fn de_simulation_job<'a, I>(
3    tokens: &mut ::std::iter::Peekable<I>,
4) -> ::std::result::Result<Option<crate::types::SimulationJob>, ::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::SimulationJobBuilder::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                        "arn" => {
18                            builder = builder.set_arn(
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                        "name" => {
25                            builder = builder.set_name(
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                        "status" => {
32                            builder = builder.set_status(
33                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
34                                    .map(|s| s.to_unescaped().map(|u| crate::types::SimulationJobStatus::from(u.as_ref())))
35                                    .transpose()?,
36                            );
37                        }
38                        "lastStartedAt" => {
39                            builder = builder.set_last_started_at(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
40                                tokens.next(),
41                                ::aws_smithy_types::date_time::Format::EpochSeconds,
42                            )?);
43                        }
44                        "lastUpdatedAt" => {
45                            builder = builder.set_last_updated_at(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
46                                tokens.next(),
47                                ::aws_smithy_types::date_time::Format::EpochSeconds,
48                            )?);
49                        }
50                        "failureBehavior" => {
51                            builder = builder.set_failure_behavior(
52                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
53                                    .map(|s| s.to_unescaped().map(|u| crate::types::FailureBehavior::from(u.as_ref())))
54                                    .transpose()?,
55                            );
56                        }
57                        "failureCode" => {
58                            builder = builder.set_failure_code(
59                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
60                                    .map(|s| s.to_unescaped().map(|u| crate::types::SimulationJobErrorCode::from(u.as_ref())))
61                                    .transpose()?,
62                            );
63                        }
64                        "failureReason" => {
65                            builder = builder.set_failure_reason(
66                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
67                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
68                                    .transpose()?,
69                            );
70                        }
71                        "clientRequestToken" => {
72                            builder = builder.set_client_request_token(
73                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
74                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
75                                    .transpose()?,
76                            );
77                        }
78                        "outputLocation" => {
79                            builder = builder.set_output_location(crate::protocol_serde::shape_output_location::de_output_location(tokens)?);
80                        }
81                        "loggingConfig" => {
82                            builder = builder.set_logging_config(crate::protocol_serde::shape_logging_config::de_logging_config(tokens)?);
83                        }
84                        "maxJobDurationInSeconds" => {
85                            builder = builder.set_max_job_duration_in_seconds(
86                                ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
87                                    .map(i64::try_from)
88                                    .transpose()?,
89                            );
90                        }
91                        "simulationTimeMillis" => {
92                            builder = builder.set_simulation_time_millis(
93                                ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
94                                    .map(i64::try_from)
95                                    .transpose()?,
96                            );
97                        }
98                        "iamRole" => {
99                            builder = builder.set_iam_role(
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                        "robotApplications" => {
106                            builder = builder.set_robot_applications(
107                                crate::protocol_serde::shape_robot_application_configs::de_robot_application_configs(tokens)?,
108                            );
109                        }
110                        "simulationApplications" => {
111                            builder = builder.set_simulation_applications(
112                                crate::protocol_serde::shape_simulation_application_configs::de_simulation_application_configs(tokens)?,
113                            );
114                        }
115                        "dataSources" => {
116                            builder = builder.set_data_sources(crate::protocol_serde::shape_data_sources::de_data_sources(tokens)?);
117                        }
118                        "tags" => {
119                            builder = builder.set_tags(crate::protocol_serde::shape_tag_map::de_tag_map(tokens)?);
120                        }
121                        "vpcConfig" => {
122                            builder = builder.set_vpc_config(crate::protocol_serde::shape_vpc_config_response::de_vpc_config_response(tokens)?);
123                        }
124                        "networkInterface" => {
125                            builder = builder.set_network_interface(crate::protocol_serde::shape_network_interface::de_network_interface(tokens)?);
126                        }
127                        "compute" => {
128                            builder = builder.set_compute(crate::protocol_serde::shape_compute_response::de_compute_response(tokens)?);
129                        }
130                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
131                    },
132                    other => {
133                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
134                            "expected object key or end object, found: {:?}",
135                            other
136                        )))
137                    }
138                }
139            }
140            Ok(Some(builder.build()))
141        }
142        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
143            "expected start object or null",
144        )),
145    }
146}