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,161 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/securityhub/model/AwsEc2VolumeDetails.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
{
AwsEc2VolumeDetails::AwsEc2VolumeDetails() :
m_createTimeHasBeenSet(false),
m_encrypted(false),
m_encryptedHasBeenSet(false),
m_size(0),
m_sizeHasBeenSet(false),
m_snapshotIdHasBeenSet(false),
m_statusHasBeenSet(false),
m_kmsKeyIdHasBeenSet(false),
m_attachmentsHasBeenSet(false)
{
}
AwsEc2VolumeDetails::AwsEc2VolumeDetails(JsonView jsonValue) :
m_createTimeHasBeenSet(false),
m_encrypted(false),
m_encryptedHasBeenSet(false),
m_size(0),
m_sizeHasBeenSet(false),
m_snapshotIdHasBeenSet(false),
m_statusHasBeenSet(false),
m_kmsKeyIdHasBeenSet(false),
m_attachmentsHasBeenSet(false)
{
*this = jsonValue;
}
AwsEc2VolumeDetails& AwsEc2VolumeDetails::operator =(JsonView jsonValue)
{
if(jsonValue.ValueExists("CreateTime"))
{
m_createTime = jsonValue.GetString("CreateTime");
m_createTimeHasBeenSet = true;
}
if(jsonValue.ValueExists("Encrypted"))
{
m_encrypted = jsonValue.GetBool("Encrypted");
m_encryptedHasBeenSet = true;
}
if(jsonValue.ValueExists("Size"))
{
m_size = jsonValue.GetInteger("Size");
m_sizeHasBeenSet = true;
}
if(jsonValue.ValueExists("SnapshotId"))
{
m_snapshotId = jsonValue.GetString("SnapshotId");
m_snapshotIdHasBeenSet = true;
}
if(jsonValue.ValueExists("Status"))
{
m_status = jsonValue.GetString("Status");
m_statusHasBeenSet = true;
}
if(jsonValue.ValueExists("KmsKeyId"))
{
m_kmsKeyId = jsonValue.GetString("KmsKeyId");
m_kmsKeyIdHasBeenSet = true;
}
if(jsonValue.ValueExists("Attachments"))
{
Array<JsonView> attachmentsJsonList = jsonValue.GetArray("Attachments");
for(unsigned attachmentsIndex = 0; attachmentsIndex < attachmentsJsonList.GetLength(); ++attachmentsIndex)
{
m_attachments.push_back(attachmentsJsonList[attachmentsIndex].AsObject());
}
m_attachmentsHasBeenSet = true;
}
return *this;
}
JsonValue AwsEc2VolumeDetails::Jsonize() const
{
JsonValue payload;
if(m_createTimeHasBeenSet)
{
payload.WithString("CreateTime", m_createTime);
}
if(m_encryptedHasBeenSet)
{
payload.WithBool("Encrypted", m_encrypted);
}
if(m_sizeHasBeenSet)
{
payload.WithInteger("Size", m_size);
}
if(m_snapshotIdHasBeenSet)
{
payload.WithString("SnapshotId", m_snapshotId);
}
if(m_statusHasBeenSet)
{
payload.WithString("Status", m_status);
}
if(m_kmsKeyIdHasBeenSet)
{
payload.WithString("KmsKeyId", m_kmsKeyId);
}
if(m_attachmentsHasBeenSet)
{
Array<JsonValue> attachmentsJsonList(m_attachments.size());
for(unsigned attachmentsIndex = 0; attachmentsIndex < attachmentsJsonList.GetLength(); ++attachmentsIndex)
{
attachmentsJsonList[attachmentsIndex].AsObject(m_attachments[attachmentsIndex].Jsonize());
}
payload.WithArray("Attachments", std::move(attachmentsJsonList));
}
return payload;
}
} // namespace Model
} // namespace SecurityHub
} // namespace Aws