1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/lakeformation/model/Resource.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 LakeFormation
17 {
18 namespace Model
19 {
20 
Resource()21 Resource::Resource() :
22     m_catalogHasBeenSet(false),
23     m_databaseHasBeenSet(false),
24     m_tableHasBeenSet(false),
25     m_tableWithColumnsHasBeenSet(false),
26     m_dataLocationHasBeenSet(false),
27     m_lFTagHasBeenSet(false),
28     m_lFTagPolicyHasBeenSet(false)
29 {
30 }
31 
Resource(JsonView jsonValue)32 Resource::Resource(JsonView jsonValue) :
33     m_catalogHasBeenSet(false),
34     m_databaseHasBeenSet(false),
35     m_tableHasBeenSet(false),
36     m_tableWithColumnsHasBeenSet(false),
37     m_dataLocationHasBeenSet(false),
38     m_lFTagHasBeenSet(false),
39     m_lFTagPolicyHasBeenSet(false)
40 {
41   *this = jsonValue;
42 }
43 
operator =(JsonView jsonValue)44 Resource& Resource::operator =(JsonView jsonValue)
45 {
46   if(jsonValue.ValueExists("Catalog"))
47   {
48     m_catalog = jsonValue.GetObject("Catalog");
49 
50     m_catalogHasBeenSet = true;
51   }
52 
53   if(jsonValue.ValueExists("Database"))
54   {
55     m_database = jsonValue.GetObject("Database");
56 
57     m_databaseHasBeenSet = true;
58   }
59 
60   if(jsonValue.ValueExists("Table"))
61   {
62     m_table = jsonValue.GetObject("Table");
63 
64     m_tableHasBeenSet = true;
65   }
66 
67   if(jsonValue.ValueExists("TableWithColumns"))
68   {
69     m_tableWithColumns = jsonValue.GetObject("TableWithColumns");
70 
71     m_tableWithColumnsHasBeenSet = true;
72   }
73 
74   if(jsonValue.ValueExists("DataLocation"))
75   {
76     m_dataLocation = jsonValue.GetObject("DataLocation");
77 
78     m_dataLocationHasBeenSet = true;
79   }
80 
81   if(jsonValue.ValueExists("LFTag"))
82   {
83     m_lFTag = jsonValue.GetObject("LFTag");
84 
85     m_lFTagHasBeenSet = true;
86   }
87 
88   if(jsonValue.ValueExists("LFTagPolicy"))
89   {
90     m_lFTagPolicy = jsonValue.GetObject("LFTagPolicy");
91 
92     m_lFTagPolicyHasBeenSet = true;
93   }
94 
95   return *this;
96 }
97 
Jsonize() const98 JsonValue Resource::Jsonize() const
99 {
100   JsonValue payload;
101 
102   if(m_catalogHasBeenSet)
103   {
104    payload.WithObject("Catalog", m_catalog.Jsonize());
105 
106   }
107 
108   if(m_databaseHasBeenSet)
109   {
110    payload.WithObject("Database", m_database.Jsonize());
111 
112   }
113 
114   if(m_tableHasBeenSet)
115   {
116    payload.WithObject("Table", m_table.Jsonize());
117 
118   }
119 
120   if(m_tableWithColumnsHasBeenSet)
121   {
122    payload.WithObject("TableWithColumns", m_tableWithColumns.Jsonize());
123 
124   }
125 
126   if(m_dataLocationHasBeenSet)
127   {
128    payload.WithObject("DataLocation", m_dataLocation.Jsonize());
129 
130   }
131 
132   if(m_lFTagHasBeenSet)
133   {
134    payload.WithObject("LFTag", m_lFTag.Jsonize());
135 
136   }
137 
138   if(m_lFTagPolicyHasBeenSet)
139   {
140    payload.WithObject("LFTagPolicy", m_lFTagPolicy.Jsonize());
141 
142   }
143 
144   return payload;
145 }
146 
147 } // namespace Model
148 } // namespace LakeFormation
149 } // namespace Aws
150