/** * 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::LexModelsV2::Model; using namespace Aws::Utils::Json; using namespace Aws::Utils; using namespace Aws; CreateBotResult::CreateBotResult() : m_idleSessionTTLInSeconds(0), m_botStatus(BotStatus::NOT_SET), m_botType(BotType::NOT_SET) { } CreateBotResult::CreateBotResult(const Aws::AmazonWebServiceResult& result) : m_idleSessionTTLInSeconds(0), m_botStatus(BotStatus::NOT_SET), m_botType(BotType::NOT_SET) { *this = result; } CreateBotResult& CreateBotResult::operator =(const Aws::AmazonWebServiceResult& result) { JsonView jsonValue = result.GetPayload().View(); if(jsonValue.ValueExists("botId")) { m_botId = jsonValue.GetString("botId"); } if(jsonValue.ValueExists("botName")) { m_botName = jsonValue.GetString("botName"); } if(jsonValue.ValueExists("description")) { m_description = jsonValue.GetString("description"); } if(jsonValue.ValueExists("roleArn")) { m_roleArn = jsonValue.GetString("roleArn"); } if(jsonValue.ValueExists("dataPrivacy")) { m_dataPrivacy = jsonValue.GetObject("dataPrivacy"); } if(jsonValue.ValueExists("idleSessionTTLInSeconds")) { m_idleSessionTTLInSeconds = jsonValue.GetInteger("idleSessionTTLInSeconds"); } if(jsonValue.ValueExists("botStatus")) { m_botStatus = BotStatusMapper::GetBotStatusForName(jsonValue.GetString("botStatus")); } if(jsonValue.ValueExists("creationDateTime")) { m_creationDateTime = jsonValue.GetDouble("creationDateTime"); } if(jsonValue.ValueExists("botTags")) { Aws::Map botTagsJsonMap = jsonValue.GetObject("botTags").GetAllObjects(); for(auto& botTagsItem : botTagsJsonMap) { m_botTags[botTagsItem.first] = botTagsItem.second.AsString(); } } if(jsonValue.ValueExists("testBotAliasTags")) { Aws::Map testBotAliasTagsJsonMap = jsonValue.GetObject("testBotAliasTags").GetAllObjects(); for(auto& testBotAliasTagsItem : testBotAliasTagsJsonMap) { m_testBotAliasTags[testBotAliasTagsItem.first] = testBotAliasTagsItem.second.AsString(); } } if(jsonValue.ValueExists("botType")) { m_botType = BotTypeMapper::GetBotTypeForName(jsonValue.GetString("botType")); } if(jsonValue.ValueExists("botMembers")) { Aws::Utils::Array botMembersJsonList = jsonValue.GetArray("botMembers"); for(unsigned botMembersIndex = 0; botMembersIndex < botMembersJsonList.GetLength(); ++botMembersIndex) { m_botMembers.push_back(botMembersJsonList[botMembersIndex].AsObject()); } } const auto& headers = result.GetHeaderValueCollection(); const auto& requestIdIter = headers.find("x-amzn-requestid"); if(requestIdIter != headers.end()) { m_requestId = requestIdIter->second; } return *this; }