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/CatalogTarget.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 CatalogTarget()21CatalogTarget::CatalogTarget() : 22 m_databaseNameHasBeenSet(false), 23 m_tablesHasBeenSet(false) 24 { 25 } 26 CatalogTarget(JsonView jsonValue)27CatalogTarget::CatalogTarget(JsonView jsonValue) : 28 m_databaseNameHasBeenSet(false), 29 m_tablesHasBeenSet(false) 30 { 31 *this = jsonValue; 32 } 33 operator =(JsonView jsonValue)34CatalogTarget& CatalogTarget::operator =(JsonView jsonValue) 35 { 36 if(jsonValue.ValueExists("DatabaseName")) 37 { 38 m_databaseName = jsonValue.GetString("DatabaseName"); 39 40 m_databaseNameHasBeenSet = true; 41 } 42 43 if(jsonValue.ValueExists("Tables")) 44 { 45 Array<JsonView> tablesJsonList = jsonValue.GetArray("Tables"); 46 for(unsigned tablesIndex = 0; tablesIndex < tablesJsonList.GetLength(); ++tablesIndex) 47 { 48 m_tables.push_back(tablesJsonList[tablesIndex].AsString()); 49 } 50 m_tablesHasBeenSet = true; 51 } 52 53 return *this; 54 } 55 Jsonize() const56JsonValue CatalogTarget::Jsonize() const 57 { 58 JsonValue payload; 59 60 if(m_databaseNameHasBeenSet) 61 { 62 payload.WithString("DatabaseName", m_databaseName); 63 64 } 65 66 if(m_tablesHasBeenSet) 67 { 68 Array<JsonValue> tablesJsonList(m_tables.size()); 69 for(unsigned tablesIndex = 0; tablesIndex < tablesJsonList.GetLength(); ++tablesIndex) 70 { 71 tablesJsonList[tablesIndex].AsString(m_tables[tablesIndex]); 72 } 73 payload.WithArray("Tables", std::move(tablesJsonList)); 74 75 } 76 77 return payload; 78 } 79 80 } // namespace Model 81 } // namespace Glue 82 } // namespace Aws 83