1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/chime-sdk-messaging/model/ChannelFlowSummary.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 ChimeSDKMessaging
17 {
18 namespace Model
19 {
20 
ChannelFlowSummary()21 ChannelFlowSummary::ChannelFlowSummary() :
22     m_channelFlowArnHasBeenSet(false),
23     m_nameHasBeenSet(false),
24     m_processorsHasBeenSet(false)
25 {
26 }
27 
ChannelFlowSummary(JsonView jsonValue)28 ChannelFlowSummary::ChannelFlowSummary(JsonView jsonValue) :
29     m_channelFlowArnHasBeenSet(false),
30     m_nameHasBeenSet(false),
31     m_processorsHasBeenSet(false)
32 {
33   *this = jsonValue;
34 }
35 
operator =(JsonView jsonValue)36 ChannelFlowSummary& ChannelFlowSummary::operator =(JsonView jsonValue)
37 {
38   if(jsonValue.ValueExists("ChannelFlowArn"))
39   {
40     m_channelFlowArn = jsonValue.GetString("ChannelFlowArn");
41 
42     m_channelFlowArnHasBeenSet = true;
43   }
44 
45   if(jsonValue.ValueExists("Name"))
46   {
47     m_name = jsonValue.GetString("Name");
48 
49     m_nameHasBeenSet = true;
50   }
51 
52   if(jsonValue.ValueExists("Processors"))
53   {
54     Array<JsonView> processorsJsonList = jsonValue.GetArray("Processors");
55     for(unsigned processorsIndex = 0; processorsIndex < processorsJsonList.GetLength(); ++processorsIndex)
56     {
57       m_processors.push_back(processorsJsonList[processorsIndex].AsObject());
58     }
59     m_processorsHasBeenSet = true;
60   }
61 
62   return *this;
63 }
64 
Jsonize() const65 JsonValue ChannelFlowSummary::Jsonize() const
66 {
67   JsonValue payload;
68 
69   if(m_channelFlowArnHasBeenSet)
70   {
71    payload.WithString("ChannelFlowArn", m_channelFlowArn);
72 
73   }
74 
75   if(m_nameHasBeenSet)
76   {
77    payload.WithString("Name", m_name);
78 
79   }
80 
81   if(m_processorsHasBeenSet)
82   {
83    Array<JsonValue> processorsJsonList(m_processors.size());
84    for(unsigned processorsIndex = 0; processorsIndex < processorsJsonList.GetLength(); ++processorsIndex)
85    {
86      processorsJsonList[processorsIndex].AsObject(m_processors[processorsIndex].Jsonize());
87    }
88    payload.WithArray("Processors", std::move(processorsJsonList));
89 
90   }
91 
92   return payload;
93 }
94 
95 } // namespace Model
96 } // namespace ChimeSDKMessaging
97 } // namespace Aws
98