1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/glue/model/GetColumnStatisticsForPartitionRequest.h>
7 #include <aws/core/utils/json/JsonSerializer.h>
8 
9 #include <utility>
10 
11 using namespace Aws::Glue::Model;
12 using namespace Aws::Utils::Json;
13 using namespace Aws::Utils;
14 
GetColumnStatisticsForPartitionRequest()15 GetColumnStatisticsForPartitionRequest::GetColumnStatisticsForPartitionRequest() :
16     m_catalogIdHasBeenSet(false),
17     m_databaseNameHasBeenSet(false),
18     m_tableNameHasBeenSet(false),
19     m_partitionValuesHasBeenSet(false),
20     m_columnNamesHasBeenSet(false)
21 {
22 }
23 
SerializePayload() const24 Aws::String GetColumnStatisticsForPartitionRequest::SerializePayload() const
25 {
26   JsonValue payload;
27 
28   if(m_catalogIdHasBeenSet)
29   {
30    payload.WithString("CatalogId", m_catalogId);
31 
32   }
33 
34   if(m_databaseNameHasBeenSet)
35   {
36    payload.WithString("DatabaseName", m_databaseName);
37 
38   }
39 
40   if(m_tableNameHasBeenSet)
41   {
42    payload.WithString("TableName", m_tableName);
43 
44   }
45 
46   if(m_partitionValuesHasBeenSet)
47   {
48    Array<JsonValue> partitionValuesJsonList(m_partitionValues.size());
49    for(unsigned partitionValuesIndex = 0; partitionValuesIndex < partitionValuesJsonList.GetLength(); ++partitionValuesIndex)
50    {
51      partitionValuesJsonList[partitionValuesIndex].AsString(m_partitionValues[partitionValuesIndex]);
52    }
53    payload.WithArray("PartitionValues", std::move(partitionValuesJsonList));
54 
55   }
56 
57   if(m_columnNamesHasBeenSet)
58   {
59    Array<JsonValue> columnNamesJsonList(m_columnNames.size());
60    for(unsigned columnNamesIndex = 0; columnNamesIndex < columnNamesJsonList.GetLength(); ++columnNamesIndex)
61    {
62      columnNamesJsonList[columnNamesIndex].AsString(m_columnNames[columnNamesIndex]);
63    }
64    payload.WithArray("ColumnNames", std::move(columnNamesJsonList));
65 
66   }
67 
68   return payload.View().WriteReadable();
69 }
70 
GetRequestSpecificHeaders() const71 Aws::Http::HeaderValueCollection GetColumnStatisticsForPartitionRequest::GetRequestSpecificHeaders() const
72 {
73   Aws::Http::HeaderValueCollection headers;
74   headers.insert(Aws::Http::HeaderValuePair("X-Amz-Target", "AWSGlue.GetColumnStatisticsForPartition"));
75   return headers;
76 
77 }
78 
79 
80 
81 
82