106 lines
2.1 KiB
C++
106 lines
2.1 KiB
C++
/**
|
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
* SPDX-License-Identifier: Apache-2.0.
|
|
*/
|
|
|
|
#include <aws/config/model/Relationship.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
|
|
{
|
|
|
|
Relationship::Relationship() :
|
|
m_resourceType(ResourceType::NOT_SET),
|
|
m_resourceTypeHasBeenSet(false),
|
|
m_resourceIdHasBeenSet(false),
|
|
m_resourceNameHasBeenSet(false),
|
|
m_relationshipNameHasBeenSet(false)
|
|
{
|
|
}
|
|
|
|
Relationship::Relationship(JsonView jsonValue) :
|
|
m_resourceType(ResourceType::NOT_SET),
|
|
m_resourceTypeHasBeenSet(false),
|
|
m_resourceIdHasBeenSet(false),
|
|
m_resourceNameHasBeenSet(false),
|
|
m_relationshipNameHasBeenSet(false)
|
|
{
|
|
*this = jsonValue;
|
|
}
|
|
|
|
Relationship& Relationship::operator =(JsonView jsonValue)
|
|
{
|
|
if(jsonValue.ValueExists("resourceType"))
|
|
{
|
|
m_resourceType = ResourceTypeMapper::GetResourceTypeForName(jsonValue.GetString("resourceType"));
|
|
|
|
m_resourceTypeHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("resourceId"))
|
|
{
|
|
m_resourceId = jsonValue.GetString("resourceId");
|
|
|
|
m_resourceIdHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("resourceName"))
|
|
{
|
|
m_resourceName = jsonValue.GetString("resourceName");
|
|
|
|
m_resourceNameHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("relationshipName"))
|
|
{
|
|
m_relationshipName = jsonValue.GetString("relationshipName");
|
|
|
|
m_relationshipNameHasBeenSet = true;
|
|
}
|
|
|
|
return *this;
|
|
}
|
|
|
|
JsonValue Relationship::Jsonize() const
|
|
{
|
|
JsonValue payload;
|
|
|
|
if(m_resourceTypeHasBeenSet)
|
|
{
|
|
payload.WithString("resourceType", ResourceTypeMapper::GetNameForResourceType(m_resourceType));
|
|
}
|
|
|
|
if(m_resourceIdHasBeenSet)
|
|
{
|
|
payload.WithString("resourceId", m_resourceId);
|
|
|
|
}
|
|
|
|
if(m_resourceNameHasBeenSet)
|
|
{
|
|
payload.WithString("resourceName", m_resourceName);
|
|
|
|
}
|
|
|
|
if(m_relationshipNameHasBeenSet)
|
|
{
|
|
payload.WithString("relationshipName", m_relationshipName);
|
|
|
|
}
|
|
|
|
return payload;
|
|
}
|
|
|
|
} // namespace Model
|
|
} // namespace ConfigService
|
|
} // namespace Aws
|