1 /**
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 * SPDX-License-Identifier: Apache-2.0.
4 */
5
6 #include <aws/ce/model/ReservationPurchaseRecommendationDetail.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 CostExplorer
17 {
18 namespace Model
19 {
20
ReservationPurchaseRecommendationDetail()21 ReservationPurchaseRecommendationDetail::ReservationPurchaseRecommendationDetail() :
22 m_accountIdHasBeenSet(false),
23 m_instanceDetailsHasBeenSet(false),
24 m_recommendedNumberOfInstancesToPurchaseHasBeenSet(false),
25 m_recommendedNormalizedUnitsToPurchaseHasBeenSet(false),
26 m_minimumNumberOfInstancesUsedPerHourHasBeenSet(false),
27 m_minimumNormalizedUnitsUsedPerHourHasBeenSet(false),
28 m_maximumNumberOfInstancesUsedPerHourHasBeenSet(false),
29 m_maximumNormalizedUnitsUsedPerHourHasBeenSet(false),
30 m_averageNumberOfInstancesUsedPerHourHasBeenSet(false),
31 m_averageNormalizedUnitsUsedPerHourHasBeenSet(false),
32 m_averageUtilizationHasBeenSet(false),
33 m_estimatedBreakEvenInMonthsHasBeenSet(false),
34 m_currencyCodeHasBeenSet(false),
35 m_estimatedMonthlySavingsAmountHasBeenSet(false),
36 m_estimatedMonthlySavingsPercentageHasBeenSet(false),
37 m_estimatedMonthlyOnDemandCostHasBeenSet(false),
38 m_estimatedReservationCostForLookbackPeriodHasBeenSet(false),
39 m_upfrontCostHasBeenSet(false),
40 m_recurringStandardMonthlyCostHasBeenSet(false)
41 {
42 }
43
ReservationPurchaseRecommendationDetail(JsonView jsonValue)44 ReservationPurchaseRecommendationDetail::ReservationPurchaseRecommendationDetail(JsonView jsonValue) :
45 m_accountIdHasBeenSet(false),
46 m_instanceDetailsHasBeenSet(false),
47 m_recommendedNumberOfInstancesToPurchaseHasBeenSet(false),
48 m_recommendedNormalizedUnitsToPurchaseHasBeenSet(false),
49 m_minimumNumberOfInstancesUsedPerHourHasBeenSet(false),
50 m_minimumNormalizedUnitsUsedPerHourHasBeenSet(false),
51 m_maximumNumberOfInstancesUsedPerHourHasBeenSet(false),
52 m_maximumNormalizedUnitsUsedPerHourHasBeenSet(false),
53 m_averageNumberOfInstancesUsedPerHourHasBeenSet(false),
54 m_averageNormalizedUnitsUsedPerHourHasBeenSet(false),
55 m_averageUtilizationHasBeenSet(false),
56 m_estimatedBreakEvenInMonthsHasBeenSet(false),
57 m_currencyCodeHasBeenSet(false),
58 m_estimatedMonthlySavingsAmountHasBeenSet(false),
59 m_estimatedMonthlySavingsPercentageHasBeenSet(false),
60 m_estimatedMonthlyOnDemandCostHasBeenSet(false),
61 m_estimatedReservationCostForLookbackPeriodHasBeenSet(false),
62 m_upfrontCostHasBeenSet(false),
63 m_recurringStandardMonthlyCostHasBeenSet(false)
64 {
65 *this = jsonValue;
66 }
67
operator =(JsonView jsonValue)68 ReservationPurchaseRecommendationDetail& ReservationPurchaseRecommendationDetail::operator =(JsonView jsonValue)
69 {
70 if(jsonValue.ValueExists("AccountId"))
71 {
72 m_accountId = jsonValue.GetString("AccountId");
73
74 m_accountIdHasBeenSet = true;
75 }
76
77 if(jsonValue.ValueExists("InstanceDetails"))
78 {
79 m_instanceDetails = jsonValue.GetObject("InstanceDetails");
80
81 m_instanceDetailsHasBeenSet = true;
82 }
83
84 if(jsonValue.ValueExists("RecommendedNumberOfInstancesToPurchase"))
85 {
86 m_recommendedNumberOfInstancesToPurchase = jsonValue.GetString("RecommendedNumberOfInstancesToPurchase");
87
88 m_recommendedNumberOfInstancesToPurchaseHasBeenSet = true;
89 }
90
91 if(jsonValue.ValueExists("RecommendedNormalizedUnitsToPurchase"))
92 {
93 m_recommendedNormalizedUnitsToPurchase = jsonValue.GetString("RecommendedNormalizedUnitsToPurchase");
94
95 m_recommendedNormalizedUnitsToPurchaseHasBeenSet = true;
96 }
97
98 if(jsonValue.ValueExists("MinimumNumberOfInstancesUsedPerHour"))
99 {
100 m_minimumNumberOfInstancesUsedPerHour = jsonValue.GetString("MinimumNumberOfInstancesUsedPerHour");
101
102 m_minimumNumberOfInstancesUsedPerHourHasBeenSet = true;
103 }
104
105 if(jsonValue.ValueExists("MinimumNormalizedUnitsUsedPerHour"))
106 {
107 m_minimumNormalizedUnitsUsedPerHour = jsonValue.GetString("MinimumNormalizedUnitsUsedPerHour");
108
109 m_minimumNormalizedUnitsUsedPerHourHasBeenSet = true;
110 }
111
112 if(jsonValue.ValueExists("MaximumNumberOfInstancesUsedPerHour"))
113 {
114 m_maximumNumberOfInstancesUsedPerHour = jsonValue.GetString("MaximumNumberOfInstancesUsedPerHour");
115
116 m_maximumNumberOfInstancesUsedPerHourHasBeenSet = true;
117 }
118
119 if(jsonValue.ValueExists("MaximumNormalizedUnitsUsedPerHour"))
120 {
121 m_maximumNormalizedUnitsUsedPerHour = jsonValue.GetString("MaximumNormalizedUnitsUsedPerHour");
122
123 m_maximumNormalizedUnitsUsedPerHourHasBeenSet = true;
124 }
125
126 if(jsonValue.ValueExists("AverageNumberOfInstancesUsedPerHour"))
127 {
128 m_averageNumberOfInstancesUsedPerHour = jsonValue.GetString("AverageNumberOfInstancesUsedPerHour");
129
130 m_averageNumberOfInstancesUsedPerHourHasBeenSet = true;
131 }
132
133 if(jsonValue.ValueExists("AverageNormalizedUnitsUsedPerHour"))
134 {
135 m_averageNormalizedUnitsUsedPerHour = jsonValue.GetString("AverageNormalizedUnitsUsedPerHour");
136
137 m_averageNormalizedUnitsUsedPerHourHasBeenSet = true;
138 }
139
140 if(jsonValue.ValueExists("AverageUtilization"))
141 {
142 m_averageUtilization = jsonValue.GetString("AverageUtilization");
143
144 m_averageUtilizationHasBeenSet = true;
145 }
146
147 if(jsonValue.ValueExists("EstimatedBreakEvenInMonths"))
148 {
149 m_estimatedBreakEvenInMonths = jsonValue.GetString("EstimatedBreakEvenInMonths");
150
151 m_estimatedBreakEvenInMonthsHasBeenSet = true;
152 }
153
154 if(jsonValue.ValueExists("CurrencyCode"))
155 {
156 m_currencyCode = jsonValue.GetString("CurrencyCode");
157
158 m_currencyCodeHasBeenSet = true;
159 }
160
161 if(jsonValue.ValueExists("EstimatedMonthlySavingsAmount"))
162 {
163 m_estimatedMonthlySavingsAmount = jsonValue.GetString("EstimatedMonthlySavingsAmount");
164
165 m_estimatedMonthlySavingsAmountHasBeenSet = true;
166 }
167
168 if(jsonValue.ValueExists("EstimatedMonthlySavingsPercentage"))
169 {
170 m_estimatedMonthlySavingsPercentage = jsonValue.GetString("EstimatedMonthlySavingsPercentage");
171
172 m_estimatedMonthlySavingsPercentageHasBeenSet = true;
173 }
174
175 if(jsonValue.ValueExists("EstimatedMonthlyOnDemandCost"))
176 {
177 m_estimatedMonthlyOnDemandCost = jsonValue.GetString("EstimatedMonthlyOnDemandCost");
178
179 m_estimatedMonthlyOnDemandCostHasBeenSet = true;
180 }
181
182 if(jsonValue.ValueExists("EstimatedReservationCostForLookbackPeriod"))
183 {
184 m_estimatedReservationCostForLookbackPeriod = jsonValue.GetString("EstimatedReservationCostForLookbackPeriod");
185
186 m_estimatedReservationCostForLookbackPeriodHasBeenSet = true;
187 }
188
189 if(jsonValue.ValueExists("UpfrontCost"))
190 {
191 m_upfrontCost = jsonValue.GetString("UpfrontCost");
192
193 m_upfrontCostHasBeenSet = true;
194 }
195
196 if(jsonValue.ValueExists("RecurringStandardMonthlyCost"))
197 {
198 m_recurringStandardMonthlyCost = jsonValue.GetString("RecurringStandardMonthlyCost");
199
200 m_recurringStandardMonthlyCostHasBeenSet = true;
201 }
202
203 return *this;
204 }
205
Jsonize() const206 JsonValue ReservationPurchaseRecommendationDetail::Jsonize() const
207 {
208 JsonValue payload;
209
210 if(m_accountIdHasBeenSet)
211 {
212 payload.WithString("AccountId", m_accountId);
213
214 }
215
216 if(m_instanceDetailsHasBeenSet)
217 {
218 payload.WithObject("InstanceDetails", m_instanceDetails.Jsonize());
219
220 }
221
222 if(m_recommendedNumberOfInstancesToPurchaseHasBeenSet)
223 {
224 payload.WithString("RecommendedNumberOfInstancesToPurchase", m_recommendedNumberOfInstancesToPurchase);
225
226 }
227
228 if(m_recommendedNormalizedUnitsToPurchaseHasBeenSet)
229 {
230 payload.WithString("RecommendedNormalizedUnitsToPurchase", m_recommendedNormalizedUnitsToPurchase);
231
232 }
233
234 if(m_minimumNumberOfInstancesUsedPerHourHasBeenSet)
235 {
236 payload.WithString("MinimumNumberOfInstancesUsedPerHour", m_minimumNumberOfInstancesUsedPerHour);
237
238 }
239
240 if(m_minimumNormalizedUnitsUsedPerHourHasBeenSet)
241 {
242 payload.WithString("MinimumNormalizedUnitsUsedPerHour", m_minimumNormalizedUnitsUsedPerHour);
243
244 }
245
246 if(m_maximumNumberOfInstancesUsedPerHourHasBeenSet)
247 {
248 payload.WithString("MaximumNumberOfInstancesUsedPerHour", m_maximumNumberOfInstancesUsedPerHour);
249
250 }
251
252 if(m_maximumNormalizedUnitsUsedPerHourHasBeenSet)
253 {
254 payload.WithString("MaximumNormalizedUnitsUsedPerHour", m_maximumNormalizedUnitsUsedPerHour);
255
256 }
257
258 if(m_averageNumberOfInstancesUsedPerHourHasBeenSet)
259 {
260 payload.WithString("AverageNumberOfInstancesUsedPerHour", m_averageNumberOfInstancesUsedPerHour);
261
262 }
263
264 if(m_averageNormalizedUnitsUsedPerHourHasBeenSet)
265 {
266 payload.WithString("AverageNormalizedUnitsUsedPerHour", m_averageNormalizedUnitsUsedPerHour);
267
268 }
269
270 if(m_averageUtilizationHasBeenSet)
271 {
272 payload.WithString("AverageUtilization", m_averageUtilization);
273
274 }
275
276 if(m_estimatedBreakEvenInMonthsHasBeenSet)
277 {
278 payload.WithString("EstimatedBreakEvenInMonths", m_estimatedBreakEvenInMonths);
279
280 }
281
282 if(m_currencyCodeHasBeenSet)
283 {
284 payload.WithString("CurrencyCode", m_currencyCode);
285
286 }
287
288 if(m_estimatedMonthlySavingsAmountHasBeenSet)
289 {
290 payload.WithString("EstimatedMonthlySavingsAmount", m_estimatedMonthlySavingsAmount);
291
292 }
293
294 if(m_estimatedMonthlySavingsPercentageHasBeenSet)
295 {
296 payload.WithString("EstimatedMonthlySavingsPercentage", m_estimatedMonthlySavingsPercentage);
297
298 }
299
300 if(m_estimatedMonthlyOnDemandCostHasBeenSet)
301 {
302 payload.WithString("EstimatedMonthlyOnDemandCost", m_estimatedMonthlyOnDemandCost);
303
304 }
305
306 if(m_estimatedReservationCostForLookbackPeriodHasBeenSet)
307 {
308 payload.WithString("EstimatedReservationCostForLookbackPeriod", m_estimatedReservationCostForLookbackPeriod);
309
310 }
311
312 if(m_upfrontCostHasBeenSet)
313 {
314 payload.WithString("UpfrontCost", m_upfrontCost);
315
316 }
317
318 if(m_recurringStandardMonthlyCostHasBeenSet)
319 {
320 payload.WithString("RecurringStandardMonthlyCost", m_recurringStandardMonthlyCost);
321
322 }
323
324 return payload;
325 }
326
327 } // namespace Model
328 } // namespace CostExplorer
329 } // namespace Aws
330