1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/events/model/PutTargetsResult.h>
7 #include <aws/core/utils/json/JsonSerializer.h>
8 #include <aws/core/AmazonWebServiceResult.h>
9 #include <aws/core/utils/StringUtils.h>
10 #include <aws/core/utils/UnreferencedParam.h>
11 
12 #include <utility>
13 
14 using namespace Aws::CloudWatchEvents::Model;
15 using namespace Aws::Utils::Json;
16 using namespace Aws::Utils;
17 using namespace Aws;
18 
PutTargetsResult()19 PutTargetsResult::PutTargetsResult() :
20     m_failedEntryCount(0)
21 {
22 }
23 
PutTargetsResult(const Aws::AmazonWebServiceResult<JsonValue> & result)24 PutTargetsResult::PutTargetsResult(const Aws::AmazonWebServiceResult<JsonValue>& result) :
25     m_failedEntryCount(0)
26 {
27   *this = result;
28 }
29 
operator =(const Aws::AmazonWebServiceResult<JsonValue> & result)30 PutTargetsResult& PutTargetsResult::operator =(const Aws::AmazonWebServiceResult<JsonValue>& result)
31 {
32   JsonView jsonValue = result.GetPayload().View();
33   if(jsonValue.ValueExists("FailedEntryCount"))
34   {
35     m_failedEntryCount = jsonValue.GetInteger("FailedEntryCount");
36 
37   }
38 
39   if(jsonValue.ValueExists("FailedEntries"))
40   {
41     Array<JsonView> failedEntriesJsonList = jsonValue.GetArray("FailedEntries");
42     for(unsigned failedEntriesIndex = 0; failedEntriesIndex < failedEntriesJsonList.GetLength(); ++failedEntriesIndex)
43     {
44       m_failedEntries.push_back(failedEntriesJsonList[failedEntriesIndex].AsObject());
45     }
46   }
47 
48 
49 
50   return *this;
51 }
52