1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/robomaker/model/Robot.h>
7 #include <aws/core/utils/json/JsonSerializer.h>
8 
9 #include <utility>
10 
11 using namespace Aws::Utils::Json;
12 using namespace Aws::Utils;
13 
14 namespace Aws
15 {
16 namespace RoboMaker
17 {
18 namespace Model
19 {
20 
Robot()21 Robot::Robot() :
22     m_arnHasBeenSet(false),
23     m_nameHasBeenSet(false),
24     m_fleetArnHasBeenSet(false),
25     m_status(RobotStatus::NOT_SET),
26     m_statusHasBeenSet(false),
27     m_greenGrassGroupIdHasBeenSet(false),
28     m_createdAtHasBeenSet(false),
29     m_architecture(Architecture::NOT_SET),
30     m_architectureHasBeenSet(false),
31     m_lastDeploymentJobHasBeenSet(false),
32     m_lastDeploymentTimeHasBeenSet(false)
33 {
34 }
35 
Robot(JsonView jsonValue)36 Robot::Robot(JsonView jsonValue) :
37     m_arnHasBeenSet(false),
38     m_nameHasBeenSet(false),
39     m_fleetArnHasBeenSet(false),
40     m_status(RobotStatus::NOT_SET),
41     m_statusHasBeenSet(false),
42     m_greenGrassGroupIdHasBeenSet(false),
43     m_createdAtHasBeenSet(false),
44     m_architecture(Architecture::NOT_SET),
45     m_architectureHasBeenSet(false),
46     m_lastDeploymentJobHasBeenSet(false),
47     m_lastDeploymentTimeHasBeenSet(false)
48 {
49   *this = jsonValue;
50 }
51 
operator =(JsonView jsonValue)52 Robot& Robot::operator =(JsonView jsonValue)
53 {
54   if(jsonValue.ValueExists("arn"))
55   {
56     m_arn = jsonValue.GetString("arn");
57 
58     m_arnHasBeenSet = true;
59   }
60 
61   if(jsonValue.ValueExists("name"))
62   {
63     m_name = jsonValue.GetString("name");
64 
65     m_nameHasBeenSet = true;
66   }
67 
68   if(jsonValue.ValueExists("fleetArn"))
69   {
70     m_fleetArn = jsonValue.GetString("fleetArn");
71 
72     m_fleetArnHasBeenSet = true;
73   }
74 
75   if(jsonValue.ValueExists("status"))
76   {
77     m_status = RobotStatusMapper::GetRobotStatusForName(jsonValue.GetString("status"));
78 
79     m_statusHasBeenSet = true;
80   }
81 
82   if(jsonValue.ValueExists("greenGrassGroupId"))
83   {
84     m_greenGrassGroupId = jsonValue.GetString("greenGrassGroupId");
85 
86     m_greenGrassGroupIdHasBeenSet = true;
87   }
88 
89   if(jsonValue.ValueExists("createdAt"))
90   {
91     m_createdAt = jsonValue.GetDouble("createdAt");
92 
93     m_createdAtHasBeenSet = true;
94   }
95 
96   if(jsonValue.ValueExists("architecture"))
97   {
98     m_architecture = ArchitectureMapper::GetArchitectureForName(jsonValue.GetString("architecture"));
99 
100     m_architectureHasBeenSet = true;
101   }
102 
103   if(jsonValue.ValueExists("lastDeploymentJob"))
104   {
105     m_lastDeploymentJob = jsonValue.GetString("lastDeploymentJob");
106 
107     m_lastDeploymentJobHasBeenSet = true;
108   }
109 
110   if(jsonValue.ValueExists("lastDeploymentTime"))
111   {
112     m_lastDeploymentTime = jsonValue.GetDouble("lastDeploymentTime");
113 
114     m_lastDeploymentTimeHasBeenSet = true;
115   }
116 
117   return *this;
118 }
119 
Jsonize() const120 JsonValue Robot::Jsonize() const
121 {
122   JsonValue payload;
123 
124   if(m_arnHasBeenSet)
125   {
126    payload.WithString("arn", m_arn);
127 
128   }
129 
130   if(m_nameHasBeenSet)
131   {
132    payload.WithString("name", m_name);
133 
134   }
135 
136   if(m_fleetArnHasBeenSet)
137   {
138    payload.WithString("fleetArn", m_fleetArn);
139 
140   }
141 
142   if(m_statusHasBeenSet)
143   {
144    payload.WithString("status", RobotStatusMapper::GetNameForRobotStatus(m_status));
145   }
146 
147   if(m_greenGrassGroupIdHasBeenSet)
148   {
149    payload.WithString("greenGrassGroupId", m_greenGrassGroupId);
150 
151   }
152 
153   if(m_createdAtHasBeenSet)
154   {
155    payload.WithDouble("createdAt", m_createdAt.SecondsWithMSPrecision());
156   }
157 
158   if(m_architectureHasBeenSet)
159   {
160    payload.WithString("architecture", ArchitectureMapper::GetNameForArchitecture(m_architecture));
161   }
162 
163   if(m_lastDeploymentJobHasBeenSet)
164   {
165    payload.WithString("lastDeploymentJob", m_lastDeploymentJob);
166 
167   }
168 
169   if(m_lastDeploymentTimeHasBeenSet)
170   {
171    payload.WithDouble("lastDeploymentTime", m_lastDeploymentTime.SecondsWithMSPrecision());
172   }
173 
174   return payload;
175 }
176 
177 } // namespace Model
178 } // namespace RoboMaker
179 } // namespace Aws
180