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,144 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/shield/model/Subscription.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <utility>
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
namespace Aws
{
namespace Shield
{
namespace Model
{
Subscription::Subscription() :
m_startTimeHasBeenSet(false),
m_endTimeHasBeenSet(false),
m_timeCommitmentInSeconds(0),
m_timeCommitmentInSecondsHasBeenSet(false),
m_autoRenew(AutoRenew::NOT_SET),
m_autoRenewHasBeenSet(false),
m_limitsHasBeenSet(false),
m_proactiveEngagementStatus(ProactiveEngagementStatus::NOT_SET),
m_proactiveEngagementStatusHasBeenSet(false)
{
}
Subscription::Subscription(JsonView jsonValue) :
m_startTimeHasBeenSet(false),
m_endTimeHasBeenSet(false),
m_timeCommitmentInSeconds(0),
m_timeCommitmentInSecondsHasBeenSet(false),
m_autoRenew(AutoRenew::NOT_SET),
m_autoRenewHasBeenSet(false),
m_limitsHasBeenSet(false),
m_proactiveEngagementStatus(ProactiveEngagementStatus::NOT_SET),
m_proactiveEngagementStatusHasBeenSet(false)
{
*this = jsonValue;
}
Subscription& Subscription::operator =(JsonView jsonValue)
{
if(jsonValue.ValueExists("StartTime"))
{
m_startTime = jsonValue.GetDouble("StartTime");
m_startTimeHasBeenSet = true;
}
if(jsonValue.ValueExists("EndTime"))
{
m_endTime = jsonValue.GetDouble("EndTime");
m_endTimeHasBeenSet = true;
}
if(jsonValue.ValueExists("TimeCommitmentInSeconds"))
{
m_timeCommitmentInSeconds = jsonValue.GetInt64("TimeCommitmentInSeconds");
m_timeCommitmentInSecondsHasBeenSet = true;
}
if(jsonValue.ValueExists("AutoRenew"))
{
m_autoRenew = AutoRenewMapper::GetAutoRenewForName(jsonValue.GetString("AutoRenew"));
m_autoRenewHasBeenSet = true;
}
if(jsonValue.ValueExists("Limits"))
{
Array<JsonView> limitsJsonList = jsonValue.GetArray("Limits");
for(unsigned limitsIndex = 0; limitsIndex < limitsJsonList.GetLength(); ++limitsIndex)
{
m_limits.push_back(limitsJsonList[limitsIndex].AsObject());
}
m_limitsHasBeenSet = true;
}
if(jsonValue.ValueExists("ProactiveEngagementStatus"))
{
m_proactiveEngagementStatus = ProactiveEngagementStatusMapper::GetProactiveEngagementStatusForName(jsonValue.GetString("ProactiveEngagementStatus"));
m_proactiveEngagementStatusHasBeenSet = true;
}
return *this;
}
JsonValue Subscription::Jsonize() const
{
JsonValue payload;
if(m_startTimeHasBeenSet)
{
payload.WithDouble("StartTime", m_startTime.SecondsWithMSPrecision());
}
if(m_endTimeHasBeenSet)
{
payload.WithDouble("EndTime", m_endTime.SecondsWithMSPrecision());
}
if(m_timeCommitmentInSecondsHasBeenSet)
{
payload.WithInt64("TimeCommitmentInSeconds", m_timeCommitmentInSeconds);
}
if(m_autoRenewHasBeenSet)
{
payload.WithString("AutoRenew", AutoRenewMapper::GetNameForAutoRenew(m_autoRenew));
}
if(m_limitsHasBeenSet)
{
Array<JsonValue> limitsJsonList(m_limits.size());
for(unsigned limitsIndex = 0; limitsIndex < limitsJsonList.GetLength(); ++limitsIndex)
{
limitsJsonList[limitsIndex].AsObject(m_limits[limitsIndex].Jsonize());
}
payload.WithArray("Limits", std::move(limitsJsonList));
}
if(m_proactiveEngagementStatusHasBeenSet)
{
payload.WithString("ProactiveEngagementStatus", ProactiveEngagementStatusMapper::GetNameForProactiveEngagementStatus(m_proactiveEngagementStatus));
}
return payload;
}
} // namespace Model
} // namespace Shield
} // namespace Aws