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,207 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/glue/model/CsvClassifier.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <utility>
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
namespace Aws
{
namespace Glue
{
namespace Model
{
CsvClassifier::CsvClassifier() :
m_nameHasBeenSet(false),
m_creationTimeHasBeenSet(false),
m_lastUpdatedHasBeenSet(false),
m_version(0),
m_versionHasBeenSet(false),
m_delimiterHasBeenSet(false),
m_quoteSymbolHasBeenSet(false),
m_containsHeader(CsvHeaderOption::NOT_SET),
m_containsHeaderHasBeenSet(false),
m_headerHasBeenSet(false),
m_disableValueTrimming(false),
m_disableValueTrimmingHasBeenSet(false),
m_allowSingleColumn(false),
m_allowSingleColumnHasBeenSet(false)
{
}
CsvClassifier::CsvClassifier(JsonView jsonValue) :
m_nameHasBeenSet(false),
m_creationTimeHasBeenSet(false),
m_lastUpdatedHasBeenSet(false),
m_version(0),
m_versionHasBeenSet(false),
m_delimiterHasBeenSet(false),
m_quoteSymbolHasBeenSet(false),
m_containsHeader(CsvHeaderOption::NOT_SET),
m_containsHeaderHasBeenSet(false),
m_headerHasBeenSet(false),
m_disableValueTrimming(false),
m_disableValueTrimmingHasBeenSet(false),
m_allowSingleColumn(false),
m_allowSingleColumnHasBeenSet(false)
{
*this = jsonValue;
}
CsvClassifier& CsvClassifier::operator =(JsonView jsonValue)
{
if(jsonValue.ValueExists("Name"))
{
m_name = jsonValue.GetString("Name");
m_nameHasBeenSet = true;
}
if(jsonValue.ValueExists("CreationTime"))
{
m_creationTime = jsonValue.GetDouble("CreationTime");
m_creationTimeHasBeenSet = true;
}
if(jsonValue.ValueExists("LastUpdated"))
{
m_lastUpdated = jsonValue.GetDouble("LastUpdated");
m_lastUpdatedHasBeenSet = true;
}
if(jsonValue.ValueExists("Version"))
{
m_version = jsonValue.GetInt64("Version");
m_versionHasBeenSet = true;
}
if(jsonValue.ValueExists("Delimiter"))
{
m_delimiter = jsonValue.GetString("Delimiter");
m_delimiterHasBeenSet = true;
}
if(jsonValue.ValueExists("QuoteSymbol"))
{
m_quoteSymbol = jsonValue.GetString("QuoteSymbol");
m_quoteSymbolHasBeenSet = true;
}
if(jsonValue.ValueExists("ContainsHeader"))
{
m_containsHeader = CsvHeaderOptionMapper::GetCsvHeaderOptionForName(jsonValue.GetString("ContainsHeader"));
m_containsHeaderHasBeenSet = true;
}
if(jsonValue.ValueExists("Header"))
{
Array<JsonView> headerJsonList = jsonValue.GetArray("Header");
for(unsigned headerIndex = 0; headerIndex < headerJsonList.GetLength(); ++headerIndex)
{
m_header.push_back(headerJsonList[headerIndex].AsString());
}
m_headerHasBeenSet = true;
}
if(jsonValue.ValueExists("DisableValueTrimming"))
{
m_disableValueTrimming = jsonValue.GetBool("DisableValueTrimming");
m_disableValueTrimmingHasBeenSet = true;
}
if(jsonValue.ValueExists("AllowSingleColumn"))
{
m_allowSingleColumn = jsonValue.GetBool("AllowSingleColumn");
m_allowSingleColumnHasBeenSet = true;
}
return *this;
}
JsonValue CsvClassifier::Jsonize() const
{
JsonValue payload;
if(m_nameHasBeenSet)
{
payload.WithString("Name", m_name);
}
if(m_creationTimeHasBeenSet)
{
payload.WithDouble("CreationTime", m_creationTime.SecondsWithMSPrecision());
}
if(m_lastUpdatedHasBeenSet)
{
payload.WithDouble("LastUpdated", m_lastUpdated.SecondsWithMSPrecision());
}
if(m_versionHasBeenSet)
{
payload.WithInt64("Version", m_version);
}
if(m_delimiterHasBeenSet)
{
payload.WithString("Delimiter", m_delimiter);
}
if(m_quoteSymbolHasBeenSet)
{
payload.WithString("QuoteSymbol", m_quoteSymbol);
}
if(m_containsHeaderHasBeenSet)
{
payload.WithString("ContainsHeader", CsvHeaderOptionMapper::GetNameForCsvHeaderOption(m_containsHeader));
}
if(m_headerHasBeenSet)
{
Array<JsonValue> headerJsonList(m_header.size());
for(unsigned headerIndex = 0; headerIndex < headerJsonList.GetLength(); ++headerIndex)
{
headerJsonList[headerIndex].AsString(m_header[headerIndex]);
}
payload.WithArray("Header", std::move(headerJsonList));
}
if(m_disableValueTrimmingHasBeenSet)
{
payload.WithBool("DisableValueTrimming", m_disableValueTrimming);
}
if(m_allowSingleColumnHasBeenSet)
{
payload.WithBool("AllowSingleColumn", m_allowSingleColumn);
}
return payload;
}
} // namespace Model
} // namespace Glue
} // namespace Aws