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/InputTransformer.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 
InputTransformer()21 InputTransformer::InputTransformer() :
22     m_inputPathsMapHasBeenSet(false),
23     m_inputTemplateHasBeenSet(false)
24 {
25 }
26 
InputTransformer(JsonView jsonValue)27 InputTransformer::InputTransformer(JsonView jsonValue) :
28     m_inputPathsMapHasBeenSet(false),
29     m_inputTemplateHasBeenSet(false)
30 {
31   *this = jsonValue;
32 }
33 
operator =(JsonView jsonValue)34 InputTransformer& InputTransformer::operator =(JsonView jsonValue)
35 {
36   if(jsonValue.ValueExists("InputPathsMap"))
37   {
38     Aws::Map<Aws::String, JsonView> inputPathsMapJsonMap = jsonValue.GetObject("InputPathsMap").GetAllObjects();
39     for(auto& inputPathsMapItem : inputPathsMapJsonMap)
40     {
41       m_inputPathsMap[inputPathsMapItem.first] = inputPathsMapItem.second.AsString();
42     }
43     m_inputPathsMapHasBeenSet = true;
44   }
45 
46   if(jsonValue.ValueExists("InputTemplate"))
47   {
48     m_inputTemplate = jsonValue.GetString("InputTemplate");
49 
50     m_inputTemplateHasBeenSet = true;
51   }
52 
53   return *this;
54 }
55 
Jsonize() const56 JsonValue InputTransformer::Jsonize() const
57 {
58   JsonValue payload;
59 
60   if(m_inputPathsMapHasBeenSet)
61   {
62    JsonValue inputPathsMapJsonMap;
63    for(auto& inputPathsMapItem : m_inputPathsMap)
64    {
65      inputPathsMapJsonMap.WithString(inputPathsMapItem.first, inputPathsMapItem.second);
66    }
67    payload.WithObject("InputPathsMap", std::move(inputPathsMapJsonMap));
68 
69   }
70 
71   if(m_inputTemplateHasBeenSet)
72   {
73    payload.WithString("InputTemplate", m_inputTemplate);
74 
75   }
76 
77   return payload;
78 }
79 
80 } // namespace Model
81 } // namespace CloudWatchEvents
82 } // namespace Aws
83