106 lines
2.5 KiB
C++
106 lines
2.5 KiB
C++
|
|
/**
|
|||
|
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|||
|
|
* SPDX-License-Identifier: Apache-2.0.
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
#include <aws/codebuild/model/VpcConfig.h>
|
|||
|
|
#include <aws/core/utils/json/JsonSerializer.h>
|
|||
|
|
|
|||
|
|
#include <utility>
|
|||
|
|
|
|||
|
|
using namespace Aws::Utils::Json;
|
|||
|
|
using namespace Aws::Utils;
|
|||
|
|
|
|||
|
|
namespace Aws
|
|||
|
|
{
|
|||
|
|
namespace CodeBuild
|
|||
|
|
{
|
|||
|
|
namespace Model
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
VpcConfig::VpcConfig() :
|
|||
|
|
m_vpcIdHasBeenSet(false),
|
|||
|
|
m_subnetsHasBeenSet(false),
|
|||
|
|
m_securityGroupIdsHasBeenSet(false)
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
VpcConfig::VpcConfig(JsonView jsonValue) :
|
|||
|
|
m_vpcIdHasBeenSet(false),
|
|||
|
|
m_subnetsHasBeenSet(false),
|
|||
|
|
m_securityGroupIdsHasBeenSet(false)
|
|||
|
|
{
|
|||
|
|
*this = jsonValue;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
VpcConfig& VpcConfig::operator =(JsonView jsonValue)
|
|||
|
|
{
|
|||
|
|
if(jsonValue.ValueExists("vpcId"))
|
|||
|
|
{
|
|||
|
|
m_vpcId = jsonValue.GetString("vpcId");
|
|||
|
|
|
|||
|
|
m_vpcIdHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(jsonValue.ValueExists("subnets"))
|
|||
|
|
{
|
|||
|
|
Array<JsonView> subnetsJsonList = jsonValue.GetArray("subnets");
|
|||
|
|
for(unsigned subnetsIndex = 0; subnetsIndex < subnetsJsonList.GetLength(); ++subnetsIndex)
|
|||
|
|
{
|
|||
|
|
m_subnets.push_back(subnetsJsonList[subnetsIndex].AsString());
|
|||
|
|
}
|
|||
|
|
m_subnetsHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(jsonValue.ValueExists("securityGroupIds"))
|
|||
|
|
{
|
|||
|
|
Array<JsonView> securityGroupIdsJsonList = jsonValue.GetArray("securityGroupIds");
|
|||
|
|
for(unsigned securityGroupIdsIndex = 0; securityGroupIdsIndex < securityGroupIdsJsonList.GetLength(); ++securityGroupIdsIndex)
|
|||
|
|
{
|
|||
|
|
m_securityGroupIds.push_back(securityGroupIdsJsonList[securityGroupIdsIndex].AsString());
|
|||
|
|
}
|
|||
|
|
m_securityGroupIdsHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return *this;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
JsonValue VpcConfig::Jsonize() const
|
|||
|
|
{
|
|||
|
|
JsonValue payload;
|
|||
|
|
|
|||
|
|
if(m_vpcIdHasBeenSet)
|
|||
|
|
{
|
|||
|
|
payload.WithString("vpcId", m_vpcId);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(m_subnetsHasBeenSet)
|
|||
|
|
{
|
|||
|
|
Array<JsonValue> subnetsJsonList(m_subnets.size());
|
|||
|
|
for(unsigned subnetsIndex = 0; subnetsIndex < subnetsJsonList.GetLength(); ++subnetsIndex)
|
|||
|
|
{
|
|||
|
|
subnetsJsonList[subnetsIndex].AsString(m_subnets[subnetsIndex]);
|
|||
|
|
}
|
|||
|
|
payload.WithArray("subnets", std::move(subnetsJsonList));
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(m_securityGroupIdsHasBeenSet)
|
|||
|
|
{
|
|||
|
|
Array<JsonValue> securityGroupIdsJsonList(m_securityGroupIds.size());
|
|||
|
|
for(unsigned securityGroupIdsIndex = 0; securityGroupIdsIndex < securityGroupIdsJsonList.GetLength(); ++securityGroupIdsIndex)
|
|||
|
|
{
|
|||
|
|
securityGroupIdsJsonList[securityGroupIdsIndex].AsString(m_securityGroupIds[securityGroupIdsIndex]);
|
|||
|
|
}
|
|||
|
|
payload.WithArray("securityGroupIds", std::move(securityGroupIdsJsonList));
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return payload;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
} // namespace Model
|
|||
|
|
} // namespace CodeBuild
|
|||
|
|
} // namespace Aws
|