1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/mgn/model/JobLog.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 mgn
17 {
18 namespace Model
19 {
20 
JobLog()21 JobLog::JobLog() :
22     m_event(JobLogEvent::NOT_SET),
23     m_eventHasBeenSet(false),
24     m_eventDataHasBeenSet(false),
25     m_logDateTimeHasBeenSet(false)
26 {
27 }
28 
JobLog(JsonView jsonValue)29 JobLog::JobLog(JsonView jsonValue) :
30     m_event(JobLogEvent::NOT_SET),
31     m_eventHasBeenSet(false),
32     m_eventDataHasBeenSet(false),
33     m_logDateTimeHasBeenSet(false)
34 {
35   *this = jsonValue;
36 }
37 
operator =(JsonView jsonValue)38 JobLog& JobLog::operator =(JsonView jsonValue)
39 {
40   if(jsonValue.ValueExists("event"))
41   {
42     m_event = JobLogEventMapper::GetJobLogEventForName(jsonValue.GetString("event"));
43 
44     m_eventHasBeenSet = true;
45   }
46 
47   if(jsonValue.ValueExists("eventData"))
48   {
49     m_eventData = jsonValue.GetObject("eventData");
50 
51     m_eventDataHasBeenSet = true;
52   }
53 
54   if(jsonValue.ValueExists("logDateTime"))
55   {
56     m_logDateTime = jsonValue.GetString("logDateTime");
57 
58     m_logDateTimeHasBeenSet = true;
59   }
60 
61   return *this;
62 }
63 
Jsonize() const64 JsonValue JobLog::Jsonize() const
65 {
66   JsonValue payload;
67 
68   if(m_eventHasBeenSet)
69   {
70    payload.WithString("event", JobLogEventMapper::GetNameForJobLogEvent(m_event));
71   }
72 
73   if(m_eventDataHasBeenSet)
74   {
75    payload.WithObject("eventData", m_eventData.Jsonize());
76 
77   }
78 
79   if(m_logDateTimeHasBeenSet)
80   {
81    payload.WithString("logDateTime", m_logDateTime);
82 
83   }
84 
85   return payload;
86 }
87 
88 } // namespace Model
89 } // namespace mgn
90 } // namespace Aws
91