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

173 lines
3.4 KiB
C++

/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/networkmanager/model/Site.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <utility>
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
namespace Aws
{
namespace NetworkManager
{
namespace Model
{
Site::Site() :
m_siteIdHasBeenSet(false),
m_siteArnHasBeenSet(false),
m_globalNetworkIdHasBeenSet(false),
m_descriptionHasBeenSet(false),
m_locationHasBeenSet(false),
m_createdAtHasBeenSet(false),
m_state(SiteState::NOT_SET),
m_stateHasBeenSet(false),
m_tagsHasBeenSet(false)
{
}
Site::Site(JsonView jsonValue) :
m_siteIdHasBeenSet(false),
m_siteArnHasBeenSet(false),
m_globalNetworkIdHasBeenSet(false),
m_descriptionHasBeenSet(false),
m_locationHasBeenSet(false),
m_createdAtHasBeenSet(false),
m_state(SiteState::NOT_SET),
m_stateHasBeenSet(false),
m_tagsHasBeenSet(false)
{
*this = jsonValue;
}
Site& Site::operator =(JsonView jsonValue)
{
if(jsonValue.ValueExists("SiteId"))
{
m_siteId = jsonValue.GetString("SiteId");
m_siteIdHasBeenSet = true;
}
if(jsonValue.ValueExists("SiteArn"))
{
m_siteArn = jsonValue.GetString("SiteArn");
m_siteArnHasBeenSet = true;
}
if(jsonValue.ValueExists("GlobalNetworkId"))
{
m_globalNetworkId = jsonValue.GetString("GlobalNetworkId");
m_globalNetworkIdHasBeenSet = true;
}
if(jsonValue.ValueExists("Description"))
{
m_description = jsonValue.GetString("Description");
m_descriptionHasBeenSet = true;
}
if(jsonValue.ValueExists("Location"))
{
m_location = jsonValue.GetObject("Location");
m_locationHasBeenSet = true;
}
if(jsonValue.ValueExists("CreatedAt"))
{
m_createdAt = jsonValue.GetDouble("CreatedAt");
m_createdAtHasBeenSet = true;
}
if(jsonValue.ValueExists("State"))
{
m_state = SiteStateMapper::GetSiteStateForName(jsonValue.GetString("State"));
m_stateHasBeenSet = true;
}
if(jsonValue.ValueExists("Tags"))
{
Array<JsonView> tagsJsonList = jsonValue.GetArray("Tags");
for(unsigned tagsIndex = 0; tagsIndex < tagsJsonList.GetLength(); ++tagsIndex)
{
m_tags.push_back(tagsJsonList[tagsIndex].AsObject());
}
m_tagsHasBeenSet = true;
}
return *this;
}
JsonValue Site::Jsonize() const
{
JsonValue payload;
if(m_siteIdHasBeenSet)
{
payload.WithString("SiteId", m_siteId);
}
if(m_siteArnHasBeenSet)
{
payload.WithString("SiteArn", m_siteArn);
}
if(m_globalNetworkIdHasBeenSet)
{
payload.WithString("GlobalNetworkId", m_globalNetworkId);
}
if(m_descriptionHasBeenSet)
{
payload.WithString("Description", m_description);
}
if(m_locationHasBeenSet)
{
payload.WithObject("Location", m_location.Jsonize());
}
if(m_createdAtHasBeenSet)
{
payload.WithDouble("CreatedAt", m_createdAt.SecondsWithMSPrecision());
}
if(m_stateHasBeenSet)
{
payload.WithString("State", SiteStateMapper::GetNameForSiteState(m_state));
}
if(m_tagsHasBeenSet)
{
Array<JsonValue> tagsJsonList(m_tags.size());
for(unsigned tagsIndex = 0; tagsIndex < tagsJsonList.GetLength(); ++tagsIndex)
{
tagsJsonList[tagsIndex].AsObject(m_tags[tagsIndex].Jsonize());
}
payload.WithArray("Tags", std::move(tagsJsonList));
}
return payload;
}
} // namespace Model
} // namespace NetworkManager
} // namespace Aws