1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/cloudhsmv2/model/DescribeBackupsRequest.h>
7 #include <aws/core/utils/json/JsonSerializer.h>
8 
9 #include <utility>
10 
11 using namespace Aws::CloudHSMV2::Model;
12 using namespace Aws::Utils::Json;
13 using namespace Aws::Utils;
14 
DescribeBackupsRequest()15 DescribeBackupsRequest::DescribeBackupsRequest() :
16     m_nextTokenHasBeenSet(false),
17     m_maxResults(0),
18     m_maxResultsHasBeenSet(false),
19     m_filtersHasBeenSet(false),
20     m_sortAscending(false),
21     m_sortAscendingHasBeenSet(false)
22 {
23 }
24 
SerializePayload() const25 Aws::String DescribeBackupsRequest::SerializePayload() const
26 {
27   JsonValue payload;
28 
29   if(m_nextTokenHasBeenSet)
30   {
31    payload.WithString("NextToken", m_nextToken);
32 
33   }
34 
35   if(m_maxResultsHasBeenSet)
36   {
37    payload.WithInteger("MaxResults", m_maxResults);
38 
39   }
40 
41   if(m_filtersHasBeenSet)
42   {
43    JsonValue filtersJsonMap;
44    for(auto& filtersItem : m_filters)
45    {
46      Array<JsonValue> stringsJsonList(filtersItem.second.size());
47      for(unsigned stringsIndex = 0; stringsIndex < stringsJsonList.GetLength(); ++stringsIndex)
48      {
49        stringsJsonList[stringsIndex].AsString(filtersItem.second[stringsIndex]);
50      }
51      filtersJsonMap.WithArray(filtersItem.first, std::move(stringsJsonList));
52    }
53    payload.WithObject("Filters", std::move(filtersJsonMap));
54 
55   }
56 
57   if(m_sortAscendingHasBeenSet)
58   {
59    payload.WithBool("SortAscending", m_sortAscending);
60 
61   }
62 
63   return payload.View().WriteReadable();
64 }
65 
GetRequestSpecificHeaders() const66 Aws::Http::HeaderValueCollection DescribeBackupsRequest::GetRequestSpecificHeaders() const
67 {
68   Aws::Http::HeaderValueCollection headers;
69   headers.insert(Aws::Http::HeaderValuePair("X-Amz-Target", "BaldrApiService.DescribeBackups"));
70   return headers;
71 
72 }
73 
74 
75 
76 
77