This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
pxz-hos-client-cpp-module/support/aws-sdk-cpp-master/aws-cpp-sdk-guardduty/source/model/UsageCriteria.cpp

114 lines
3.1 KiB
C++

/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/guardduty/model/UsageCriteria.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <utility>
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
namespace Aws
{
namespace GuardDuty
{
namespace Model
{
UsageCriteria::UsageCriteria() :
m_accountIdsHasBeenSet(false),
m_dataSourcesHasBeenSet(false),
m_resourcesHasBeenSet(false)
{
}
UsageCriteria::UsageCriteria(JsonView jsonValue) :
m_accountIdsHasBeenSet(false),
m_dataSourcesHasBeenSet(false),
m_resourcesHasBeenSet(false)
{
*this = jsonValue;
}
UsageCriteria& UsageCriteria::operator =(JsonView jsonValue)
{
if(jsonValue.ValueExists("accountIds"))
{
Array<JsonView> accountIdsJsonList = jsonValue.GetArray("accountIds");
for(unsigned accountIdsIndex = 0; accountIdsIndex < accountIdsJsonList.GetLength(); ++accountIdsIndex)
{
m_accountIds.push_back(accountIdsJsonList[accountIdsIndex].AsString());
}
m_accountIdsHasBeenSet = true;
}
if(jsonValue.ValueExists("dataSources"))
{
Array<JsonView> dataSourcesJsonList = jsonValue.GetArray("dataSources");
for(unsigned dataSourcesIndex = 0; dataSourcesIndex < dataSourcesJsonList.GetLength(); ++dataSourcesIndex)
{
m_dataSources.push_back(DataSourceMapper::GetDataSourceForName(dataSourcesJsonList[dataSourcesIndex].AsString()));
}
m_dataSourcesHasBeenSet = true;
}
if(jsonValue.ValueExists("resources"))
{
Array<JsonView> resourcesJsonList = jsonValue.GetArray("resources");
for(unsigned resourcesIndex = 0; resourcesIndex < resourcesJsonList.GetLength(); ++resourcesIndex)
{
m_resources.push_back(resourcesJsonList[resourcesIndex].AsString());
}
m_resourcesHasBeenSet = true;
}
return *this;
}
JsonValue UsageCriteria::Jsonize() const
{
JsonValue payload;
if(m_accountIdsHasBeenSet)
{
Array<JsonValue> accountIdsJsonList(m_accountIds.size());
for(unsigned accountIdsIndex = 0; accountIdsIndex < accountIdsJsonList.GetLength(); ++accountIdsIndex)
{
accountIdsJsonList[accountIdsIndex].AsString(m_accountIds[accountIdsIndex]);
}
payload.WithArray("accountIds", std::move(accountIdsJsonList));
}
if(m_dataSourcesHasBeenSet)
{
Array<JsonValue> dataSourcesJsonList(m_dataSources.size());
for(unsigned dataSourcesIndex = 0; dataSourcesIndex < dataSourcesJsonList.GetLength(); ++dataSourcesIndex)
{
dataSourcesJsonList[dataSourcesIndex].AsString(DataSourceMapper::GetNameForDataSource(m_dataSources[dataSourcesIndex]));
}
payload.WithArray("dataSources", std::move(dataSourcesJsonList));
}
if(m_resourcesHasBeenSet)
{
Array<JsonValue> resourcesJsonList(m_resources.size());
for(unsigned resourcesIndex = 0; resourcesIndex < resourcesJsonList.GetLength(); ++resourcesIndex)
{
resourcesJsonList[resourcesIndex].AsString(m_resources[resourcesIndex]);
}
payload.WithArray("resources", std::move(resourcesJsonList));
}
return payload;
}
} // namespace Model
} // namespace GuardDuty
} // namespace Aws