1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/glue/model/LastCrawlInfo.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 Glue
17 {
18 namespace Model
19 {
20 
LastCrawlInfo()21 LastCrawlInfo::LastCrawlInfo() :
22     m_status(LastCrawlStatus::NOT_SET),
23     m_statusHasBeenSet(false),
24     m_errorMessageHasBeenSet(false),
25     m_logGroupHasBeenSet(false),
26     m_logStreamHasBeenSet(false),
27     m_messagePrefixHasBeenSet(false),
28     m_startTimeHasBeenSet(false)
29 {
30 }
31 
LastCrawlInfo(JsonView jsonValue)32 LastCrawlInfo::LastCrawlInfo(JsonView jsonValue) :
33     m_status(LastCrawlStatus::NOT_SET),
34     m_statusHasBeenSet(false),
35     m_errorMessageHasBeenSet(false),
36     m_logGroupHasBeenSet(false),
37     m_logStreamHasBeenSet(false),
38     m_messagePrefixHasBeenSet(false),
39     m_startTimeHasBeenSet(false)
40 {
41   *this = jsonValue;
42 }
43 
operator =(JsonView jsonValue)44 LastCrawlInfo& LastCrawlInfo::operator =(JsonView jsonValue)
45 {
46   if(jsonValue.ValueExists("Status"))
47   {
48     m_status = LastCrawlStatusMapper::GetLastCrawlStatusForName(jsonValue.GetString("Status"));
49 
50     m_statusHasBeenSet = true;
51   }
52 
53   if(jsonValue.ValueExists("ErrorMessage"))
54   {
55     m_errorMessage = jsonValue.GetString("ErrorMessage");
56 
57     m_errorMessageHasBeenSet = true;
58   }
59 
60   if(jsonValue.ValueExists("LogGroup"))
61   {
62     m_logGroup = jsonValue.GetString("LogGroup");
63 
64     m_logGroupHasBeenSet = true;
65   }
66 
67   if(jsonValue.ValueExists("LogStream"))
68   {
69     m_logStream = jsonValue.GetString("LogStream");
70 
71     m_logStreamHasBeenSet = true;
72   }
73 
74   if(jsonValue.ValueExists("MessagePrefix"))
75   {
76     m_messagePrefix = jsonValue.GetString("MessagePrefix");
77 
78     m_messagePrefixHasBeenSet = true;
79   }
80 
81   if(jsonValue.ValueExists("StartTime"))
82   {
83     m_startTime = jsonValue.GetDouble("StartTime");
84 
85     m_startTimeHasBeenSet = true;
86   }
87 
88   return *this;
89 }
90 
Jsonize() const91 JsonValue LastCrawlInfo::Jsonize() const
92 {
93   JsonValue payload;
94 
95   if(m_statusHasBeenSet)
96   {
97    payload.WithString("Status", LastCrawlStatusMapper::GetNameForLastCrawlStatus(m_status));
98   }
99 
100   if(m_errorMessageHasBeenSet)
101   {
102    payload.WithString("ErrorMessage", m_errorMessage);
103 
104   }
105 
106   if(m_logGroupHasBeenSet)
107   {
108    payload.WithString("LogGroup", m_logGroup);
109 
110   }
111 
112   if(m_logStreamHasBeenSet)
113   {
114    payload.WithString("LogStream", m_logStream);
115 
116   }
117 
118   if(m_messagePrefixHasBeenSet)
119   {
120    payload.WithString("MessagePrefix", m_messagePrefix);
121 
122   }
123 
124   if(m_startTimeHasBeenSet)
125   {
126    payload.WithDouble("StartTime", m_startTime.SecondsWithMSPrecision());
127   }
128 
129   return payload;
130 }
131 
132 } // namespace Model
133 } // namespace Glue
134 } // namespace Aws
135