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-iot/source/model/AuthInfo.cpp

84 lines
1.8 KiB
C++

/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/iot/model/AuthInfo.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <utility>
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
namespace Aws
{
namespace IoT
{
namespace Model
{
AuthInfo::AuthInfo() :
m_actionType(ActionType::NOT_SET),
m_actionTypeHasBeenSet(false),
m_resourcesHasBeenSet(false)
{
}
AuthInfo::AuthInfo(JsonView jsonValue) :
m_actionType(ActionType::NOT_SET),
m_actionTypeHasBeenSet(false),
m_resourcesHasBeenSet(false)
{
*this = jsonValue;
}
AuthInfo& AuthInfo::operator =(JsonView jsonValue)
{
if(jsonValue.ValueExists("actionType"))
{
m_actionType = ActionTypeMapper::GetActionTypeForName(jsonValue.GetString("actionType"));
m_actionTypeHasBeenSet = 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 AuthInfo::Jsonize() const
{
JsonValue payload;
if(m_actionTypeHasBeenSet)
{
payload.WithString("actionType", ActionTypeMapper::GetNameForActionType(m_actionType));
}
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 IoT
} // namespace Aws