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/SavingsPlansAmortizedCommitment.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 
SavingsPlansAmortizedCommitment()21 SavingsPlansAmortizedCommitment::SavingsPlansAmortizedCommitment() :
22     m_amortizedRecurringCommitmentHasBeenSet(false),
23     m_amortizedUpfrontCommitmentHasBeenSet(false),
24     m_totalAmortizedCommitmentHasBeenSet(false)
25 {
26 }
27 
SavingsPlansAmortizedCommitment(JsonView jsonValue)28 SavingsPlansAmortizedCommitment::SavingsPlansAmortizedCommitment(JsonView jsonValue) :
29     m_amortizedRecurringCommitmentHasBeenSet(false),
30     m_amortizedUpfrontCommitmentHasBeenSet(false),
31     m_totalAmortizedCommitmentHasBeenSet(false)
32 {
33   *this = jsonValue;
34 }
35 
operator =(JsonView jsonValue)36 SavingsPlansAmortizedCommitment& SavingsPlansAmortizedCommitment::operator =(JsonView jsonValue)
37 {
38   if(jsonValue.ValueExists("AmortizedRecurringCommitment"))
39   {
40     m_amortizedRecurringCommitment = jsonValue.GetString("AmortizedRecurringCommitment");
41 
42     m_amortizedRecurringCommitmentHasBeenSet = true;
43   }
44 
45   if(jsonValue.ValueExists("AmortizedUpfrontCommitment"))
46   {
47     m_amortizedUpfrontCommitment = jsonValue.GetString("AmortizedUpfrontCommitment");
48 
49     m_amortizedUpfrontCommitmentHasBeenSet = true;
50   }
51 
52   if(jsonValue.ValueExists("TotalAmortizedCommitment"))
53   {
54     m_totalAmortizedCommitment = jsonValue.GetString("TotalAmortizedCommitment");
55 
56     m_totalAmortizedCommitmentHasBeenSet = true;
57   }
58 
59   return *this;
60 }
61 
Jsonize() const62 JsonValue SavingsPlansAmortizedCommitment::Jsonize() const
63 {
64   JsonValue payload;
65 
66   if(m_amortizedRecurringCommitmentHasBeenSet)
67   {
68    payload.WithString("AmortizedRecurringCommitment", m_amortizedRecurringCommitment);
69 
70   }
71 
72   if(m_amortizedUpfrontCommitmentHasBeenSet)
73   {
74    payload.WithString("AmortizedUpfrontCommitment", m_amortizedUpfrontCommitment);
75 
76   }
77 
78   if(m_totalAmortizedCommitmentHasBeenSet)
79   {
80    payload.WithString("TotalAmortizedCommitment", m_totalAmortizedCommitment);
81 
82   }
83 
84   return payload;
85 }
86 
87 } // namespace Model
88 } // namespace CostExplorer
89 } // namespace Aws
90