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,180 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/core/utils/Outcome.h>
#include <aws/core/auth/AWSAuthSigner.h>
#include <aws/core/client/CoreErrors.h>
#include <aws/core/client/RetryStrategy.h>
#include <aws/core/http/HttpClient.h>
#include <aws/core/http/HttpResponse.h>
#include <aws/core/http/HttpClientFactory.h>
#include <aws/core/auth/AWSCredentialsProviderChain.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <aws/core/utils/memory/stl/AWSStringStream.h>
#include <aws/core/utils/threading/Executor.h>
#include <aws/core/utils/DNS.h>
#include <aws/core/utils/logging/LogMacros.h>
#include <aws/migrationhub-config/MigrationHubConfigClient.h>
#include <aws/migrationhub-config/MigrationHubConfigEndpoint.h>
#include <aws/migrationhub-config/MigrationHubConfigErrorMarshaller.h>
#include <aws/migrationhub-config/model/CreateHomeRegionControlRequest.h>
#include <aws/migrationhub-config/model/DescribeHomeRegionControlsRequest.h>
#include <aws/migrationhub-config/model/GetHomeRegionRequest.h>
using namespace Aws;
using namespace Aws::Auth;
using namespace Aws::Client;
using namespace Aws::MigrationHubConfig;
using namespace Aws::MigrationHubConfig::Model;
using namespace Aws::Http;
using namespace Aws::Utils::Json;
static const char* SERVICE_NAME = "mgh";
static const char* ALLOCATION_TAG = "MigrationHubConfigClient";
MigrationHubConfigClient::MigrationHubConfigClient(const Client::ClientConfiguration& clientConfiguration) :
BASECLASS(clientConfiguration,
Aws::MakeShared<AWSAuthV4Signer>(ALLOCATION_TAG, Aws::MakeShared<DefaultAWSCredentialsProviderChain>(ALLOCATION_TAG),
SERVICE_NAME, Aws::Region::ComputeSignerRegion(clientConfiguration.region)),
Aws::MakeShared<MigrationHubConfigErrorMarshaller>(ALLOCATION_TAG)),
m_executor(clientConfiguration.executor)
{
init(clientConfiguration);
}
MigrationHubConfigClient::MigrationHubConfigClient(const AWSCredentials& credentials, const Client::ClientConfiguration& clientConfiguration) :
BASECLASS(clientConfiguration,
Aws::MakeShared<AWSAuthV4Signer>(ALLOCATION_TAG, Aws::MakeShared<SimpleAWSCredentialsProvider>(ALLOCATION_TAG, credentials),
SERVICE_NAME, Aws::Region::ComputeSignerRegion(clientConfiguration.region)),
Aws::MakeShared<MigrationHubConfigErrorMarshaller>(ALLOCATION_TAG)),
m_executor(clientConfiguration.executor)
{
init(clientConfiguration);
}
MigrationHubConfigClient::MigrationHubConfigClient(const std::shared_ptr<AWSCredentialsProvider>& credentialsProvider,
const Client::ClientConfiguration& clientConfiguration) :
BASECLASS(clientConfiguration,
Aws::MakeShared<AWSAuthV4Signer>(ALLOCATION_TAG, credentialsProvider,
SERVICE_NAME, Aws::Region::ComputeSignerRegion(clientConfiguration.region)),
Aws::MakeShared<MigrationHubConfigErrorMarshaller>(ALLOCATION_TAG)),
m_executor(clientConfiguration.executor)
{
init(clientConfiguration);
}
MigrationHubConfigClient::~MigrationHubConfigClient()
{
}
void MigrationHubConfigClient::init(const ClientConfiguration& config)
{
SetServiceClientName("MigrationHub Config");
m_configScheme = SchemeMapper::ToString(config.scheme);
if (config.endpointOverride.empty())
{
m_uri = m_configScheme + "://" + MigrationHubConfigEndpoint::ForRegion(config.region, config.useDualStack);
}
else
{
OverrideEndpoint(config.endpointOverride);
}
}
void MigrationHubConfigClient::OverrideEndpoint(const Aws::String& endpoint)
{
if (endpoint.compare(0, 7, "http://") == 0 || endpoint.compare(0, 8, "https://") == 0)
{
m_uri = endpoint;
}
else
{
m_uri = m_configScheme + "://" + endpoint;
}
}
CreateHomeRegionControlOutcome MigrationHubConfigClient::CreateHomeRegionControl(const CreateHomeRegionControlRequest& request) const
{
Aws::Http::URI uri = m_uri;
Aws::StringStream ss;
ss << "/";
uri.SetPath(uri.GetPath() + ss.str());
return CreateHomeRegionControlOutcome(MakeRequest(uri, request, Aws::Http::HttpMethod::HTTP_POST, Aws::Auth::SIGV4_SIGNER));
}
CreateHomeRegionControlOutcomeCallable MigrationHubConfigClient::CreateHomeRegionControlCallable(const CreateHomeRegionControlRequest& request) const
{
auto task = Aws::MakeShared< std::packaged_task< CreateHomeRegionControlOutcome() > >(ALLOCATION_TAG, [this, request](){ return this->CreateHomeRegionControl(request); } );
auto packagedFunction = [task]() { (*task)(); };
m_executor->Submit(packagedFunction);
return task->get_future();
}
void MigrationHubConfigClient::CreateHomeRegionControlAsync(const CreateHomeRegionControlRequest& request, const CreateHomeRegionControlResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
m_executor->Submit( [this, request, handler, context](){ this->CreateHomeRegionControlAsyncHelper( request, handler, context ); } );
}
void MigrationHubConfigClient::CreateHomeRegionControlAsyncHelper(const CreateHomeRegionControlRequest& request, const CreateHomeRegionControlResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
handler(this, request, CreateHomeRegionControl(request), context);
}
DescribeHomeRegionControlsOutcome MigrationHubConfigClient::DescribeHomeRegionControls(const DescribeHomeRegionControlsRequest& request) const
{
Aws::Http::URI uri = m_uri;
Aws::StringStream ss;
ss << "/";
uri.SetPath(uri.GetPath() + ss.str());
return DescribeHomeRegionControlsOutcome(MakeRequest(uri, request, Aws::Http::HttpMethod::HTTP_POST, Aws::Auth::SIGV4_SIGNER));
}
DescribeHomeRegionControlsOutcomeCallable MigrationHubConfigClient::DescribeHomeRegionControlsCallable(const DescribeHomeRegionControlsRequest& request) const
{
auto task = Aws::MakeShared< std::packaged_task< DescribeHomeRegionControlsOutcome() > >(ALLOCATION_TAG, [this, request](){ return this->DescribeHomeRegionControls(request); } );
auto packagedFunction = [task]() { (*task)(); };
m_executor->Submit(packagedFunction);
return task->get_future();
}
void MigrationHubConfigClient::DescribeHomeRegionControlsAsync(const DescribeHomeRegionControlsRequest& request, const DescribeHomeRegionControlsResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
m_executor->Submit( [this, request, handler, context](){ this->DescribeHomeRegionControlsAsyncHelper( request, handler, context ); } );
}
void MigrationHubConfigClient::DescribeHomeRegionControlsAsyncHelper(const DescribeHomeRegionControlsRequest& request, const DescribeHomeRegionControlsResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
handler(this, request, DescribeHomeRegionControls(request), context);
}
GetHomeRegionOutcome MigrationHubConfigClient::GetHomeRegion(const GetHomeRegionRequest& request) const
{
Aws::Http::URI uri = m_uri;
Aws::StringStream ss;
ss << "/";
uri.SetPath(uri.GetPath() + ss.str());
return GetHomeRegionOutcome(MakeRequest(uri, request, Aws::Http::HttpMethod::HTTP_POST, Aws::Auth::SIGV4_SIGNER));
}
GetHomeRegionOutcomeCallable MigrationHubConfigClient::GetHomeRegionCallable(const GetHomeRegionRequest& request) const
{
auto task = Aws::MakeShared< std::packaged_task< GetHomeRegionOutcome() > >(ALLOCATION_TAG, [this, request](){ return this->GetHomeRegion(request); } );
auto packagedFunction = [task]() { (*task)(); };
m_executor->Submit(packagedFunction);
return task->get_future();
}
void MigrationHubConfigClient::GetHomeRegionAsync(const GetHomeRegionRequest& request, const GetHomeRegionResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
m_executor->Submit( [this, request, handler, context](){ this->GetHomeRegionAsyncHelper( request, handler, context ); } );
}
void MigrationHubConfigClient::GetHomeRegionAsyncHelper(const GetHomeRegionRequest& request, const GetHomeRegionResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
handler(this, request, GetHomeRegion(request), context);
}

View File

@@ -0,0 +1,64 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/migrationhub-config/MigrationHubConfigEndpoint.h>
#include <aws/core/utils/memory/stl/AWSStringStream.h>
#include <aws/core/utils/HashingUtils.h>
using namespace Aws;
using namespace Aws::MigrationHubConfig;
namespace Aws
{
namespace MigrationHubConfig
{
namespace MigrationHubConfigEndpoint
{
static const int CN_NORTH_1_HASH = Aws::Utils::HashingUtils::HashString("cn-north-1");
static const int CN_NORTHWEST_1_HASH = Aws::Utils::HashingUtils::HashString("cn-northwest-1");
static const int US_ISO_EAST_1_HASH = Aws::Utils::HashingUtils::HashString("us-iso-east-1");
static const int US_ISOB_EAST_1_HASH = Aws::Utils::HashingUtils::HashString("us-isob-east-1");
Aws::String ForRegion(const Aws::String& regionName, bool useDualStack)
{
// Fallback to us-east-1 if global endpoint does not exists.
Aws::String region = regionName == Aws::Region::AWS_GLOBAL ? Aws::Region::US_EAST_1 : regionName;
auto hash = Aws::Utils::HashingUtils::HashString(region.c_str());
Aws::StringStream ss;
ss << "migrationhub-config" << ".";
if(useDualStack)
{
ss << "dualstack.";
}
ss << region;
if (hash == CN_NORTH_1_HASH || hash == CN_NORTHWEST_1_HASH)
{
ss << ".amazonaws.com.cn";
}
else if (hash == US_ISO_EAST_1_HASH)
{
ss << ".c2s.ic.gov";
}
else if (hash == US_ISOB_EAST_1_HASH)
{
ss << ".sc2s.sgov.gov";
}
else
{
ss << ".amazonaws.com";
}
return ss.str();
}
} // namespace MigrationHubConfigEndpoint
} // namespace MigrationHubConfig
} // namespace Aws

View File

@@ -0,0 +1,22 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/core/client/AWSError.h>
#include <aws/migrationhub-config/MigrationHubConfigErrorMarshaller.h>
#include <aws/migrationhub-config/MigrationHubConfigErrors.h>
using namespace Aws::Client;
using namespace Aws::MigrationHubConfig;
AWSError<CoreErrors> MigrationHubConfigErrorMarshaller::FindErrorByName(const char* errorName) const
{
AWSError<CoreErrors> error = MigrationHubConfigErrorMapper::GetErrorForName(errorName);
if(error.GetErrorType() != CoreErrors::UNKNOWN)
{
return error;
}
return AWSErrorMarshaller::FindErrorByName(errorName);
}

View File

@@ -0,0 +1,50 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/core/client/AWSError.h>
#include <aws/core/utils/HashingUtils.h>
#include <aws/migrationhub-config/MigrationHubConfigErrors.h>
#include <aws/migrationhub-config/model/ThrottlingException.h>
using namespace Aws::Client;
using namespace Aws::Utils;
using namespace Aws::MigrationHubConfig;
using namespace Aws::MigrationHubConfig::Model;
namespace Aws
{
namespace MigrationHubConfig
{
template<> AWS_MIGRATIONHUBCONFIG_API ThrottlingException MigrationHubConfigError::GetModeledError()
{
assert(this->GetErrorType() == MigrationHubConfigErrors::THROTTLING);
return ThrottlingException(this->GetJsonPayload().View());
}
namespace MigrationHubConfigErrorMapper
{
static const int DRY_RUN_OPERATION_HASH = HashingUtils::HashString("DryRunOperation");
static const int INVALID_INPUT_HASH = HashingUtils::HashString("InvalidInputException");
AWSError<CoreErrors> GetErrorForName(const char* errorName)
{
int hashCode = HashingUtils::HashString(errorName);
if (hashCode == DRY_RUN_OPERATION_HASH)
{
return AWSError<CoreErrors>(static_cast<CoreErrors>(MigrationHubConfigErrors::DRY_RUN_OPERATION), false);
}
else if (hashCode == INVALID_INPUT_HASH)
{
return AWSError<CoreErrors>(static_cast<CoreErrors>(MigrationHubConfigErrors::INVALID_INPUT), false);
}
return AWSError<CoreErrors>(CoreErrors::UNKNOWN, false);
}
} // namespace MigrationHubConfigErrorMapper
} // namespace MigrationHubConfig
} // namespace Aws

View File

@@ -0,0 +1,58 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/migrationhub-config/model/CreateHomeRegionControlRequest.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <utility>
using namespace Aws::MigrationHubConfig::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
CreateHomeRegionControlRequest::CreateHomeRegionControlRequest() :
m_homeRegionHasBeenSet(false),
m_targetHasBeenSet(false),
m_dryRun(false),
m_dryRunHasBeenSet(false)
{
}
Aws::String CreateHomeRegionControlRequest::SerializePayload() const
{
JsonValue payload;
if(m_homeRegionHasBeenSet)
{
payload.WithString("HomeRegion", m_homeRegion);
}
if(m_targetHasBeenSet)
{
payload.WithObject("Target", m_target.Jsonize());
}
if(m_dryRunHasBeenSet)
{
payload.WithBool("DryRun", m_dryRun);
}
return payload.View().WriteReadable();
}
Aws::Http::HeaderValueCollection CreateHomeRegionControlRequest::GetRequestSpecificHeaders() const
{
Aws::Http::HeaderValueCollection headers;
headers.insert(Aws::Http::HeaderValuePair("X-Amz-Target", "AWSMigrationHubMultiAccountService.CreateHomeRegionControl"));
return headers;
}

View File

@@ -0,0 +1,40 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/migrationhub-config/model/CreateHomeRegionControlResult.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <aws/core/AmazonWebServiceResult.h>
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/UnreferencedParam.h>
#include <utility>
using namespace Aws::MigrationHubConfig::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
using namespace Aws;
CreateHomeRegionControlResult::CreateHomeRegionControlResult()
{
}
CreateHomeRegionControlResult::CreateHomeRegionControlResult(const Aws::AmazonWebServiceResult<JsonValue>& result)
{
*this = result;
}
CreateHomeRegionControlResult& CreateHomeRegionControlResult::operator =(const Aws::AmazonWebServiceResult<JsonValue>& result)
{
JsonView jsonValue = result.GetPayload().View();
if(jsonValue.ValueExists("HomeRegionControl"))
{
m_homeRegionControl = jsonValue.GetObject("HomeRegionControl");
}
return *this;
}

View File

@@ -0,0 +1,72 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/migrationhub-config/model/DescribeHomeRegionControlsRequest.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <utility>
using namespace Aws::MigrationHubConfig::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
DescribeHomeRegionControlsRequest::DescribeHomeRegionControlsRequest() :
m_controlIdHasBeenSet(false),
m_homeRegionHasBeenSet(false),
m_targetHasBeenSet(false),
m_maxResults(0),
m_maxResultsHasBeenSet(false),
m_nextTokenHasBeenSet(false)
{
}
Aws::String DescribeHomeRegionControlsRequest::SerializePayload() const
{
JsonValue payload;
if(m_controlIdHasBeenSet)
{
payload.WithString("ControlId", m_controlId);
}
if(m_homeRegionHasBeenSet)
{
payload.WithString("HomeRegion", m_homeRegion);
}
if(m_targetHasBeenSet)
{
payload.WithObject("Target", m_target.Jsonize());
}
if(m_maxResultsHasBeenSet)
{
payload.WithInteger("MaxResults", m_maxResults);
}
if(m_nextTokenHasBeenSet)
{
payload.WithString("NextToken", m_nextToken);
}
return payload.View().WriteReadable();
}
Aws::Http::HeaderValueCollection DescribeHomeRegionControlsRequest::GetRequestSpecificHeaders() const
{
Aws::Http::HeaderValueCollection headers;
headers.insert(Aws::Http::HeaderValuePair("X-Amz-Target", "AWSMigrationHubMultiAccountService.DescribeHomeRegionControls"));
return headers;
}

View File

@@ -0,0 +1,49 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/migrationhub-config/model/DescribeHomeRegionControlsResult.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <aws/core/AmazonWebServiceResult.h>
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/UnreferencedParam.h>
#include <utility>
using namespace Aws::MigrationHubConfig::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
using namespace Aws;
DescribeHomeRegionControlsResult::DescribeHomeRegionControlsResult()
{
}
DescribeHomeRegionControlsResult::DescribeHomeRegionControlsResult(const Aws::AmazonWebServiceResult<JsonValue>& result)
{
*this = result;
}
DescribeHomeRegionControlsResult& DescribeHomeRegionControlsResult::operator =(const Aws::AmazonWebServiceResult<JsonValue>& result)
{
JsonView jsonValue = result.GetPayload().View();
if(jsonValue.ValueExists("HomeRegionControls"))
{
Array<JsonView> homeRegionControlsJsonList = jsonValue.GetArray("HomeRegionControls");
for(unsigned homeRegionControlsIndex = 0; homeRegionControlsIndex < homeRegionControlsJsonList.GetLength(); ++homeRegionControlsIndex)
{
m_homeRegionControls.push_back(homeRegionControlsJsonList[homeRegionControlsIndex].AsObject());
}
}
if(jsonValue.ValueExists("NextToken"))
{
m_nextToken = jsonValue.GetString("NextToken");
}
return *this;
}

View File

@@ -0,0 +1,34 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/migrationhub-config/model/GetHomeRegionRequest.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <utility>
using namespace Aws::MigrationHubConfig::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
GetHomeRegionRequest::GetHomeRegionRequest()
{
}
Aws::String GetHomeRegionRequest::SerializePayload() const
{
return "{}";
}
Aws::Http::HeaderValueCollection GetHomeRegionRequest::GetRequestSpecificHeaders() const
{
Aws::Http::HeaderValueCollection headers;
headers.insert(Aws::Http::HeaderValuePair("X-Amz-Target", "AWSMigrationHubMultiAccountService.GetHomeRegion"));
return headers;
}

View File

@@ -0,0 +1,40 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/migrationhub-config/model/GetHomeRegionResult.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <aws/core/AmazonWebServiceResult.h>
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/UnreferencedParam.h>
#include <utility>
using namespace Aws::MigrationHubConfig::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
using namespace Aws;
GetHomeRegionResult::GetHomeRegionResult()
{
}
GetHomeRegionResult::GetHomeRegionResult(const Aws::AmazonWebServiceResult<JsonValue>& result)
{
*this = result;
}
GetHomeRegionResult& GetHomeRegionResult::operator =(const Aws::AmazonWebServiceResult<JsonValue>& result)
{
JsonView jsonValue = result.GetPayload().View();
if(jsonValue.ValueExists("HomeRegion"))
{
m_homeRegion = jsonValue.GetString("HomeRegion");
}
return *this;
}

View File

@@ -0,0 +1,103 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/migrationhub-config/model/HomeRegionControl.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <utility>
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
namespace Aws
{
namespace MigrationHubConfig
{
namespace Model
{
HomeRegionControl::HomeRegionControl() :
m_controlIdHasBeenSet(false),
m_homeRegionHasBeenSet(false),
m_targetHasBeenSet(false),
m_requestedTimeHasBeenSet(false)
{
}
HomeRegionControl::HomeRegionControl(JsonView jsonValue) :
m_controlIdHasBeenSet(false),
m_homeRegionHasBeenSet(false),
m_targetHasBeenSet(false),
m_requestedTimeHasBeenSet(false)
{
*this = jsonValue;
}
HomeRegionControl& HomeRegionControl::operator =(JsonView jsonValue)
{
if(jsonValue.ValueExists("ControlId"))
{
m_controlId = jsonValue.GetString("ControlId");
m_controlIdHasBeenSet = true;
}
if(jsonValue.ValueExists("HomeRegion"))
{
m_homeRegion = jsonValue.GetString("HomeRegion");
m_homeRegionHasBeenSet = true;
}
if(jsonValue.ValueExists("Target"))
{
m_target = jsonValue.GetObject("Target");
m_targetHasBeenSet = true;
}
if(jsonValue.ValueExists("RequestedTime"))
{
m_requestedTime = jsonValue.GetDouble("RequestedTime");
m_requestedTimeHasBeenSet = true;
}
return *this;
}
JsonValue HomeRegionControl::Jsonize() const
{
JsonValue payload;
if(m_controlIdHasBeenSet)
{
payload.WithString("ControlId", m_controlId);
}
if(m_homeRegionHasBeenSet)
{
payload.WithString("HomeRegion", m_homeRegion);
}
if(m_targetHasBeenSet)
{
payload.WithObject("Target", m_target.Jsonize());
}
if(m_requestedTimeHasBeenSet)
{
payload.WithDouble("RequestedTime", m_requestedTime.SecondsWithMSPrecision());
}
return payload;
}
} // namespace Model
} // namespace MigrationHubConfig
} // namespace Aws

View File

@@ -0,0 +1,75 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/migrationhub-config/model/Target.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <utility>
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
namespace Aws
{
namespace MigrationHubConfig
{
namespace Model
{
Target::Target() :
m_type(TargetType::NOT_SET),
m_typeHasBeenSet(false),
m_idHasBeenSet(false)
{
}
Target::Target(JsonView jsonValue) :
m_type(TargetType::NOT_SET),
m_typeHasBeenSet(false),
m_idHasBeenSet(false)
{
*this = jsonValue;
}
Target& Target::operator =(JsonView jsonValue)
{
if(jsonValue.ValueExists("Type"))
{
m_type = TargetTypeMapper::GetTargetTypeForName(jsonValue.GetString("Type"));
m_typeHasBeenSet = true;
}
if(jsonValue.ValueExists("Id"))
{
m_id = jsonValue.GetString("Id");
m_idHasBeenSet = true;
}
return *this;
}
JsonValue Target::Jsonize() const
{
JsonValue payload;
if(m_typeHasBeenSet)
{
payload.WithString("Type", TargetTypeMapper::GetNameForTargetType(m_type));
}
if(m_idHasBeenSet)
{
payload.WithString("Id", m_id);
}
return payload;
}
} // namespace Model
} // namespace MigrationHubConfig
} // namespace Aws

View File

@@ -0,0 +1,63 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/migrationhub-config/model/TargetType.h>
#include <aws/core/utils/HashingUtils.h>
#include <aws/core/Globals.h>
#include <aws/core/utils/EnumParseOverflowContainer.h>
using namespace Aws::Utils;
namespace Aws
{
namespace MigrationHubConfig
{
namespace Model
{
namespace TargetTypeMapper
{
static const int ACCOUNT_HASH = HashingUtils::HashString("ACCOUNT");
TargetType GetTargetTypeForName(const Aws::String& name)
{
int hashCode = HashingUtils::HashString(name.c_str());
if (hashCode == ACCOUNT_HASH)
{
return TargetType::ACCOUNT;
}
EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
if(overflowContainer)
{
overflowContainer->StoreOverflow(hashCode, name);
return static_cast<TargetType>(hashCode);
}
return TargetType::NOT_SET;
}
Aws::String GetNameForTargetType(TargetType enumValue)
{
switch(enumValue)
{
case TargetType::ACCOUNT:
return "ACCOUNT";
default:
EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
if(overflowContainer)
{
return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue));
}
return {};
}
}
} // namespace TargetTypeMapper
} // namespace Model
} // namespace MigrationHubConfig
} // namespace Aws

View File

@@ -0,0 +1,76 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/migrationhub-config/model/ThrottlingException.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <utility>
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
namespace Aws
{
namespace MigrationHubConfig
{
namespace Model
{
ThrottlingException::ThrottlingException() :
m_messageHasBeenSet(false),
m_retryAfterSeconds(0),
m_retryAfterSecondsHasBeenSet(false)
{
}
ThrottlingException::ThrottlingException(JsonView jsonValue) :
m_messageHasBeenSet(false),
m_retryAfterSeconds(0),
m_retryAfterSecondsHasBeenSet(false)
{
*this = jsonValue;
}
ThrottlingException& ThrottlingException::operator =(JsonView jsonValue)
{
if(jsonValue.ValueExists("Message"))
{
m_message = jsonValue.GetString("Message");
m_messageHasBeenSet = true;
}
if(jsonValue.ValueExists("RetryAfterSeconds"))
{
m_retryAfterSeconds = jsonValue.GetInteger("RetryAfterSeconds");
m_retryAfterSecondsHasBeenSet = true;
}
return *this;
}
JsonValue ThrottlingException::Jsonize() const
{
JsonValue payload;
if(m_messageHasBeenSet)
{
payload.WithString("Message", m_message);
}
if(m_retryAfterSecondsHasBeenSet)
{
payload.WithInteger("RetryAfterSeconds", m_retryAfterSeconds);
}
return payload;
}
} // namespace Model
} // namespace MigrationHubConfig
} // namespace Aws