143 lines
3.1 KiB
C++
143 lines
3.1 KiB
C++
/**
|
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
* SPDX-License-Identifier: Apache-2.0.
|
|
*/
|
|
|
|
#include <aws/networkmanager/model/GlobalNetwork.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
|
|
{
|
|
|
|
GlobalNetwork::GlobalNetwork() :
|
|
m_globalNetworkIdHasBeenSet(false),
|
|
m_globalNetworkArnHasBeenSet(false),
|
|
m_descriptionHasBeenSet(false),
|
|
m_createdAtHasBeenSet(false),
|
|
m_state(GlobalNetworkState::NOT_SET),
|
|
m_stateHasBeenSet(false),
|
|
m_tagsHasBeenSet(false)
|
|
{
|
|
}
|
|
|
|
GlobalNetwork::GlobalNetwork(JsonView jsonValue) :
|
|
m_globalNetworkIdHasBeenSet(false),
|
|
m_globalNetworkArnHasBeenSet(false),
|
|
m_descriptionHasBeenSet(false),
|
|
m_createdAtHasBeenSet(false),
|
|
m_state(GlobalNetworkState::NOT_SET),
|
|
m_stateHasBeenSet(false),
|
|
m_tagsHasBeenSet(false)
|
|
{
|
|
*this = jsonValue;
|
|
}
|
|
|
|
GlobalNetwork& GlobalNetwork::operator =(JsonView jsonValue)
|
|
{
|
|
if(jsonValue.ValueExists("GlobalNetworkId"))
|
|
{
|
|
m_globalNetworkId = jsonValue.GetString("GlobalNetworkId");
|
|
|
|
m_globalNetworkIdHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("GlobalNetworkArn"))
|
|
{
|
|
m_globalNetworkArn = jsonValue.GetString("GlobalNetworkArn");
|
|
|
|
m_globalNetworkArnHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("Description"))
|
|
{
|
|
m_description = jsonValue.GetString("Description");
|
|
|
|
m_descriptionHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("CreatedAt"))
|
|
{
|
|
m_createdAt = jsonValue.GetDouble("CreatedAt");
|
|
|
|
m_createdAtHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("State"))
|
|
{
|
|
m_state = GlobalNetworkStateMapper::GetGlobalNetworkStateForName(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 GlobalNetwork::Jsonize() const
|
|
{
|
|
JsonValue payload;
|
|
|
|
if(m_globalNetworkIdHasBeenSet)
|
|
{
|
|
payload.WithString("GlobalNetworkId", m_globalNetworkId);
|
|
|
|
}
|
|
|
|
if(m_globalNetworkArnHasBeenSet)
|
|
{
|
|
payload.WithString("GlobalNetworkArn", m_globalNetworkArn);
|
|
|
|
}
|
|
|
|
if(m_descriptionHasBeenSet)
|
|
{
|
|
payload.WithString("Description", m_description);
|
|
|
|
}
|
|
|
|
if(m_createdAtHasBeenSet)
|
|
{
|
|
payload.WithDouble("CreatedAt", m_createdAt.SecondsWithMSPrecision());
|
|
}
|
|
|
|
if(m_stateHasBeenSet)
|
|
{
|
|
payload.WithString("State", GlobalNetworkStateMapper::GetNameForGlobalNetworkState(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
|