1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/wafv2/model/UpdateRuleGroupRequest.h>
7 #include <aws/core/utils/json/JsonSerializer.h>
8 
9 #include <utility>
10 
11 using namespace Aws::WAFV2::Model;
12 using namespace Aws::Utils::Json;
13 using namespace Aws::Utils;
14 
UpdateRuleGroupRequest()15 UpdateRuleGroupRequest::UpdateRuleGroupRequest() :
16     m_nameHasBeenSet(false),
17     m_scope(Scope::NOT_SET),
18     m_scopeHasBeenSet(false),
19     m_idHasBeenSet(false),
20     m_descriptionHasBeenSet(false),
21     m_rulesHasBeenSet(false),
22     m_visibilityConfigHasBeenSet(false),
23     m_lockTokenHasBeenSet(false),
24     m_customResponseBodiesHasBeenSet(false)
25 {
26 }
27 
SerializePayload() const28 Aws::String UpdateRuleGroupRequest::SerializePayload() const
29 {
30   JsonValue payload;
31 
32   if(m_nameHasBeenSet)
33   {
34    payload.WithString("Name", m_name);
35 
36   }
37 
38   if(m_scopeHasBeenSet)
39   {
40    payload.WithString("Scope", ScopeMapper::GetNameForScope(m_scope));
41   }
42 
43   if(m_idHasBeenSet)
44   {
45    payload.WithString("Id", m_id);
46 
47   }
48 
49   if(m_descriptionHasBeenSet)
50   {
51    payload.WithString("Description", m_description);
52 
53   }
54 
55   if(m_rulesHasBeenSet)
56   {
57    Array<JsonValue> rulesJsonList(m_rules.size());
58    for(unsigned rulesIndex = 0; rulesIndex < rulesJsonList.GetLength(); ++rulesIndex)
59    {
60      rulesJsonList[rulesIndex].AsObject(m_rules[rulesIndex].Jsonize());
61    }
62    payload.WithArray("Rules", std::move(rulesJsonList));
63 
64   }
65 
66   if(m_visibilityConfigHasBeenSet)
67   {
68    payload.WithObject("VisibilityConfig", m_visibilityConfig.Jsonize());
69 
70   }
71 
72   if(m_lockTokenHasBeenSet)
73   {
74    payload.WithString("LockToken", m_lockToken);
75 
76   }
77 
78   if(m_customResponseBodiesHasBeenSet)
79   {
80    JsonValue customResponseBodiesJsonMap;
81    for(auto& customResponseBodiesItem : m_customResponseBodies)
82    {
83      customResponseBodiesJsonMap.WithObject(customResponseBodiesItem.first, customResponseBodiesItem.second.Jsonize());
84    }
85    payload.WithObject("CustomResponseBodies", std::move(customResponseBodiesJsonMap));
86 
87   }
88 
89   return payload.View().WriteReadable();
90 }
91 
GetRequestSpecificHeaders() const92 Aws::Http::HeaderValueCollection UpdateRuleGroupRequest::GetRequestSpecificHeaders() const
93 {
94   Aws::Http::HeaderValueCollection headers;
95   headers.insert(Aws::Http::HeaderValuePair("X-Amz-Target", "AWSWAF_20190729.UpdateRuleGroup"));
96   return headers;
97 
98 }
99 
100 
101 
102 
103