1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/route53domains/model/OperationSummary.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 Route53Domains
17 {
18 namespace Model
19 {
20 
OperationSummary()21 OperationSummary::OperationSummary() :
22     m_operationIdHasBeenSet(false),
23     m_status(OperationStatus::NOT_SET),
24     m_statusHasBeenSet(false),
25     m_type(OperationType::NOT_SET),
26     m_typeHasBeenSet(false),
27     m_submittedDateHasBeenSet(false)
28 {
29 }
30 
OperationSummary(JsonView jsonValue)31 OperationSummary::OperationSummary(JsonView jsonValue) :
32     m_operationIdHasBeenSet(false),
33     m_status(OperationStatus::NOT_SET),
34     m_statusHasBeenSet(false),
35     m_type(OperationType::NOT_SET),
36     m_typeHasBeenSet(false),
37     m_submittedDateHasBeenSet(false)
38 {
39   *this = jsonValue;
40 }
41 
operator =(JsonView jsonValue)42 OperationSummary& OperationSummary::operator =(JsonView jsonValue)
43 {
44   if(jsonValue.ValueExists("OperationId"))
45   {
46     m_operationId = jsonValue.GetString("OperationId");
47 
48     m_operationIdHasBeenSet = true;
49   }
50 
51   if(jsonValue.ValueExists("Status"))
52   {
53     m_status = OperationStatusMapper::GetOperationStatusForName(jsonValue.GetString("Status"));
54 
55     m_statusHasBeenSet = true;
56   }
57 
58   if(jsonValue.ValueExists("Type"))
59   {
60     m_type = OperationTypeMapper::GetOperationTypeForName(jsonValue.GetString("Type"));
61 
62     m_typeHasBeenSet = true;
63   }
64 
65   if(jsonValue.ValueExists("SubmittedDate"))
66   {
67     m_submittedDate = jsonValue.GetDouble("SubmittedDate");
68 
69     m_submittedDateHasBeenSet = true;
70   }
71 
72   return *this;
73 }
74 
Jsonize() const75 JsonValue OperationSummary::Jsonize() const
76 {
77   JsonValue payload;
78 
79   if(m_operationIdHasBeenSet)
80   {
81    payload.WithString("OperationId", m_operationId);
82 
83   }
84 
85   if(m_statusHasBeenSet)
86   {
87    payload.WithString("Status", OperationStatusMapper::GetNameForOperationStatus(m_status));
88   }
89 
90   if(m_typeHasBeenSet)
91   {
92    payload.WithString("Type", OperationTypeMapper::GetNameForOperationType(m_type));
93   }
94 
95   if(m_submittedDateHasBeenSet)
96   {
97    payload.WithDouble("SubmittedDate", m_submittedDate.SecondsWithMSPrecision());
98   }
99 
100   return payload;
101 }
102 
103 } // namespace Model
104 } // namespace Route53Domains
105 } // namespace Aws
106