1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/waf-regional/model/ByteMatchSetUpdate.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 WAFRegional
17 {
18 namespace Model
19 {
20 
ByteMatchSetUpdate()21 ByteMatchSetUpdate::ByteMatchSetUpdate() :
22     m_action(ChangeAction::NOT_SET),
23     m_actionHasBeenSet(false),
24     m_byteMatchTupleHasBeenSet(false)
25 {
26 }
27 
ByteMatchSetUpdate(JsonView jsonValue)28 ByteMatchSetUpdate::ByteMatchSetUpdate(JsonView jsonValue) :
29     m_action(ChangeAction::NOT_SET),
30     m_actionHasBeenSet(false),
31     m_byteMatchTupleHasBeenSet(false)
32 {
33   *this = jsonValue;
34 }
35 
operator =(JsonView jsonValue)36 ByteMatchSetUpdate& ByteMatchSetUpdate::operator =(JsonView jsonValue)
37 {
38   if(jsonValue.ValueExists("Action"))
39   {
40     m_action = ChangeActionMapper::GetChangeActionForName(jsonValue.GetString("Action"));
41 
42     m_actionHasBeenSet = true;
43   }
44 
45   if(jsonValue.ValueExists("ByteMatchTuple"))
46   {
47     m_byteMatchTuple = jsonValue.GetObject("ByteMatchTuple");
48 
49     m_byteMatchTupleHasBeenSet = true;
50   }
51 
52   return *this;
53 }
54 
Jsonize() const55 JsonValue ByteMatchSetUpdate::Jsonize() const
56 {
57   JsonValue payload;
58 
59   if(m_actionHasBeenSet)
60   {
61    payload.WithString("Action", ChangeActionMapper::GetNameForChangeAction(m_action));
62   }
63 
64   if(m_byteMatchTupleHasBeenSet)
65   {
66    payload.WithObject("ByteMatchTuple", m_byteMatchTuple.Jsonize());
67 
68   }
69 
70   return payload;
71 }
72 
73 } // namespace Model
74 } // namespace WAFRegional
75 } // namespace Aws
76