123 lines
2.4 KiB
C++
123 lines
2.4 KiB
C++
/**
|
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
* SPDX-License-Identifier: Apache-2.0.
|
|
*/
|
|
|
|
#include <aws/directconnect/model/NewBGPPeer.h>
|
|
#include <aws/core/utils/json/JsonSerializer.h>
|
|
|
|
#include <utility>
|
|
|
|
using namespace Aws::Utils::Json;
|
|
using namespace Aws::Utils;
|
|
|
|
namespace Aws
|
|
{
|
|
namespace DirectConnect
|
|
{
|
|
namespace Model
|
|
{
|
|
|
|
NewBGPPeer::NewBGPPeer() :
|
|
m_asn(0),
|
|
m_asnHasBeenSet(false),
|
|
m_authKeyHasBeenSet(false),
|
|
m_addressFamily(AddressFamily::NOT_SET),
|
|
m_addressFamilyHasBeenSet(false),
|
|
m_amazonAddressHasBeenSet(false),
|
|
m_customerAddressHasBeenSet(false)
|
|
{
|
|
}
|
|
|
|
NewBGPPeer::NewBGPPeer(JsonView jsonValue) :
|
|
m_asn(0),
|
|
m_asnHasBeenSet(false),
|
|
m_authKeyHasBeenSet(false),
|
|
m_addressFamily(AddressFamily::NOT_SET),
|
|
m_addressFamilyHasBeenSet(false),
|
|
m_amazonAddressHasBeenSet(false),
|
|
m_customerAddressHasBeenSet(false)
|
|
{
|
|
*this = jsonValue;
|
|
}
|
|
|
|
NewBGPPeer& NewBGPPeer::operator =(JsonView jsonValue)
|
|
{
|
|
if(jsonValue.ValueExists("asn"))
|
|
{
|
|
m_asn = jsonValue.GetInteger("asn");
|
|
|
|
m_asnHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("authKey"))
|
|
{
|
|
m_authKey = jsonValue.GetString("authKey");
|
|
|
|
m_authKeyHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("addressFamily"))
|
|
{
|
|
m_addressFamily = AddressFamilyMapper::GetAddressFamilyForName(jsonValue.GetString("addressFamily"));
|
|
|
|
m_addressFamilyHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("amazonAddress"))
|
|
{
|
|
m_amazonAddress = jsonValue.GetString("amazonAddress");
|
|
|
|
m_amazonAddressHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("customerAddress"))
|
|
{
|
|
m_customerAddress = jsonValue.GetString("customerAddress");
|
|
|
|
m_customerAddressHasBeenSet = true;
|
|
}
|
|
|
|
return *this;
|
|
}
|
|
|
|
JsonValue NewBGPPeer::Jsonize() const
|
|
{
|
|
JsonValue payload;
|
|
|
|
if(m_asnHasBeenSet)
|
|
{
|
|
payload.WithInteger("asn", m_asn);
|
|
|
|
}
|
|
|
|
if(m_authKeyHasBeenSet)
|
|
{
|
|
payload.WithString("authKey", m_authKey);
|
|
|
|
}
|
|
|
|
if(m_addressFamilyHasBeenSet)
|
|
{
|
|
payload.WithString("addressFamily", AddressFamilyMapper::GetNameForAddressFamily(m_addressFamily));
|
|
}
|
|
|
|
if(m_amazonAddressHasBeenSet)
|
|
{
|
|
payload.WithString("amazonAddress", m_amazonAddress);
|
|
|
|
}
|
|
|
|
if(m_customerAddressHasBeenSet)
|
|
{
|
|
payload.WithString("customerAddress", m_customerAddress);
|
|
|
|
}
|
|
|
|
return payload;
|
|
}
|
|
|
|
} // namespace Model
|
|
} // namespace DirectConnect
|
|
} // namespace Aws
|