feat(hos_client_create, hos_client_destory): 多次调用destory不会导致重复释放

This commit is contained in:
彭宣正
2020-12-14 17:24:58 +08:00
parent 505d529c32
commit 10b370e486
55976 changed files with 8544395 additions and 2 deletions

View File

@@ -0,0 +1,150 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/securityhub/model/AwsEc2SecurityGroupDetails.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <utility>
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
namespace Aws
{
namespace SecurityHub
{
namespace Model
{
AwsEc2SecurityGroupDetails::AwsEc2SecurityGroupDetails() :
m_groupNameHasBeenSet(false),
m_groupIdHasBeenSet(false),
m_ownerIdHasBeenSet(false),
m_vpcIdHasBeenSet(false),
m_ipPermissionsHasBeenSet(false),
m_ipPermissionsEgressHasBeenSet(false)
{
}
AwsEc2SecurityGroupDetails::AwsEc2SecurityGroupDetails(JsonView jsonValue) :
m_groupNameHasBeenSet(false),
m_groupIdHasBeenSet(false),
m_ownerIdHasBeenSet(false),
m_vpcIdHasBeenSet(false),
m_ipPermissionsHasBeenSet(false),
m_ipPermissionsEgressHasBeenSet(false)
{
*this = jsonValue;
}
AwsEc2SecurityGroupDetails& AwsEc2SecurityGroupDetails::operator =(JsonView jsonValue)
{
if(jsonValue.ValueExists("GroupName"))
{
m_groupName = jsonValue.GetString("GroupName");
m_groupNameHasBeenSet = true;
}
if(jsonValue.ValueExists("GroupId"))
{
m_groupId = jsonValue.GetString("GroupId");
m_groupIdHasBeenSet = true;
}
if(jsonValue.ValueExists("OwnerId"))
{
m_ownerId = jsonValue.GetString("OwnerId");
m_ownerIdHasBeenSet = true;
}
if(jsonValue.ValueExists("VpcId"))
{
m_vpcId = jsonValue.GetString("VpcId");
m_vpcIdHasBeenSet = true;
}
if(jsonValue.ValueExists("IpPermissions"))
{
Array<JsonView> ipPermissionsJsonList = jsonValue.GetArray("IpPermissions");
for(unsigned ipPermissionsIndex = 0; ipPermissionsIndex < ipPermissionsJsonList.GetLength(); ++ipPermissionsIndex)
{
m_ipPermissions.push_back(ipPermissionsJsonList[ipPermissionsIndex].AsObject());
}
m_ipPermissionsHasBeenSet = true;
}
if(jsonValue.ValueExists("IpPermissionsEgress"))
{
Array<JsonView> ipPermissionsEgressJsonList = jsonValue.GetArray("IpPermissionsEgress");
for(unsigned ipPermissionsEgressIndex = 0; ipPermissionsEgressIndex < ipPermissionsEgressJsonList.GetLength(); ++ipPermissionsEgressIndex)
{
m_ipPermissionsEgress.push_back(ipPermissionsEgressJsonList[ipPermissionsEgressIndex].AsObject());
}
m_ipPermissionsEgressHasBeenSet = true;
}
return *this;
}
JsonValue AwsEc2SecurityGroupDetails::Jsonize() const
{
JsonValue payload;
if(m_groupNameHasBeenSet)
{
payload.WithString("GroupName", m_groupName);
}
if(m_groupIdHasBeenSet)
{
payload.WithString("GroupId", m_groupId);
}
if(m_ownerIdHasBeenSet)
{
payload.WithString("OwnerId", m_ownerId);
}
if(m_vpcIdHasBeenSet)
{
payload.WithString("VpcId", m_vpcId);
}
if(m_ipPermissionsHasBeenSet)
{
Array<JsonValue> ipPermissionsJsonList(m_ipPermissions.size());
for(unsigned ipPermissionsIndex = 0; ipPermissionsIndex < ipPermissionsJsonList.GetLength(); ++ipPermissionsIndex)
{
ipPermissionsJsonList[ipPermissionsIndex].AsObject(m_ipPermissions[ipPermissionsIndex].Jsonize());
}
payload.WithArray("IpPermissions", std::move(ipPermissionsJsonList));
}
if(m_ipPermissionsEgressHasBeenSet)
{
Array<JsonValue> ipPermissionsEgressJsonList(m_ipPermissionsEgress.size());
for(unsigned ipPermissionsEgressIndex = 0; ipPermissionsEgressIndex < ipPermissionsEgressJsonList.GetLength(); ++ipPermissionsEgressIndex)
{
ipPermissionsEgressJsonList[ipPermissionsEgressIndex].AsObject(m_ipPermissionsEgress[ipPermissionsEgressIndex].Jsonize());
}
payload.WithArray("IpPermissionsEgress", std::move(ipPermissionsEgressJsonList));
}
return payload;
}
} // namespace Model
} // namespace SecurityHub
} // namespace Aws