1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/iotsitewise/model/ConfigurationErrorDetails.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 IoTSiteWise
17 {
18 namespace Model
19 {
20 
ConfigurationErrorDetails()21 ConfigurationErrorDetails::ConfigurationErrorDetails() :
22     m_code(ErrorCode::NOT_SET),
23     m_codeHasBeenSet(false),
24     m_messageHasBeenSet(false)
25 {
26 }
27 
ConfigurationErrorDetails(JsonView jsonValue)28 ConfigurationErrorDetails::ConfigurationErrorDetails(JsonView jsonValue) :
29     m_code(ErrorCode::NOT_SET),
30     m_codeHasBeenSet(false),
31     m_messageHasBeenSet(false)
32 {
33   *this = jsonValue;
34 }
35 
operator =(JsonView jsonValue)36 ConfigurationErrorDetails& ConfigurationErrorDetails::operator =(JsonView jsonValue)
37 {
38   if(jsonValue.ValueExists("code"))
39   {
40     m_code = ErrorCodeMapper::GetErrorCodeForName(jsonValue.GetString("code"));
41 
42     m_codeHasBeenSet = true;
43   }
44 
45   if(jsonValue.ValueExists("message"))
46   {
47     m_message = jsonValue.GetString("message");
48 
49     m_messageHasBeenSet = true;
50   }
51 
52   return *this;
53 }
54 
Jsonize() const55 JsonValue ConfigurationErrorDetails::Jsonize() const
56 {
57   JsonValue payload;
58 
59   if(m_codeHasBeenSet)
60   {
61    payload.WithString("code", ErrorCodeMapper::GetNameForErrorCode(m_code));
62   }
63 
64   if(m_messageHasBeenSet)
65   {
66    payload.WithString("message", m_message);
67 
68   }
69 
70   return payload;
71 }
72 
73 } // namespace Model
74 } // namespace IoTSiteWise
75 } // namespace Aws
76