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,135 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/ecs/model/HealthCheck.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <utility>
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
namespace Aws
{
namespace ECS
{
namespace Model
{
HealthCheck::HealthCheck() :
m_commandHasBeenSet(false),
m_interval(0),
m_intervalHasBeenSet(false),
m_timeout(0),
m_timeoutHasBeenSet(false),
m_retries(0),
m_retriesHasBeenSet(false),
m_startPeriod(0),
m_startPeriodHasBeenSet(false)
{
}
HealthCheck::HealthCheck(JsonView jsonValue) :
m_commandHasBeenSet(false),
m_interval(0),
m_intervalHasBeenSet(false),
m_timeout(0),
m_timeoutHasBeenSet(false),
m_retries(0),
m_retriesHasBeenSet(false),
m_startPeriod(0),
m_startPeriodHasBeenSet(false)
{
*this = jsonValue;
}
HealthCheck& HealthCheck::operator =(JsonView jsonValue)
{
if(jsonValue.ValueExists("command"))
{
Array<JsonView> commandJsonList = jsonValue.GetArray("command");
for(unsigned commandIndex = 0; commandIndex < commandJsonList.GetLength(); ++commandIndex)
{
m_command.push_back(commandJsonList[commandIndex].AsString());
}
m_commandHasBeenSet = true;
}
if(jsonValue.ValueExists("interval"))
{
m_interval = jsonValue.GetInteger("interval");
m_intervalHasBeenSet = true;
}
if(jsonValue.ValueExists("timeout"))
{
m_timeout = jsonValue.GetInteger("timeout");
m_timeoutHasBeenSet = true;
}
if(jsonValue.ValueExists("retries"))
{
m_retries = jsonValue.GetInteger("retries");
m_retriesHasBeenSet = true;
}
if(jsonValue.ValueExists("startPeriod"))
{
m_startPeriod = jsonValue.GetInteger("startPeriod");
m_startPeriodHasBeenSet = true;
}
return *this;
}
JsonValue HealthCheck::Jsonize() const
{
JsonValue payload;
if(m_commandHasBeenSet)
{
Array<JsonValue> commandJsonList(m_command.size());
for(unsigned commandIndex = 0; commandIndex < commandJsonList.GetLength(); ++commandIndex)
{
commandJsonList[commandIndex].AsString(m_command[commandIndex]);
}
payload.WithArray("command", std::move(commandJsonList));
}
if(m_intervalHasBeenSet)
{
payload.WithInteger("interval", m_interval);
}
if(m_timeoutHasBeenSet)
{
payload.WithInteger("timeout", m_timeout);
}
if(m_retriesHasBeenSet)
{
payload.WithInteger("retries", m_retries);
}
if(m_startPeriodHasBeenSet)
{
payload.WithInteger("startPeriod", m_startPeriod);
}
return payload;
}
} // namespace Model
} // namespace ECS
} // namespace Aws