/** * 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::SWF::Model; using namespace Aws::Utils::Json; using namespace Aws::Utils; using namespace Aws; PollForDecisionTaskResult::PollForDecisionTaskResult() : m_startedEventId(0), m_previousStartedEventId(0) { } PollForDecisionTaskResult::PollForDecisionTaskResult(const Aws::AmazonWebServiceResult& result) : m_startedEventId(0), m_previousStartedEventId(0) { *this = result; } PollForDecisionTaskResult& PollForDecisionTaskResult::operator =(const Aws::AmazonWebServiceResult& result) { JsonView jsonValue = result.GetPayload().View(); if(jsonValue.ValueExists("taskToken")) { m_taskToken = jsonValue.GetString("taskToken"); } if(jsonValue.ValueExists("startedEventId")) { m_startedEventId = jsonValue.GetInt64("startedEventId"); } if(jsonValue.ValueExists("workflowExecution")) { m_workflowExecution = jsonValue.GetObject("workflowExecution"); } if(jsonValue.ValueExists("workflowType")) { m_workflowType = jsonValue.GetObject("workflowType"); } if(jsonValue.ValueExists("events")) { Aws::Utils::Array eventsJsonList = jsonValue.GetArray("events"); for(unsigned eventsIndex = 0; eventsIndex < eventsJsonList.GetLength(); ++eventsIndex) { m_events.push_back(eventsJsonList[eventsIndex].AsObject()); } } if(jsonValue.ValueExists("nextPageToken")) { m_nextPageToken = jsonValue.GetString("nextPageToken"); } if(jsonValue.ValueExists("previousStartedEventId")) { m_previousStartedEventId = jsonValue.GetInt64("previousStartedEventId"); } const auto& headers = result.GetHeaderValueCollection(); const auto& requestIdIter = headers.find("x-amzn-requestid"); if(requestIdIter != headers.end()) { m_requestId = requestIdIter->second; } return *this; }