1 /**
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 * SPDX-License-Identifier: Apache-2.0.
4 */
5
6 #include <aws/gamelift/model/GameServer.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 GameLift
17 {
18 namespace Model
19 {
20
GameServer()21 GameServer::GameServer() :
22 m_gameServerGroupNameHasBeenSet(false),
23 m_gameServerGroupArnHasBeenSet(false),
24 m_gameServerIdHasBeenSet(false),
25 m_instanceIdHasBeenSet(false),
26 m_connectionInfoHasBeenSet(false),
27 m_gameServerDataHasBeenSet(false),
28 m_claimStatus(GameServerClaimStatus::NOT_SET),
29 m_claimStatusHasBeenSet(false),
30 m_utilizationStatus(GameServerUtilizationStatus::NOT_SET),
31 m_utilizationStatusHasBeenSet(false),
32 m_registrationTimeHasBeenSet(false),
33 m_lastClaimTimeHasBeenSet(false),
34 m_lastHealthCheckTimeHasBeenSet(false)
35 {
36 }
37
GameServer(JsonView jsonValue)38 GameServer::GameServer(JsonView jsonValue) :
39 m_gameServerGroupNameHasBeenSet(false),
40 m_gameServerGroupArnHasBeenSet(false),
41 m_gameServerIdHasBeenSet(false),
42 m_instanceIdHasBeenSet(false),
43 m_connectionInfoHasBeenSet(false),
44 m_gameServerDataHasBeenSet(false),
45 m_claimStatus(GameServerClaimStatus::NOT_SET),
46 m_claimStatusHasBeenSet(false),
47 m_utilizationStatus(GameServerUtilizationStatus::NOT_SET),
48 m_utilizationStatusHasBeenSet(false),
49 m_registrationTimeHasBeenSet(false),
50 m_lastClaimTimeHasBeenSet(false),
51 m_lastHealthCheckTimeHasBeenSet(false)
52 {
53 *this = jsonValue;
54 }
55
operator =(JsonView jsonValue)56 GameServer& GameServer::operator =(JsonView jsonValue)
57 {
58 if(jsonValue.ValueExists("GameServerGroupName"))
59 {
60 m_gameServerGroupName = jsonValue.GetString("GameServerGroupName");
61
62 m_gameServerGroupNameHasBeenSet = true;
63 }
64
65 if(jsonValue.ValueExists("GameServerGroupArn"))
66 {
67 m_gameServerGroupArn = jsonValue.GetString("GameServerGroupArn");
68
69 m_gameServerGroupArnHasBeenSet = true;
70 }
71
72 if(jsonValue.ValueExists("GameServerId"))
73 {
74 m_gameServerId = jsonValue.GetString("GameServerId");
75
76 m_gameServerIdHasBeenSet = true;
77 }
78
79 if(jsonValue.ValueExists("InstanceId"))
80 {
81 m_instanceId = jsonValue.GetString("InstanceId");
82
83 m_instanceIdHasBeenSet = true;
84 }
85
86 if(jsonValue.ValueExists("ConnectionInfo"))
87 {
88 m_connectionInfo = jsonValue.GetString("ConnectionInfo");
89
90 m_connectionInfoHasBeenSet = true;
91 }
92
93 if(jsonValue.ValueExists("GameServerData"))
94 {
95 m_gameServerData = jsonValue.GetString("GameServerData");
96
97 m_gameServerDataHasBeenSet = true;
98 }
99
100 if(jsonValue.ValueExists("ClaimStatus"))
101 {
102 m_claimStatus = GameServerClaimStatusMapper::GetGameServerClaimStatusForName(jsonValue.GetString("ClaimStatus"));
103
104 m_claimStatusHasBeenSet = true;
105 }
106
107 if(jsonValue.ValueExists("UtilizationStatus"))
108 {
109 m_utilizationStatus = GameServerUtilizationStatusMapper::GetGameServerUtilizationStatusForName(jsonValue.GetString("UtilizationStatus"));
110
111 m_utilizationStatusHasBeenSet = true;
112 }
113
114 if(jsonValue.ValueExists("RegistrationTime"))
115 {
116 m_registrationTime = jsonValue.GetDouble("RegistrationTime");
117
118 m_registrationTimeHasBeenSet = true;
119 }
120
121 if(jsonValue.ValueExists("LastClaimTime"))
122 {
123 m_lastClaimTime = jsonValue.GetDouble("LastClaimTime");
124
125 m_lastClaimTimeHasBeenSet = true;
126 }
127
128 if(jsonValue.ValueExists("LastHealthCheckTime"))
129 {
130 m_lastHealthCheckTime = jsonValue.GetDouble("LastHealthCheckTime");
131
132 m_lastHealthCheckTimeHasBeenSet = true;
133 }
134
135 return *this;
136 }
137
Jsonize() const138 JsonValue GameServer::Jsonize() const
139 {
140 JsonValue payload;
141
142 if(m_gameServerGroupNameHasBeenSet)
143 {
144 payload.WithString("GameServerGroupName", m_gameServerGroupName);
145
146 }
147
148 if(m_gameServerGroupArnHasBeenSet)
149 {
150 payload.WithString("GameServerGroupArn", m_gameServerGroupArn);
151
152 }
153
154 if(m_gameServerIdHasBeenSet)
155 {
156 payload.WithString("GameServerId", m_gameServerId);
157
158 }
159
160 if(m_instanceIdHasBeenSet)
161 {
162 payload.WithString("InstanceId", m_instanceId);
163
164 }
165
166 if(m_connectionInfoHasBeenSet)
167 {
168 payload.WithString("ConnectionInfo", m_connectionInfo);
169
170 }
171
172 if(m_gameServerDataHasBeenSet)
173 {
174 payload.WithString("GameServerData", m_gameServerData);
175
176 }
177
178 if(m_claimStatusHasBeenSet)
179 {
180 payload.WithString("ClaimStatus", GameServerClaimStatusMapper::GetNameForGameServerClaimStatus(m_claimStatus));
181 }
182
183 if(m_utilizationStatusHasBeenSet)
184 {
185 payload.WithString("UtilizationStatus", GameServerUtilizationStatusMapper::GetNameForGameServerUtilizationStatus(m_utilizationStatus));
186 }
187
188 if(m_registrationTimeHasBeenSet)
189 {
190 payload.WithDouble("RegistrationTime", m_registrationTime.SecondsWithMSPrecision());
191 }
192
193 if(m_lastClaimTimeHasBeenSet)
194 {
195 payload.WithDouble("LastClaimTime", m_lastClaimTime.SecondsWithMSPrecision());
196 }
197
198 if(m_lastHealthCheckTimeHasBeenSet)
199 {
200 payload.WithDouble("LastHealthCheckTime", m_lastHealthCheckTime.SecondsWithMSPrecision());
201 }
202
203 return payload;
204 }
205
206 } // namespace Model
207 } // namespace GameLift
208 } // namespace Aws
209