/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include #include #include using namespace Aws::Utils::Json; using namespace Aws::Utils; namespace Aws { namespace Glue { namespace Model { S3DeltaCatalogTarget::S3DeltaCatalogTarget() : m_nameHasBeenSet(false), m_inputsHasBeenSet(false), m_partitionKeysHasBeenSet(false), m_tableHasBeenSet(false), m_databaseHasBeenSet(false), m_additionalOptionsHasBeenSet(false), m_schemaChangePolicyHasBeenSet(false) { } S3DeltaCatalogTarget::S3DeltaCatalogTarget(JsonView jsonValue) : m_nameHasBeenSet(false), m_inputsHasBeenSet(false), m_partitionKeysHasBeenSet(false), m_tableHasBeenSet(false), m_databaseHasBeenSet(false), m_additionalOptionsHasBeenSet(false), m_schemaChangePolicyHasBeenSet(false) { *this = jsonValue; } S3DeltaCatalogTarget& S3DeltaCatalogTarget::operator =(JsonView jsonValue) { if(jsonValue.ValueExists("Name")) { m_name = jsonValue.GetString("Name"); m_nameHasBeenSet = true; } if(jsonValue.ValueExists("Inputs")) { Aws::Utils::Array inputsJsonList = jsonValue.GetArray("Inputs"); for(unsigned inputsIndex = 0; inputsIndex < inputsJsonList.GetLength(); ++inputsIndex) { m_inputs.push_back(inputsJsonList[inputsIndex].AsString()); } m_inputsHasBeenSet = true; } if(jsonValue.ValueExists("PartitionKeys")) { Aws::Utils::Array partitionKeysJsonList = jsonValue.GetArray("PartitionKeys"); for(unsigned partitionKeysIndex = 0; partitionKeysIndex < partitionKeysJsonList.GetLength(); ++partitionKeysIndex) { Aws::Utils::Array enclosedInStringPropertiesJsonList = partitionKeysJsonList[partitionKeysIndex].AsArray(); Aws::Vector enclosedInStringPropertiesList; enclosedInStringPropertiesList.reserve((size_t)enclosedInStringPropertiesJsonList.GetLength()); for(unsigned enclosedInStringPropertiesIndex = 0; enclosedInStringPropertiesIndex < enclosedInStringPropertiesJsonList.GetLength(); ++enclosedInStringPropertiesIndex) { enclosedInStringPropertiesList.push_back(enclosedInStringPropertiesJsonList[enclosedInStringPropertiesIndex].AsString()); } m_partitionKeys.push_back(std::move(enclosedInStringPropertiesList)); } m_partitionKeysHasBeenSet = true; } if(jsonValue.ValueExists("Table")) { m_table = jsonValue.GetString("Table"); m_tableHasBeenSet = true; } if(jsonValue.ValueExists("Database")) { m_database = jsonValue.GetString("Database"); m_databaseHasBeenSet = true; } if(jsonValue.ValueExists("AdditionalOptions")) { Aws::Map additionalOptionsJsonMap = jsonValue.GetObject("AdditionalOptions").GetAllObjects(); for(auto& additionalOptionsItem : additionalOptionsJsonMap) { m_additionalOptions[additionalOptionsItem.first] = additionalOptionsItem.second.AsString(); } m_additionalOptionsHasBeenSet = true; } if(jsonValue.ValueExists("SchemaChangePolicy")) { m_schemaChangePolicy = jsonValue.GetObject("SchemaChangePolicy"); m_schemaChangePolicyHasBeenSet = true; } return *this; } JsonValue S3DeltaCatalogTarget::Jsonize() const { JsonValue payload; if(m_nameHasBeenSet) { payload.WithString("Name", m_name); } if(m_inputsHasBeenSet) { Aws::Utils::Array inputsJsonList(m_inputs.size()); for(unsigned inputsIndex = 0; inputsIndex < inputsJsonList.GetLength(); ++inputsIndex) { inputsJsonList[inputsIndex].AsString(m_inputs[inputsIndex]); } payload.WithArray("Inputs", std::move(inputsJsonList)); } if(m_partitionKeysHasBeenSet) { Aws::Utils::Array partitionKeysJsonList(m_partitionKeys.size()); for(unsigned partitionKeysIndex = 0; partitionKeysIndex < partitionKeysJsonList.GetLength(); ++partitionKeysIndex) { Aws::Utils::Array enclosedInStringPropertiesJsonList(m_partitionKeys[partitionKeysIndex].size()); for(unsigned enclosedInStringPropertiesIndex = 0; enclosedInStringPropertiesIndex < enclosedInStringPropertiesJsonList.GetLength(); ++enclosedInStringPropertiesIndex) { enclosedInStringPropertiesJsonList[enclosedInStringPropertiesIndex].AsString(m_partitionKeys[partitionKeysIndex][enclosedInStringPropertiesIndex]); } partitionKeysJsonList[partitionKeysIndex].AsArray(std::move(enclosedInStringPropertiesJsonList)); } payload.WithArray("PartitionKeys", std::move(partitionKeysJsonList)); } if(m_tableHasBeenSet) { payload.WithString("Table", m_table); } if(m_databaseHasBeenSet) { payload.WithString("Database", m_database); } if(m_additionalOptionsHasBeenSet) { JsonValue additionalOptionsJsonMap; for(auto& additionalOptionsItem : m_additionalOptions) { additionalOptionsJsonMap.WithString(additionalOptionsItem.first, additionalOptionsItem.second); } payload.WithObject("AdditionalOptions", std::move(additionalOptionsJsonMap)); } if(m_schemaChangePolicyHasBeenSet) { payload.WithObject("SchemaChangePolicy", m_schemaChangePolicy.Jsonize()); } return payload; } } // namespace Model } // namespace Glue } // namespace Aws