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/ReplayDestination.h>
7 #include <aws/core/utils/json/JsonSerializer.h>
8 
9 #include <utility>
10 
11 using namespace Aws::Utils::Json;
12 using namespace Aws::Utils;
13 
14 namespace Aws
15 {
16 namespace CloudWatchEvents
17 {
18 namespace Model
19 {
20 
ReplayDestination()21 ReplayDestination::ReplayDestination() :
22     m_arnHasBeenSet(false),
23     m_filterArnsHasBeenSet(false)
24 {
25 }
26 
ReplayDestination(JsonView jsonValue)27 ReplayDestination::ReplayDestination(JsonView jsonValue) :
28     m_arnHasBeenSet(false),
29     m_filterArnsHasBeenSet(false)
30 {
31   *this = jsonValue;
32 }
33 
operator =(JsonView jsonValue)34 ReplayDestination& ReplayDestination::operator =(JsonView jsonValue)
35 {
36   if(jsonValue.ValueExists("Arn"))
37   {
38     m_arn = jsonValue.GetString("Arn");
39 
40     m_arnHasBeenSet = true;
41   }
42 
43   if(jsonValue.ValueExists("FilterArns"))
44   {
45     Array<JsonView> filterArnsJsonList = jsonValue.GetArray("FilterArns");
46     for(unsigned filterArnsIndex = 0; filterArnsIndex < filterArnsJsonList.GetLength(); ++filterArnsIndex)
47     {
48       m_filterArns.push_back(filterArnsJsonList[filterArnsIndex].AsString());
49     }
50     m_filterArnsHasBeenSet = true;
51   }
52 
53   return *this;
54 }
55 
Jsonize() const56 JsonValue ReplayDestination::Jsonize() const
57 {
58   JsonValue payload;
59 
60   if(m_arnHasBeenSet)
61   {
62    payload.WithString("Arn", m_arn);
63 
64   }
65 
66   if(m_filterArnsHasBeenSet)
67   {
68    Array<JsonValue> filterArnsJsonList(m_filterArns.size());
69    for(unsigned filterArnsIndex = 0; filterArnsIndex < filterArnsJsonList.GetLength(); ++filterArnsIndex)
70    {
71      filterArnsJsonList[filterArnsIndex].AsString(m_filterArns[filterArnsIndex]);
72    }
73    payload.WithArray("FilterArns", std::move(filterArnsJsonList));
74 
75   }
76 
77   return payload;
78 }
79 
80 } // namespace Model
81 } // namespace CloudWatchEvents
82 } // namespace Aws
83