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,76 @@
add_project(aws-cpp-sdk-workmailmessageflow "C++ SDK for the AWS workmailmessageflow service" aws-cpp-sdk-core)
file(GLOB AWS_WORKMAILMESSAGEFLOW_HEADERS
"include/aws/workmailmessageflow/*.h"
)
file(GLOB AWS_WORKMAILMESSAGEFLOW_MODEL_HEADERS
"include/aws/workmailmessageflow/model/*.h"
)
file(GLOB AWS_WORKMAILMESSAGEFLOW_SOURCE
"source/*.cpp"
)
file(GLOB AWS_WORKMAILMESSAGEFLOW_MODEL_SOURCE
"source/model/*.cpp"
)
file(GLOB WORKMAILMESSAGEFLOW_UNIFIED_HEADERS
${AWS_WORKMAILMESSAGEFLOW_HEADERS}
${AWS_WORKMAILMESSAGEFLOW_MODEL_HEADERS}
)
file(GLOB WORKMAILMESSAGEFLOW_UNITY_SRC
${AWS_WORKMAILMESSAGEFLOW_SOURCE}
${AWS_WORKMAILMESSAGEFLOW_MODEL_SOURCE}
)
if(ENABLE_UNITY_BUILD)
enable_unity_build("WORKMAILMESSAGEFLOW" WORKMAILMESSAGEFLOW_UNITY_SRC)
endif()
file(GLOB WORKMAILMESSAGEFLOW_SRC
${WORKMAILMESSAGEFLOW_UNIFIED_HEADERS}
${WORKMAILMESSAGEFLOW_UNITY_SRC}
)
if(WIN32)
#if we are compiling for visual studio, create a sane directory tree.
if(MSVC)
source_group("Header Files\\aws\\workmailmessageflow" FILES ${AWS_WORKMAILMESSAGEFLOW_HEADERS})
source_group("Header Files\\aws\\workmailmessageflow\\model" FILES ${AWS_WORKMAILMESSAGEFLOW_MODEL_HEADERS})
source_group("Source Files" FILES ${AWS_WORKMAILMESSAGEFLOW_SOURCE})
source_group("Source Files\\model" FILES ${AWS_WORKMAILMESSAGEFLOW_MODEL_SOURCE})
endif(MSVC)
endif()
set(WORKMAILMESSAGEFLOW_INCLUDES
"${CMAKE_CURRENT_SOURCE_DIR}/include/"
)
add_library(${PROJECT_NAME} ${WORKMAILMESSAGEFLOW_SRC})
add_library(AWS::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
set_compiler_flags(${PROJECT_NAME})
set_compiler_warnings(${PROJECT_NAME})
if(USE_WINDOWS_DLL_SEMANTICS AND BUILD_SHARED_LIBS)
target_compile_definitions(${PROJECT_NAME} PRIVATE "AWS_WORKMAILMESSAGEFLOW_EXPORTS")
endif()
target_include_directories(${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
target_link_libraries(${PROJECT_NAME} PRIVATE ${PLATFORM_DEP_LIBS} ${PROJECT_LIBS})
setup_install()
install (FILES ${AWS_WORKMAILMESSAGEFLOW_HEADERS} DESTINATION ${INCLUDE_DIRECTORY}/aws/workmailmessageflow)
install (FILES ${AWS_WORKMAILMESSAGEFLOW_MODEL_HEADERS} DESTINATION ${INCLUDE_DIRECTORY}/aws/workmailmessageflow/model)
do_packaging()

View File

@@ -0,0 +1,136 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/workmailmessageflow/WorkMailMessageFlow_EXPORTS.h>
#include <aws/workmailmessageflow/WorkMailMessageFlowErrors.h>
#include <aws/core/client/AWSError.h>
#include <aws/core/client/ClientConfiguration.h>
#include <aws/core/client/AWSClient.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <aws/workmailmessageflow/model/GetRawMessageContentResult.h>
#include <aws/core/client/AsyncCallerContext.h>
#include <aws/core/http/HttpTypes.h>
#include <future>
#include <functional>
namespace Aws
{
namespace Http
{
class HttpClient;
class HttpClientFactory;
} // namespace Http
namespace Utils
{
template< typename R, typename E> class Outcome;
namespace Threading
{
class Executor;
} // namespace Threading
} // namespace Utils
namespace Auth
{
class AWSCredentials;
class AWSCredentialsProvider;
} // namespace Auth
namespace Client
{
class RetryStrategy;
} // namespace Client
namespace WorkMailMessageFlow
{
namespace Model
{
class GetRawMessageContentRequest;
typedef Aws::Utils::Outcome<GetRawMessageContentResult, WorkMailMessageFlowError> GetRawMessageContentOutcome;
typedef std::future<GetRawMessageContentOutcome> GetRawMessageContentOutcomeCallable;
} // namespace Model
class WorkMailMessageFlowClient;
typedef std::function<void(const WorkMailMessageFlowClient*, const Model::GetRawMessageContentRequest&, Model::GetRawMessageContentOutcome, const std::shared_ptr<const Aws::Client::AsyncCallerContext>&) > GetRawMessageContentResponseReceivedHandler;
/**
* <p>The WorkMail Message Flow API provides access to email messages as they are
* being sent and received by a WorkMail organization.</p>
*/
class AWS_WORKMAILMESSAGEFLOW_API WorkMailMessageFlowClient : public Aws::Client::AWSJsonClient
{
public:
typedef Aws::Client::AWSJsonClient BASECLASS;
/**
* Initializes client to use DefaultCredentialProviderChain, with default http client factory, and optional client config. If client config
* is not specified, it will be initialized to default values.
*/
WorkMailMessageFlowClient(const Aws::Client::ClientConfiguration& clientConfiguration = Aws::Client::ClientConfiguration());
/**
* Initializes client to use SimpleAWSCredentialsProvider, with default http client factory, and optional client config. If client config
* is not specified, it will be initialized to default values.
*/
WorkMailMessageFlowClient(const Aws::Auth::AWSCredentials& credentials, const Aws::Client::ClientConfiguration& clientConfiguration = Aws::Client::ClientConfiguration());
/**
* Initializes client to use specified credentials provider with specified client config. If http client factory is not supplied,
* the default http client factory will be used
*/
WorkMailMessageFlowClient(const std::shared_ptr<Aws::Auth::AWSCredentialsProvider>& credentialsProvider,
const Aws::Client::ClientConfiguration& clientConfiguration = Aws::Client::ClientConfiguration());
virtual ~WorkMailMessageFlowClient();
/**
* <p>Retrieves the raw content of an in-transit email message, in MIME format.
* </p><p><h3>See Also:</h3> <a
* href="http://docs.aws.amazon.com/goto/WebAPI/workmailmessageflow-2019-05-01/GetRawMessageContent">AWS
* API Reference</a></p>
*/
virtual Model::GetRawMessageContentOutcome GetRawMessageContent(const Model::GetRawMessageContentRequest& request) const;
/**
* <p>Retrieves the raw content of an in-transit email message, in MIME format.
* </p><p><h3>See Also:</h3> <a
* href="http://docs.aws.amazon.com/goto/WebAPI/workmailmessageflow-2019-05-01/GetRawMessageContent">AWS
* API Reference</a></p>
*
* returns a future to the operation so that it can be executed in parallel to other requests.
*/
virtual Model::GetRawMessageContentOutcomeCallable GetRawMessageContentCallable(const Model::GetRawMessageContentRequest& request) const;
/**
* <p>Retrieves the raw content of an in-transit email message, in MIME format.
* </p><p><h3>See Also:</h3> <a
* href="http://docs.aws.amazon.com/goto/WebAPI/workmailmessageflow-2019-05-01/GetRawMessageContent">AWS
* API Reference</a></p>
*
* Queues the request into a thread executor and triggers associated callback when operation has finished.
*/
virtual void GetRawMessageContentAsync(const Model::GetRawMessageContentRequest& request, const GetRawMessageContentResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr) const;
void OverrideEndpoint(const Aws::String& endpoint);
private:
void init(const Aws::Client::ClientConfiguration& clientConfiguration);
void GetRawMessageContentAsyncHelper(const Model::GetRawMessageContentRequest& request, const GetRawMessageContentResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const;
Aws::String m_uri;
Aws::String m_configScheme;
std::shared_ptr<Aws::Utils::Threading::Executor> m_executor;
};
} // namespace WorkMailMessageFlow
} // namespace Aws

View File

@@ -0,0 +1,21 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/workmailmessageflow/WorkMailMessageFlow_EXPORTS.h>
#include <aws/core/Region.h>
#include <aws/core/utils/memory/stl/AWSString.h>
namespace Aws
{
namespace WorkMailMessageFlow
{
namespace WorkMailMessageFlowEndpoint
{
AWS_WORKMAILMESSAGEFLOW_API Aws::String ForRegion(const Aws::String& regionName, bool useDualStack = false);
} // namespace WorkMailMessageFlowEndpoint
} // namespace WorkMailMessageFlow
} // namespace Aws

View File

@@ -0,0 +1,23 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/workmailmessageflow/WorkMailMessageFlow_EXPORTS.h>
#include <aws/core/client/AWSErrorMarshaller.h>
namespace Aws
{
namespace Client
{
class AWS_WORKMAILMESSAGEFLOW_API WorkMailMessageFlowErrorMarshaller : public Aws::Client::JsonErrorMarshaller
{
public:
Aws::Client::AWSError<Aws::Client::CoreErrors> FindErrorByName(const char* exceptionName) const override;
};
} // namespace Client
} // namespace Aws

View File

@@ -0,0 +1,72 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/core/client/AWSError.h>
#include <aws/core/client/CoreErrors.h>
#include <aws/workmailmessageflow/WorkMailMessageFlow_EXPORTS.h>
namespace Aws
{
namespace WorkMailMessageFlow
{
enum class WorkMailMessageFlowErrors
{
//From Core//
//////////////////////////////////////////////////////////////////////////////////////////
INCOMPLETE_SIGNATURE = 0,
INTERNAL_FAILURE = 1,
INVALID_ACTION = 2,
INVALID_CLIENT_TOKEN_ID = 3,
INVALID_PARAMETER_COMBINATION = 4,
INVALID_QUERY_PARAMETER = 5,
INVALID_PARAMETER_VALUE = 6,
MISSING_ACTION = 7, // SDK should never allow
MISSING_AUTHENTICATION_TOKEN = 8, // SDK should never allow
MISSING_PARAMETER = 9, // SDK should never allow
OPT_IN_REQUIRED = 10,
REQUEST_EXPIRED = 11,
SERVICE_UNAVAILABLE = 12,
THROTTLING = 13,
VALIDATION = 14,
ACCESS_DENIED = 15,
RESOURCE_NOT_FOUND = 16,
UNRECOGNIZED_CLIENT = 17,
MALFORMED_QUERY_STRING = 18,
SLOW_DOWN = 19,
REQUEST_TIME_TOO_SKEWED = 20,
INVALID_SIGNATURE = 21,
SIGNATURE_DOES_NOT_MATCH = 22,
INVALID_ACCESS_KEY_ID = 23,
REQUEST_TIMEOUT = 24,
NETWORK_CONNECTION = 99,
UNKNOWN = 100,
///////////////////////////////////////////////////////////////////////////////////////////
};
class AWS_WORKMAILMESSAGEFLOW_API WorkMailMessageFlowError : public Aws::Client::AWSError<WorkMailMessageFlowErrors>
{
public:
WorkMailMessageFlowError() {}
WorkMailMessageFlowError(const Aws::Client::AWSError<Aws::Client::CoreErrors>& rhs) : Aws::Client::AWSError<WorkMailMessageFlowErrors>(rhs) {}
WorkMailMessageFlowError(Aws::Client::AWSError<Aws::Client::CoreErrors>&& rhs) : Aws::Client::AWSError<WorkMailMessageFlowErrors>(rhs) {}
WorkMailMessageFlowError(const Aws::Client::AWSError<WorkMailMessageFlowErrors>& rhs) : Aws::Client::AWSError<WorkMailMessageFlowErrors>(rhs) {}
WorkMailMessageFlowError(Aws::Client::AWSError<WorkMailMessageFlowErrors>&& rhs) : Aws::Client::AWSError<WorkMailMessageFlowErrors>(rhs) {}
template <typename T>
T GetModeledError();
};
namespace WorkMailMessageFlowErrorMapper
{
AWS_WORKMAILMESSAGEFLOW_API Aws::Client::AWSError<Aws::Client::CoreErrors> GetErrorForName(const char* errorName);
}
} // namespace WorkMailMessageFlow
} // namespace Aws

View File

@@ -0,0 +1,42 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/workmailmessageflow/WorkMailMessageFlow_EXPORTS.h>
#include <aws/core/AmazonSerializableWebServiceRequest.h>
#include <aws/core/utils/UnreferencedParam.h>
#include <aws/core/http/HttpRequest.h>
namespace Aws
{
namespace WorkMailMessageFlow
{
class AWS_WORKMAILMESSAGEFLOW_API WorkMailMessageFlowRequest : public Aws::AmazonSerializableWebServiceRequest
{
public:
virtual ~WorkMailMessageFlowRequest () {}
void AddParametersToRequest(Aws::Http::HttpRequest& httpRequest) const { AWS_UNREFERENCED_PARAM(httpRequest); }
inline Aws::Http::HeaderValueCollection GetHeaders() const override
{
auto headers = GetRequestSpecificHeaders();
if(headers.size() == 0 || (headers.size() > 0 && headers.count(Aws::Http::CONTENT_TYPE_HEADER) == 0))
{
headers.emplace(Aws::Http::HeaderValuePair(Aws::Http::CONTENT_TYPE_HEADER, Aws::AMZN_JSON_CONTENT_TYPE_1_1 ));
}
headers.emplace(Aws::Http::HeaderValuePair(Aws::Http::API_VERSION_HEADER, "2019-05-01"));
return headers;
}
protected:
virtual Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const { return Aws::Http::HeaderValueCollection(); }
};
} // namespace WorkMailMessageFlow
} // namespace Aws

View File

@@ -0,0 +1,29 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#ifdef _MSC_VER
//disable windows complaining about max template size.
#pragma warning (disable : 4503)
#endif // _MSC_VER
#if defined (USE_WINDOWS_DLL_SEMANTICS) || defined (_WIN32)
#ifdef _MSC_VER
#pragma warning(disable : 4251)
#endif // _MSC_VER
#ifdef USE_IMPORT_EXPORT
#ifdef AWS_WORKMAILMESSAGEFLOW_EXPORTS
#define AWS_WORKMAILMESSAGEFLOW_API __declspec(dllexport)
#else
#define AWS_WORKMAILMESSAGEFLOW_API __declspec(dllimport)
#endif /* AWS_WORKMAILMESSAGEFLOW_EXPORTS */
#else
#define AWS_WORKMAILMESSAGEFLOW_API
#endif // USE_IMPORT_EXPORT
#else // defined (USE_WINDOWS_DLL_SEMANTICS) || defined (WIN32)
#define AWS_WORKMAILMESSAGEFLOW_API
#endif // defined (USE_WINDOWS_DLL_SEMANTICS) || defined (WIN32)

View File

@@ -0,0 +1,83 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/workmailmessageflow/WorkMailMessageFlow_EXPORTS.h>
#include <aws/workmailmessageflow/WorkMailMessageFlowRequest.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>
namespace Aws
{
namespace WorkMailMessageFlow
{
namespace Model
{
/**
*/
class AWS_WORKMAILMESSAGEFLOW_API GetRawMessageContentRequest : public WorkMailMessageFlowRequest
{
public:
GetRawMessageContentRequest();
// Service request name is the Operation name which will send this request out,
// each operation should has unique request name, so that we can get operation's name from this request.
// Note: this is not true for response, multiple operations may have the same response name,
// so we can not get operation's name from response.
inline virtual const char* GetServiceRequestName() const override { return "GetRawMessageContent"; }
Aws::String SerializePayload() const override;
/**
* <p>The identifier of the email message to retrieve.</p>
*/
inline const Aws::String& GetMessageId() const{ return m_messageId; }
/**
* <p>The identifier of the email message to retrieve.</p>
*/
inline bool MessageIdHasBeenSet() const { return m_messageIdHasBeenSet; }
/**
* <p>The identifier of the email message to retrieve.</p>
*/
inline void SetMessageId(const Aws::String& value) { m_messageIdHasBeenSet = true; m_messageId = value; }
/**
* <p>The identifier of the email message to retrieve.</p>
*/
inline void SetMessageId(Aws::String&& value) { m_messageIdHasBeenSet = true; m_messageId = std::move(value); }
/**
* <p>The identifier of the email message to retrieve.</p>
*/
inline void SetMessageId(const char* value) { m_messageIdHasBeenSet = true; m_messageId.assign(value); }
/**
* <p>The identifier of the email message to retrieve.</p>
*/
inline GetRawMessageContentRequest& WithMessageId(const Aws::String& value) { SetMessageId(value); return *this;}
/**
* <p>The identifier of the email message to retrieve.</p>
*/
inline GetRawMessageContentRequest& WithMessageId(Aws::String&& value) { SetMessageId(std::move(value)); return *this;}
/**
* <p>The identifier of the email message to retrieve.</p>
*/
inline GetRawMessageContentRequest& WithMessageId(const char* value) { SetMessageId(value); return *this;}
private:
Aws::String m_messageId;
bool m_messageIdHasBeenSet;
};
} // namespace Model
} // namespace WorkMailMessageFlow
} // namespace Aws

View File

@@ -0,0 +1,56 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/workmailmessageflow/WorkMailMessageFlow_EXPORTS.h>
#include <aws/core/utils/stream/ResponseStream.h>
#include <aws/core/utils/Array.h>
#include <utility>
namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;
namespace WorkMailMessageFlow
{
namespace Model
{
class AWS_WORKMAILMESSAGEFLOW_API GetRawMessageContentResult
{
public:
GetRawMessageContentResult();
//We have to define these because Microsoft doesn't auto generate them
GetRawMessageContentResult(GetRawMessageContentResult&&);
GetRawMessageContentResult& operator=(GetRawMessageContentResult&&);
//we delete these because Microsoft doesn't handle move generation correctly
//and we therefore don't trust them to get it right here either.
GetRawMessageContentResult(const GetRawMessageContentResult&) = delete;
GetRawMessageContentResult& operator=(const GetRawMessageContentResult&) = delete;
GetRawMessageContentResult(Aws::AmazonWebServiceResult<Aws::Utils::Stream::ResponseStream>&& result);
GetRawMessageContentResult& operator=(Aws::AmazonWebServiceResult<Aws::Utils::Stream::ResponseStream>&& result);
/**
* <p>The raw content of the email message, in MIME format.</p>
*/
inline Aws::IOStream& GetMessageContent() { return m_messageContent.GetUnderlyingStream(); }
/**
* <p>The raw content of the email message, in MIME format.</p>
*/
inline void ReplaceBody(Aws::IOStream* body) { m_messageContent = Aws::Utils::Stream::ResponseStream(body); }
private:
Aws::Utils::Stream::ResponseStream m_messageContent;
};
} // namespace Model
} // namespace WorkMailMessageFlow
} // namespace Aws

View File

@@ -0,0 +1,130 @@
/**
* 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/workmailmessageflow/WorkMailMessageFlowClient.h>
#include <aws/workmailmessageflow/WorkMailMessageFlowEndpoint.h>
#include <aws/workmailmessageflow/WorkMailMessageFlowErrorMarshaller.h>
#include <aws/workmailmessageflow/model/GetRawMessageContentRequest.h>
using namespace Aws;
using namespace Aws::Auth;
using namespace Aws::Client;
using namespace Aws::WorkMailMessageFlow;
using namespace Aws::WorkMailMessageFlow::Model;
using namespace Aws::Http;
using namespace Aws::Utils::Json;
static const char* SERVICE_NAME = "workmailmessageflow";
static const char* ALLOCATION_TAG = "WorkMailMessageFlowClient";
WorkMailMessageFlowClient::WorkMailMessageFlowClient(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<WorkMailMessageFlowErrorMarshaller>(ALLOCATION_TAG)),
m_executor(clientConfiguration.executor)
{
init(clientConfiguration);
}
WorkMailMessageFlowClient::WorkMailMessageFlowClient(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<WorkMailMessageFlowErrorMarshaller>(ALLOCATION_TAG)),
m_executor(clientConfiguration.executor)
{
init(clientConfiguration);
}
WorkMailMessageFlowClient::WorkMailMessageFlowClient(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<WorkMailMessageFlowErrorMarshaller>(ALLOCATION_TAG)),
m_executor(clientConfiguration.executor)
{
init(clientConfiguration);
}
WorkMailMessageFlowClient::~WorkMailMessageFlowClient()
{
}
void WorkMailMessageFlowClient::init(const ClientConfiguration& config)
{
SetServiceClientName("WorkMailMessageFlow");
m_configScheme = SchemeMapper::ToString(config.scheme);
if (config.endpointOverride.empty())
{
m_uri = m_configScheme + "://" + WorkMailMessageFlowEndpoint::ForRegion(config.region, config.useDualStack);
}
else
{
OverrideEndpoint(config.endpointOverride);
}
}
void WorkMailMessageFlowClient::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;
}
}
GetRawMessageContentOutcome WorkMailMessageFlowClient::GetRawMessageContent(const GetRawMessageContentRequest& request) const
{
if (!request.MessageIdHasBeenSet())
{
AWS_LOGSTREAM_ERROR("GetRawMessageContent", "Required field: MessageId, is not set");
return GetRawMessageContentOutcome(Aws::Client::AWSError<WorkMailMessageFlowErrors>(WorkMailMessageFlowErrors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [MessageId]", false));
}
Aws::Http::URI uri = m_uri;
Aws::StringStream ss;
ss << "/messages/";
ss << request.GetMessageId();
uri.SetPath(uri.GetPath() + ss.str());
return GetRawMessageContentOutcome(MakeRequestWithUnparsedResponse(uri, request, Aws::Http::HttpMethod::HTTP_GET));
}
GetRawMessageContentOutcomeCallable WorkMailMessageFlowClient::GetRawMessageContentCallable(const GetRawMessageContentRequest& request) const
{
auto task = Aws::MakeShared< std::packaged_task< GetRawMessageContentOutcome() > >(ALLOCATION_TAG, [this, request](){ return this->GetRawMessageContent(request); } );
auto packagedFunction = [task]() { (*task)(); };
m_executor->Submit(packagedFunction);
return task->get_future();
}
void WorkMailMessageFlowClient::GetRawMessageContentAsync(const GetRawMessageContentRequest& request, const GetRawMessageContentResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
m_executor->Submit( [this, request, handler, context](){ this->GetRawMessageContentAsyncHelper( request, handler, context ); } );
}
void WorkMailMessageFlowClient::GetRawMessageContentAsyncHelper(const GetRawMessageContentRequest& request, const GetRawMessageContentResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
handler(this, request, GetRawMessageContent(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/workmailmessageflow/WorkMailMessageFlowEndpoint.h>
#include <aws/core/utils/memory/stl/AWSStringStream.h>
#include <aws/core/utils/HashingUtils.h>
using namespace Aws;
using namespace Aws::WorkMailMessageFlow;
namespace Aws
{
namespace WorkMailMessageFlow
{
namespace WorkMailMessageFlowEndpoint
{
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 << "workmailmessageflow" << ".";
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 WorkMailMessageFlowEndpoint
} // namespace WorkMailMessageFlow
} // 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/workmailmessageflow/WorkMailMessageFlowErrorMarshaller.h>
#include <aws/workmailmessageflow/WorkMailMessageFlowErrors.h>
using namespace Aws::Client;
using namespace Aws::WorkMailMessageFlow;
AWSError<CoreErrors> WorkMailMessageFlowErrorMarshaller::FindErrorByName(const char* errorName) const
{
AWSError<CoreErrors> error = WorkMailMessageFlowErrorMapper::GetErrorForName(errorName);
if(error.GetErrorType() != CoreErrors::UNKNOWN)
{
return error;
}
return AWSErrorMarshaller::FindErrorByName(errorName);
}

View File

@@ -0,0 +1,32 @@
/**
* 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/workmailmessageflow/WorkMailMessageFlowErrors.h>
#include <aws/core/utils/UnreferencedParam.h>
using namespace Aws::Client;
using namespace Aws::Utils;
using namespace Aws::WorkMailMessageFlow;
namespace Aws
{
namespace WorkMailMessageFlow
{
namespace WorkMailMessageFlowErrorMapper
{
AWSError<CoreErrors> GetErrorForName(const char* errorName)
{
AWS_UNREFERENCED_PARAM(errorName);
return AWSError<CoreErrors>(CoreErrors::UNKNOWN, false);
}
} // namespace WorkMailMessageFlowErrorMapper
} // namespace WorkMailMessageFlow
} // namespace Aws

View File

@@ -0,0 +1,27 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/workmailmessageflow/model/GetRawMessageContentRequest.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <utility>
using namespace Aws::WorkMailMessageFlow::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
GetRawMessageContentRequest::GetRawMessageContentRequest() :
m_messageIdHasBeenSet(false)
{
}
Aws::String GetRawMessageContentRequest::SerializePayload() const
{
return {};
}

View File

@@ -0,0 +1,49 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/workmailmessageflow/model/GetRawMessageContentResult.h>
#include <aws/core/AmazonWebServiceResult.h>
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/HashingUtils.h>
#include <utility>
using namespace Aws::WorkMailMessageFlow::Model;
using namespace Aws::Utils::Stream;
using namespace Aws::Utils;
using namespace Aws;
GetRawMessageContentResult::GetRawMessageContentResult()
{
}
GetRawMessageContentResult::GetRawMessageContentResult(GetRawMessageContentResult&& toMove) :
m_messageContent(std::move(toMove.m_messageContent))
{
}
GetRawMessageContentResult& GetRawMessageContentResult::operator=(GetRawMessageContentResult&& toMove)
{
if(this == &toMove)
{
return *this;
}
m_messageContent = std::move(toMove.m_messageContent);
return *this;
}
GetRawMessageContentResult::GetRawMessageContentResult(Aws::AmazonWebServiceResult<ResponseStream>&& result)
{
*this = std::move(result);
}
GetRawMessageContentResult& GetRawMessageContentResult::operator =(Aws::AmazonWebServiceResult<ResponseStream>&& result)
{
m_messageContent = result.TakeOwnershipOfPayload();
return *this;
}