1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/resource-groups/model/CreateGroupRequest.h>
7 #include <aws/core/utils/json/JsonSerializer.h>
8 
9 #include <utility>
10 
11 using namespace Aws::ResourceGroups::Model;
12 using namespace Aws::Utils::Json;
13 using namespace Aws::Utils;
14 
CreateGroupRequest()15 CreateGroupRequest::CreateGroupRequest() :
16     m_nameHasBeenSet(false),
17     m_descriptionHasBeenSet(false),
18     m_resourceQueryHasBeenSet(false),
19     m_tagsHasBeenSet(false),
20     m_configurationHasBeenSet(false)
21 {
22 }
23 
SerializePayload() const24 Aws::String CreateGroupRequest::SerializePayload() const
25 {
26   JsonValue payload;
27 
28   if(m_nameHasBeenSet)
29   {
30    payload.WithString("Name", m_name);
31 
32   }
33 
34   if(m_descriptionHasBeenSet)
35   {
36    payload.WithString("Description", m_description);
37 
38   }
39 
40   if(m_resourceQueryHasBeenSet)
41   {
42    payload.WithObject("ResourceQuery", m_resourceQuery.Jsonize());
43 
44   }
45 
46   if(m_tagsHasBeenSet)
47   {
48    JsonValue tagsJsonMap;
49    for(auto& tagsItem : m_tags)
50    {
51      tagsJsonMap.WithString(tagsItem.first, tagsItem.second);
52    }
53    payload.WithObject("Tags", std::move(tagsJsonMap));
54 
55   }
56 
57   if(m_configurationHasBeenSet)
58   {
59    Array<JsonValue> configurationJsonList(m_configuration.size());
60    for(unsigned configurationIndex = 0; configurationIndex < configurationJsonList.GetLength(); ++configurationIndex)
61    {
62      configurationJsonList[configurationIndex].AsObject(m_configuration[configurationIndex].Jsonize());
63    }
64    payload.WithArray("Configuration", std::move(configurationJsonList));
65 
66   }
67 
68   return payload.View().WriteReadable();
69 }
70 
71 
72 
73 
74