/** * 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::ResourceExplorer2::Model; using namespace Aws::Utils::Json; using namespace Aws::Utils; using namespace Aws; GetIndexResult::GetIndexResult() : m_state(IndexState::NOT_SET), m_type(IndexType::NOT_SET) { } GetIndexResult::GetIndexResult(const Aws::AmazonWebServiceResult& result) : m_state(IndexState::NOT_SET), m_type(IndexType::NOT_SET) { *this = result; } GetIndexResult& GetIndexResult::operator =(const Aws::AmazonWebServiceResult& result) { JsonView jsonValue = result.GetPayload().View(); if(jsonValue.ValueExists("Arn")) { m_arn = jsonValue.GetString("Arn"); } if(jsonValue.ValueExists("CreatedAt")) { m_createdAt = jsonValue.GetString("CreatedAt"); } if(jsonValue.ValueExists("LastUpdatedAt")) { m_lastUpdatedAt = jsonValue.GetString("LastUpdatedAt"); } if(jsonValue.ValueExists("ReplicatingFrom")) { Aws::Utils::Array replicatingFromJsonList = jsonValue.GetArray("ReplicatingFrom"); for(unsigned replicatingFromIndex = 0; replicatingFromIndex < replicatingFromJsonList.GetLength(); ++replicatingFromIndex) { m_replicatingFrom.push_back(replicatingFromJsonList[replicatingFromIndex].AsString()); } } if(jsonValue.ValueExists("ReplicatingTo")) { Aws::Utils::Array replicatingToJsonList = jsonValue.GetArray("ReplicatingTo"); for(unsigned replicatingToIndex = 0; replicatingToIndex < replicatingToJsonList.GetLength(); ++replicatingToIndex) { m_replicatingTo.push_back(replicatingToJsonList[replicatingToIndex].AsString()); } } if(jsonValue.ValueExists("State")) { m_state = IndexStateMapper::GetIndexStateForName(jsonValue.GetString("State")); } if(jsonValue.ValueExists("Tags")) { Aws::Map tagsJsonMap = jsonValue.GetObject("Tags").GetAllObjects(); for(auto& tagsItem : tagsJsonMap) { m_tags[tagsItem.first] = tagsItem.second.AsString(); } } if(jsonValue.ValueExists("Type")) { m_type = IndexTypeMapper::GetIndexTypeForName(jsonValue.GetString("Type")); } const auto& headers = result.GetHeaderValueCollection(); const auto& requestIdIter = headers.find("x-amzn-requestid"); if(requestIdIter != headers.end()) { m_requestId = requestIdIter->second; } return *this; }