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-config/source/model/Source.cpp

99 lines
2.2 KiB
C++

/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/config/model/Source.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <utility>
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
namespace Aws
{
namespace ConfigService
{
namespace Model
{
Source::Source() :
m_owner(Owner::NOT_SET),
m_ownerHasBeenSet(false),
m_sourceIdentifierHasBeenSet(false),
m_sourceDetailsHasBeenSet(false)
{
}
Source::Source(JsonView jsonValue) :
m_owner(Owner::NOT_SET),
m_ownerHasBeenSet(false),
m_sourceIdentifierHasBeenSet(false),
m_sourceDetailsHasBeenSet(false)
{
*this = jsonValue;
}
Source& Source::operator =(JsonView jsonValue)
{
if(jsonValue.ValueExists("Owner"))
{
m_owner = OwnerMapper::GetOwnerForName(jsonValue.GetString("Owner"));
m_ownerHasBeenSet = true;
}
if(jsonValue.ValueExists("SourceIdentifier"))
{
m_sourceIdentifier = jsonValue.GetString("SourceIdentifier");
m_sourceIdentifierHasBeenSet = true;
}
if(jsonValue.ValueExists("SourceDetails"))
{
Array<JsonView> sourceDetailsJsonList = jsonValue.GetArray("SourceDetails");
for(unsigned sourceDetailsIndex = 0; sourceDetailsIndex < sourceDetailsJsonList.GetLength(); ++sourceDetailsIndex)
{
m_sourceDetails.push_back(sourceDetailsJsonList[sourceDetailsIndex].AsObject());
}
m_sourceDetailsHasBeenSet = true;
}
return *this;
}
JsonValue Source::Jsonize() const
{
JsonValue payload;
if(m_ownerHasBeenSet)
{
payload.WithString("Owner", OwnerMapper::GetNameForOwner(m_owner));
}
if(m_sourceIdentifierHasBeenSet)
{
payload.WithString("SourceIdentifier", m_sourceIdentifier);
}
if(m_sourceDetailsHasBeenSet)
{
Array<JsonValue> sourceDetailsJsonList(m_sourceDetails.size());
for(unsigned sourceDetailsIndex = 0; sourceDetailsIndex < sourceDetailsJsonList.GetLength(); ++sourceDetailsIndex)
{
sourceDetailsJsonList[sourceDetailsIndex].AsObject(m_sourceDetails[sourceDetailsIndex].Jsonize());
}
payload.WithArray("SourceDetails", std::move(sourceDetailsJsonList));
}
return payload;
}
} // namespace Model
} // namespace ConfigService
} // namespace Aws