99 lines
2.2 KiB
C++
99 lines
2.2 KiB
C++
/**
|
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
* SPDX-License-Identifier: Apache-2.0.
|
|
*/
|
|
|
|
#include <aws/eks/model/ErrorDetail.h>
|
|
#include <aws/core/utils/json/JsonSerializer.h>
|
|
|
|
#include <utility>
|
|
|
|
using namespace Aws::Utils::Json;
|
|
using namespace Aws::Utils;
|
|
|
|
namespace Aws
|
|
{
|
|
namespace EKS
|
|
{
|
|
namespace Model
|
|
{
|
|
|
|
ErrorDetail::ErrorDetail() :
|
|
m_errorCode(ErrorCode::NOT_SET),
|
|
m_errorCodeHasBeenSet(false),
|
|
m_errorMessageHasBeenSet(false),
|
|
m_resourceIdsHasBeenSet(false)
|
|
{
|
|
}
|
|
|
|
ErrorDetail::ErrorDetail(JsonView jsonValue) :
|
|
m_errorCode(ErrorCode::NOT_SET),
|
|
m_errorCodeHasBeenSet(false),
|
|
m_errorMessageHasBeenSet(false),
|
|
m_resourceIdsHasBeenSet(false)
|
|
{
|
|
*this = jsonValue;
|
|
}
|
|
|
|
ErrorDetail& ErrorDetail::operator =(JsonView jsonValue)
|
|
{
|
|
if(jsonValue.ValueExists("errorCode"))
|
|
{
|
|
m_errorCode = ErrorCodeMapper::GetErrorCodeForName(jsonValue.GetString("errorCode"));
|
|
|
|
m_errorCodeHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("errorMessage"))
|
|
{
|
|
m_errorMessage = jsonValue.GetString("errorMessage");
|
|
|
|
m_errorMessageHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("resourceIds"))
|
|
{
|
|
Array<JsonView> resourceIdsJsonList = jsonValue.GetArray("resourceIds");
|
|
for(unsigned resourceIdsIndex = 0; resourceIdsIndex < resourceIdsJsonList.GetLength(); ++resourceIdsIndex)
|
|
{
|
|
m_resourceIds.push_back(resourceIdsJsonList[resourceIdsIndex].AsString());
|
|
}
|
|
m_resourceIdsHasBeenSet = true;
|
|
}
|
|
|
|
return *this;
|
|
}
|
|
|
|
JsonValue ErrorDetail::Jsonize() const
|
|
{
|
|
JsonValue payload;
|
|
|
|
if(m_errorCodeHasBeenSet)
|
|
{
|
|
payload.WithString("errorCode", ErrorCodeMapper::GetNameForErrorCode(m_errorCode));
|
|
}
|
|
|
|
if(m_errorMessageHasBeenSet)
|
|
{
|
|
payload.WithString("errorMessage", m_errorMessage);
|
|
|
|
}
|
|
|
|
if(m_resourceIdsHasBeenSet)
|
|
{
|
|
Array<JsonValue> resourceIdsJsonList(m_resourceIds.size());
|
|
for(unsigned resourceIdsIndex = 0; resourceIdsIndex < resourceIdsJsonList.GetLength(); ++resourceIdsIndex)
|
|
{
|
|
resourceIdsJsonList[resourceIdsIndex].AsString(m_resourceIds[resourceIdsIndex]);
|
|
}
|
|
payload.WithArray("resourceIds", std::move(resourceIdsJsonList));
|
|
|
|
}
|
|
|
|
return payload;
|
|
}
|
|
|
|
} // namespace Model
|
|
} // namespace EKS
|
|
} // namespace Aws
|