113 lines
2.1 KiB
C++
113 lines
2.1 KiB
C++
|
|
/**
|
|||
|
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|||
|
|
* SPDX-License-Identifier: Apache-2.0.
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
#include <aws/xray/model/ServiceId.h>
|
|||
|
|
#include <aws/core/utils/json/JsonSerializer.h>
|
|||
|
|
|
|||
|
|
#include <utility>
|
|||
|
|
|
|||
|
|
using namespace Aws::Utils::Json;
|
|||
|
|
using namespace Aws::Utils;
|
|||
|
|
|
|||
|
|
namespace Aws
|
|||
|
|
{
|
|||
|
|
namespace XRay
|
|||
|
|
{
|
|||
|
|
namespace Model
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
ServiceId::ServiceId() :
|
|||
|
|
m_nameHasBeenSet(false),
|
|||
|
|
m_namesHasBeenSet(false),
|
|||
|
|
m_accountIdHasBeenSet(false),
|
|||
|
|
m_typeHasBeenSet(false)
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
ServiceId::ServiceId(JsonView jsonValue) :
|
|||
|
|
m_nameHasBeenSet(false),
|
|||
|
|
m_namesHasBeenSet(false),
|
|||
|
|
m_accountIdHasBeenSet(false),
|
|||
|
|
m_typeHasBeenSet(false)
|
|||
|
|
{
|
|||
|
|
*this = jsonValue;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
ServiceId& ServiceId::operator =(JsonView jsonValue)
|
|||
|
|
{
|
|||
|
|
if(jsonValue.ValueExists("Name"))
|
|||
|
|
{
|
|||
|
|
m_name = jsonValue.GetString("Name");
|
|||
|
|
|
|||
|
|
m_nameHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(jsonValue.ValueExists("Names"))
|
|||
|
|
{
|
|||
|
|
Array<JsonView> namesJsonList = jsonValue.GetArray("Names");
|
|||
|
|
for(unsigned namesIndex = 0; namesIndex < namesJsonList.GetLength(); ++namesIndex)
|
|||
|
|
{
|
|||
|
|
m_names.push_back(namesJsonList[namesIndex].AsString());
|
|||
|
|
}
|
|||
|
|
m_namesHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(jsonValue.ValueExists("AccountId"))
|
|||
|
|
{
|
|||
|
|
m_accountId = jsonValue.GetString("AccountId");
|
|||
|
|
|
|||
|
|
m_accountIdHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(jsonValue.ValueExists("Type"))
|
|||
|
|
{
|
|||
|
|
m_type = jsonValue.GetString("Type");
|
|||
|
|
|
|||
|
|
m_typeHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return *this;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
JsonValue ServiceId::Jsonize() const
|
|||
|
|
{
|
|||
|
|
JsonValue payload;
|
|||
|
|
|
|||
|
|
if(m_nameHasBeenSet)
|
|||
|
|
{
|
|||
|
|
payload.WithString("Name", m_name);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(m_namesHasBeenSet)
|
|||
|
|
{
|
|||
|
|
Array<JsonValue> namesJsonList(m_names.size());
|
|||
|
|
for(unsigned namesIndex = 0; namesIndex < namesJsonList.GetLength(); ++namesIndex)
|
|||
|
|
{
|
|||
|
|
namesJsonList[namesIndex].AsString(m_names[namesIndex]);
|
|||
|
|
}
|
|||
|
|
payload.WithArray("Names", std::move(namesJsonList));
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(m_accountIdHasBeenSet)
|
|||
|
|
{
|
|||
|
|
payload.WithString("AccountId", m_accountId);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(m_typeHasBeenSet)
|
|||
|
|
{
|
|||
|
|
payload.WithString("Type", m_type);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return payload;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
} // namespace Model
|
|||
|
|
} // namespace XRay
|
|||
|
|
} // namespace Aws
|