1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/datapipeline/model/ParameterObject.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 DataPipeline
17 {
18 namespace Model
19 {
20 
ParameterObject()21 ParameterObject::ParameterObject() :
22     m_idHasBeenSet(false),
23     m_attributesHasBeenSet(false)
24 {
25 }
26 
ParameterObject(JsonView jsonValue)27 ParameterObject::ParameterObject(JsonView jsonValue) :
28     m_idHasBeenSet(false),
29     m_attributesHasBeenSet(false)
30 {
31   *this = jsonValue;
32 }
33 
operator =(JsonView jsonValue)34 ParameterObject& ParameterObject::operator =(JsonView jsonValue)
35 {
36   if(jsonValue.ValueExists("id"))
37   {
38     m_id = jsonValue.GetString("id");
39 
40     m_idHasBeenSet = true;
41   }
42 
43   if(jsonValue.ValueExists("attributes"))
44   {
45     Array<JsonView> attributesJsonList = jsonValue.GetArray("attributes");
46     for(unsigned attributesIndex = 0; attributesIndex < attributesJsonList.GetLength(); ++attributesIndex)
47     {
48       m_attributes.push_back(attributesJsonList[attributesIndex].AsObject());
49     }
50     m_attributesHasBeenSet = true;
51   }
52 
53   return *this;
54 }
55 
Jsonize() const56 JsonValue ParameterObject::Jsonize() const
57 {
58   JsonValue payload;
59 
60   if(m_idHasBeenSet)
61   {
62    payload.WithString("id", m_id);
63 
64   }
65 
66   if(m_attributesHasBeenSet)
67   {
68    Array<JsonValue> attributesJsonList(m_attributes.size());
69    for(unsigned attributesIndex = 0; attributesIndex < attributesJsonList.GetLength(); ++attributesIndex)
70    {
71      attributesJsonList[attributesIndex].AsObject(m_attributes[attributesIndex].Jsonize());
72    }
73    payload.WithArray("attributes", std::move(attributesJsonList));
74 
75   }
76 
77   return payload;
78 }
79 
80 } // namespace Model
81 } // namespace DataPipeline
82 } // namespace Aws
83