/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include #include #include #include #include #include #include using namespace Aws::kendra::Model; using namespace Aws::Utils::Json; using namespace Aws::Utils; using namespace Aws; DescribeDataSourceResult::DescribeDataSourceResult() : m_type(DataSourceType::NOT_SET), m_status(DataSourceStatus::NOT_SET) { } DescribeDataSourceResult::DescribeDataSourceResult(const Aws::AmazonWebServiceResult& result) : m_type(DataSourceType::NOT_SET), m_status(DataSourceStatus::NOT_SET) { *this = result; } DescribeDataSourceResult& DescribeDataSourceResult::operator =(const Aws::AmazonWebServiceResult& result) { JsonView jsonValue = result.GetPayload().View(); if(jsonValue.ValueExists("Id")) { m_id = jsonValue.GetString("Id"); } if(jsonValue.ValueExists("IndexId")) { m_indexId = jsonValue.GetString("IndexId"); } if(jsonValue.ValueExists("Name")) { m_name = jsonValue.GetString("Name"); } if(jsonValue.ValueExists("Type")) { m_type = DataSourceTypeMapper::GetDataSourceTypeForName(jsonValue.GetString("Type")); } if(jsonValue.ValueExists("Configuration")) { m_configuration = jsonValue.GetObject("Configuration"); } if(jsonValue.ValueExists("VpcConfiguration")) { m_vpcConfiguration = jsonValue.GetObject("VpcConfiguration"); } if(jsonValue.ValueExists("CreatedAt")) { m_createdAt = jsonValue.GetDouble("CreatedAt"); } if(jsonValue.ValueExists("UpdatedAt")) { m_updatedAt = jsonValue.GetDouble("UpdatedAt"); } if(jsonValue.ValueExists("Description")) { m_description = jsonValue.GetString("Description"); } if(jsonValue.ValueExists("Status")) { m_status = DataSourceStatusMapper::GetDataSourceStatusForName(jsonValue.GetString("Status")); } if(jsonValue.ValueExists("Schedule")) { m_schedule = jsonValue.GetString("Schedule"); } if(jsonValue.ValueExists("RoleArn")) { m_roleArn = jsonValue.GetString("RoleArn"); } if(jsonValue.ValueExists("ErrorMessage")) { m_errorMessage = jsonValue.GetString("ErrorMessage"); } if(jsonValue.ValueExists("LanguageCode")) { m_languageCode = jsonValue.GetString("LanguageCode"); } if(jsonValue.ValueExists("CustomDocumentEnrichmentConfiguration")) { m_customDocumentEnrichmentConfiguration = jsonValue.GetObject("CustomDocumentEnrichmentConfiguration"); } const auto& headers = result.GetHeaderValueCollection(); const auto& requestIdIter = headers.find("x-amzn-requestid"); if(requestIdIter != headers.end()) { m_requestId = requestIdIter->second; } return *this; }