1 /** 2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 * SPDX-License-Identifier: Apache-2.0. 4 */ 5 6 #include <aws/kendra/model/DocumentInfo.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 kendra 17 { 18 namespace Model 19 { 20 DocumentInfo()21DocumentInfo::DocumentInfo() : 22 m_documentIdHasBeenSet(false), 23 m_attributesHasBeenSet(false) 24 { 25 } 26 DocumentInfo(JsonView jsonValue)27DocumentInfo::DocumentInfo(JsonView jsonValue) : 28 m_documentIdHasBeenSet(false), 29 m_attributesHasBeenSet(false) 30 { 31 *this = jsonValue; 32 } 33 operator =(JsonView jsonValue)34DocumentInfo& DocumentInfo::operator =(JsonView jsonValue) 35 { 36 if(jsonValue.ValueExists("DocumentId")) 37 { 38 m_documentId = jsonValue.GetString("DocumentId"); 39 40 m_documentIdHasBeenSet = true; 41 } 42 43 if(jsonValue.ValueExists("Attributes")) 44 { 45 Array<JsonView> attributesJsonList = jsonValue.GetArray("Attributes"); 46 for(unsigned attributesIndex = 0; attributesIndex < attributesJsonList.GetLength(); ++attributesIndex) 47 { 48 m_attributes.push_back(attributesJsonList[attributesIndex].AsObject()); 49 } 50 m_attributesHasBeenSet = true; 51 } 52 53 return *this; 54 } 55 Jsonize() const56JsonValue DocumentInfo::Jsonize() const 57 { 58 JsonValue payload; 59 60 if(m_documentIdHasBeenSet) 61 { 62 payload.WithString("DocumentId", m_documentId); 63 64 } 65 66 if(m_attributesHasBeenSet) 67 { 68 Array<JsonValue> attributesJsonList(m_attributes.size()); 69 for(unsigned attributesIndex = 0; attributesIndex < attributesJsonList.GetLength(); ++attributesIndex) 70 { 71 attributesJsonList[attributesIndex].AsObject(m_attributes[attributesIndex].Jsonize()); 72 } 73 payload.WithArray("Attributes", std::move(attributesJsonList)); 74 75 } 76 77 return payload; 78 } 79 80 } // namespace Model 81 } // namespace kendra 82 } // namespace Aws 83