From 6876310a8533e69e72364c9aa51c00d00289de22 Mon Sep 17 00:00:00 2001 From: sdk-team Date: Wed, 21 Aug 2019 20:11:35 +0800 Subject: [PATCH] Move StartExecution params to body. --- CHANGELOG | 3 + VERSION | 2 +- fnf/CMakeLists.txt | 110 +++++ fnf/include/alibabacloud/fnf/FnfClient.h | 142 +++++++ fnf/src/FnfClient.cc | 485 +++++++++++++++++++++++ 5 files changed, 741 insertions(+), 1 deletion(-) create mode 100644 fnf/CMakeLists.txt create mode 100644 fnf/include/alibabacloud/fnf/FnfClient.h create mode 100644 fnf/src/FnfClient.cc diff --git a/CHANGELOG b/CHANGELOG index 8f9e6e88e..38f1dac11 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +2019-08-21 Version 1.36.93 +- Move StartExecution params to body. + 2019-08-21 Version 1.36.92 - Return backup job id when create backup. - Return backup set size when describe backups. diff --git a/VERSION b/VERSION index c3f1ae969..82af46180 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.92 \ No newline at end of file +1.36.93 \ No newline at end of file diff --git a/fnf/CMakeLists.txt b/fnf/CMakeLists.txt new file mode 100644 index 000000000..6cd1f2332 --- /dev/null +++ b/fnf/CMakeLists.txt @@ -0,0 +1,110 @@ +# +# Copyright 2009-2017 Alibaba Cloud All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +set(public_header_dir ${CMAKE_CURRENT_SOURCE_DIR}/../include) + +set(fnf_public_header + include/alibabacloud/fnf/FnfClient.h + include/alibabacloud/fnf/FnfExport.h ) + +set(fnf_public_header_model + include/alibabacloud/fnf/model/UpdateFlowRequest.h + include/alibabacloud/fnf/model/UpdateFlowResult.h + include/alibabacloud/fnf/model/ReportTaskFailedRequest.h + include/alibabacloud/fnf/model/ReportTaskFailedResult.h + include/alibabacloud/fnf/model/StopExecutionRequest.h + include/alibabacloud/fnf/model/StopExecutionResult.h + include/alibabacloud/fnf/model/StartExecutionRequest.h + include/alibabacloud/fnf/model/StartExecutionResult.h + include/alibabacloud/fnf/model/ListExecutionsRequest.h + include/alibabacloud/fnf/model/ListExecutionsResult.h + include/alibabacloud/fnf/model/ReportTaskSucceededRequest.h + include/alibabacloud/fnf/model/ReportTaskSucceededResult.h + include/alibabacloud/fnf/model/ListFlowsRequest.h + include/alibabacloud/fnf/model/ListFlowsResult.h ) + +set(fnf_src + src/FnfClient.cc + src/model/UpdateFlowRequest.cc + src/model/UpdateFlowResult.cc + src/model/ReportTaskFailedRequest.cc + src/model/ReportTaskFailedResult.cc + src/model/StopExecutionRequest.cc + src/model/StopExecutionResult.cc + src/model/StartExecutionRequest.cc + src/model/StartExecutionResult.cc + src/model/ListExecutionsRequest.cc + src/model/ListExecutionsResult.cc + src/model/ReportTaskSucceededRequest.cc + src/model/ReportTaskSucceededResult.cc + src/model/ListFlowsRequest.cc + src/model/ListFlowsResult.cc ) + +add_library(fnf ${LIB_TYPE} + ${fnf_public_header} + ${fnf_public_header_model} + ${fnf_src}) + +set_target_properties(fnf + PROPERTIES + LINKER_LANGUAGE CXX + ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin + OUTPUT_NAME ${TARGET_OUTPUT_NAME_PREFIX}fnf + ) + +if(${LIB_TYPE} STREQUAL "SHARED") + set_target_properties(fnf + PROPERTIES + DEFINE_SYMBOL ALIBABACLOUD_FNF_LIBRARY) +endif() + +target_include_directories(fnf + PRIVATE include + ${CMAKE_SOURCE_DIR}/core/include + ) +target_link_libraries(fnf + core) + +if(CMAKE_HOST_WIN32) + ExternalProject_Get_Property(jsoncpp INSTALL_DIR) + set(jsoncpp_install_dir ${INSTALL_DIR}) + add_dependencies(fnf + jsoncpp) + target_include_directories(fnf + PRIVATE ${jsoncpp_install_dir}/include) + target_link_libraries(fnf + ${jsoncpp_install_dir}/lib/jsoncpp.lib) + set_target_properties(fnf + PROPERTIES + COMPILE_OPTIONS "/bigobj") +else() + target_include_directories(fnf + PRIVATE /usr/include/jsoncpp) + target_link_libraries(fnf + jsoncpp) +endif() + +install(FILES ${fnf_public_header} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/fnf) +install(FILES ${fnf_public_header_model} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/fnf/model) +install(TARGETS fnf + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ) \ No newline at end of file diff --git a/fnf/include/alibabacloud/fnf/FnfClient.h b/fnf/include/alibabacloud/fnf/FnfClient.h new file mode 100644 index 000000000..e058ef003 --- /dev/null +++ b/fnf/include/alibabacloud/fnf/FnfClient.h @@ -0,0 +1,142 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ALIBABACLOUD_FNF_FNFCLIENT_H_ +#define ALIBABACLOUD_FNF_FNFCLIENT_H_ + +#include +#include +#include +#include +#include "FnfExport.h" +#include "model/UpdateFlowRequest.h" +#include "model/UpdateFlowResult.h" +#include "model/DeleteFlowRequest.h" +#include "model/DeleteFlowResult.h" +#include "model/CreateFlowRequest.h" +#include "model/CreateFlowResult.h" +#include "model/DescribeExecutionRequest.h" +#include "model/DescribeExecutionResult.h" +#include "model/ReportTaskFailedRequest.h" +#include "model/ReportTaskFailedResult.h" +#include "model/DescribeFlowRequest.h" +#include "model/DescribeFlowResult.h" +#include "model/StopExecutionRequest.h" +#include "model/StopExecutionResult.h" +#include "model/StartExecutionRequest.h" +#include "model/StartExecutionResult.h" +#include "model/GetExecutionHistoryRequest.h" +#include "model/GetExecutionHistoryResult.h" +#include "model/ListExecutionsRequest.h" +#include "model/ListExecutionsResult.h" +#include "model/ReportTaskSucceededRequest.h" +#include "model/ReportTaskSucceededResult.h" +#include "model/ListFlowsRequest.h" +#include "model/ListFlowsResult.h" + + +namespace AlibabaCloud +{ + namespace Fnf + { + class ALIBABACLOUD_FNF_EXPORT FnfClient : public RpcServiceClient + { + public: + typedef Outcome UpdateFlowOutcome; + typedef std::future UpdateFlowOutcomeCallable; + typedef std::function&)> UpdateFlowAsyncHandler; + typedef Outcome DeleteFlowOutcome; + typedef std::future DeleteFlowOutcomeCallable; + typedef std::function&)> DeleteFlowAsyncHandler; + typedef Outcome CreateFlowOutcome; + typedef std::future CreateFlowOutcomeCallable; + typedef std::function&)> CreateFlowAsyncHandler; + typedef Outcome DescribeExecutionOutcome; + typedef std::future DescribeExecutionOutcomeCallable; + typedef std::function&)> DescribeExecutionAsyncHandler; + typedef Outcome ReportTaskFailedOutcome; + typedef std::future ReportTaskFailedOutcomeCallable; + typedef std::function&)> ReportTaskFailedAsyncHandler; + typedef Outcome DescribeFlowOutcome; + typedef std::future DescribeFlowOutcomeCallable; + typedef std::function&)> DescribeFlowAsyncHandler; + typedef Outcome StopExecutionOutcome; + typedef std::future StopExecutionOutcomeCallable; + typedef std::function&)> StopExecutionAsyncHandler; + typedef Outcome StartExecutionOutcome; + typedef std::future StartExecutionOutcomeCallable; + typedef std::function&)> StartExecutionAsyncHandler; + typedef Outcome GetExecutionHistoryOutcome; + typedef std::future GetExecutionHistoryOutcomeCallable; + typedef std::function&)> GetExecutionHistoryAsyncHandler; + typedef Outcome ListExecutionsOutcome; + typedef std::future ListExecutionsOutcomeCallable; + typedef std::function&)> ListExecutionsAsyncHandler; + typedef Outcome ReportTaskSucceededOutcome; + typedef std::future ReportTaskSucceededOutcomeCallable; + typedef std::function&)> ReportTaskSucceededAsyncHandler; + typedef Outcome ListFlowsOutcome; + typedef std::future ListFlowsOutcomeCallable; + typedef std::function&)> ListFlowsAsyncHandler; + + FnfClient(const Credentials &credentials, const ClientConfiguration &configuration); + FnfClient(const std::shared_ptr &credentialsProvider, const ClientConfiguration &configuration); + FnfClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration); + ~FnfClient(); + UpdateFlowOutcome updateFlow(const Model::UpdateFlowRequest &request)const; + void updateFlowAsync(const Model::UpdateFlowRequest& request, const UpdateFlowAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + UpdateFlowOutcomeCallable updateFlowCallable(const Model::UpdateFlowRequest& request) const; + DeleteFlowOutcome deleteFlow(const Model::DeleteFlowRequest &request)const; + void deleteFlowAsync(const Model::DeleteFlowRequest& request, const DeleteFlowAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + DeleteFlowOutcomeCallable deleteFlowCallable(const Model::DeleteFlowRequest& request) const; + CreateFlowOutcome createFlow(const Model::CreateFlowRequest &request)const; + void createFlowAsync(const Model::CreateFlowRequest& request, const CreateFlowAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + CreateFlowOutcomeCallable createFlowCallable(const Model::CreateFlowRequest& request) const; + DescribeExecutionOutcome describeExecution(const Model::DescribeExecutionRequest &request)const; + void describeExecutionAsync(const Model::DescribeExecutionRequest& request, const DescribeExecutionAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + DescribeExecutionOutcomeCallable describeExecutionCallable(const Model::DescribeExecutionRequest& request) const; + ReportTaskFailedOutcome reportTaskFailed(const Model::ReportTaskFailedRequest &request)const; + void reportTaskFailedAsync(const Model::ReportTaskFailedRequest& request, const ReportTaskFailedAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + ReportTaskFailedOutcomeCallable reportTaskFailedCallable(const Model::ReportTaskFailedRequest& request) const; + DescribeFlowOutcome describeFlow(const Model::DescribeFlowRequest &request)const; + void describeFlowAsync(const Model::DescribeFlowRequest& request, const DescribeFlowAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + DescribeFlowOutcomeCallable describeFlowCallable(const Model::DescribeFlowRequest& request) const; + StopExecutionOutcome stopExecution(const Model::StopExecutionRequest &request)const; + void stopExecutionAsync(const Model::StopExecutionRequest& request, const StopExecutionAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + StopExecutionOutcomeCallable stopExecutionCallable(const Model::StopExecutionRequest& request) const; + StartExecutionOutcome startExecution(const Model::StartExecutionRequest &request)const; + void startExecutionAsync(const Model::StartExecutionRequest& request, const StartExecutionAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + StartExecutionOutcomeCallable startExecutionCallable(const Model::StartExecutionRequest& request) const; + GetExecutionHistoryOutcome getExecutionHistory(const Model::GetExecutionHistoryRequest &request)const; + void getExecutionHistoryAsync(const Model::GetExecutionHistoryRequest& request, const GetExecutionHistoryAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + GetExecutionHistoryOutcomeCallable getExecutionHistoryCallable(const Model::GetExecutionHistoryRequest& request) const; + ListExecutionsOutcome listExecutions(const Model::ListExecutionsRequest &request)const; + void listExecutionsAsync(const Model::ListExecutionsRequest& request, const ListExecutionsAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + ListExecutionsOutcomeCallable listExecutionsCallable(const Model::ListExecutionsRequest& request) const; + ReportTaskSucceededOutcome reportTaskSucceeded(const Model::ReportTaskSucceededRequest &request)const; + void reportTaskSucceededAsync(const Model::ReportTaskSucceededRequest& request, const ReportTaskSucceededAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + ReportTaskSucceededOutcomeCallable reportTaskSucceededCallable(const Model::ReportTaskSucceededRequest& request) const; + ListFlowsOutcome listFlows(const Model::ListFlowsRequest &request)const; + void listFlowsAsync(const Model::ListFlowsRequest& request, const ListFlowsAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + ListFlowsOutcomeCallable listFlowsCallable(const Model::ListFlowsRequest& request) const; + + private: + std::shared_ptr endpointProvider_; + }; + } +} + +#endif // !ALIBABACLOUD_FNF_FNFCLIENT_H_ diff --git a/fnf/src/FnfClient.cc b/fnf/src/FnfClient.cc new file mode 100644 index 000000000..dfa64b77c --- /dev/null +++ b/fnf/src/FnfClient.cc @@ -0,0 +1,485 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +using namespace AlibabaCloud; +using namespace AlibabaCloud::Location; +using namespace AlibabaCloud::Fnf; +using namespace AlibabaCloud::Fnf::Model; + +namespace +{ + const std::string SERVICE_NAME = "fnf"; +} + +FnfClient::FnfClient(const Credentials &credentials, const ClientConfiguration &configuration) : + RpcServiceClient(SERVICE_NAME, std::make_shared(credentials), configuration) +{ + auto locationClient = std::make_shared(credentials, configuration); + endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), SERVICE_NAME, "fnf"); +} + +FnfClient::FnfClient(const std::shared_ptr& credentialsProvider, const ClientConfiguration & configuration) : + RpcServiceClient(SERVICE_NAME, credentialsProvider, configuration) +{ + auto locationClient = std::make_shared(credentialsProvider, configuration); + endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), SERVICE_NAME, "fnf"); +} + +FnfClient::FnfClient(const std::string & accessKeyId, const std::string & accessKeySecret, const ClientConfiguration & configuration) : + RpcServiceClient(SERVICE_NAME, std::make_shared(accessKeyId, accessKeySecret), configuration) +{ + auto locationClient = std::make_shared(accessKeyId, accessKeySecret, configuration); + endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), SERVICE_NAME, "fnf"); +} + +FnfClient::~FnfClient() +{} + +FnfClient::UpdateFlowOutcome FnfClient::updateFlow(const UpdateFlowRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return UpdateFlowOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return UpdateFlowOutcome(UpdateFlowResult(outcome.result())); + else + return UpdateFlowOutcome(outcome.error()); +} + +void FnfClient::updateFlowAsync(const UpdateFlowRequest& request, const UpdateFlowAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, updateFlow(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +FnfClient::UpdateFlowOutcomeCallable FnfClient::updateFlowCallable(const UpdateFlowRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->updateFlow(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + +FnfClient::DeleteFlowOutcome FnfClient::deleteFlow(const DeleteFlowRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return DeleteFlowOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return DeleteFlowOutcome(DeleteFlowResult(outcome.result())); + else + return DeleteFlowOutcome(outcome.error()); +} + +void FnfClient::deleteFlowAsync(const DeleteFlowRequest& request, const DeleteFlowAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, deleteFlow(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +FnfClient::DeleteFlowOutcomeCallable FnfClient::deleteFlowCallable(const DeleteFlowRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->deleteFlow(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + +FnfClient::CreateFlowOutcome FnfClient::createFlow(const CreateFlowRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return CreateFlowOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return CreateFlowOutcome(CreateFlowResult(outcome.result())); + else + return CreateFlowOutcome(outcome.error()); +} + +void FnfClient::createFlowAsync(const CreateFlowRequest& request, const CreateFlowAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, createFlow(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +FnfClient::CreateFlowOutcomeCallable FnfClient::createFlowCallable(const CreateFlowRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->createFlow(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + +FnfClient::DescribeExecutionOutcome FnfClient::describeExecution(const DescribeExecutionRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return DescribeExecutionOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return DescribeExecutionOutcome(DescribeExecutionResult(outcome.result())); + else + return DescribeExecutionOutcome(outcome.error()); +} + +void FnfClient::describeExecutionAsync(const DescribeExecutionRequest& request, const DescribeExecutionAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, describeExecution(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +FnfClient::DescribeExecutionOutcomeCallable FnfClient::describeExecutionCallable(const DescribeExecutionRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->describeExecution(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + +FnfClient::ReportTaskFailedOutcome FnfClient::reportTaskFailed(const ReportTaskFailedRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return ReportTaskFailedOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return ReportTaskFailedOutcome(ReportTaskFailedResult(outcome.result())); + else + return ReportTaskFailedOutcome(outcome.error()); +} + +void FnfClient::reportTaskFailedAsync(const ReportTaskFailedRequest& request, const ReportTaskFailedAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, reportTaskFailed(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +FnfClient::ReportTaskFailedOutcomeCallable FnfClient::reportTaskFailedCallable(const ReportTaskFailedRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->reportTaskFailed(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + +FnfClient::DescribeFlowOutcome FnfClient::describeFlow(const DescribeFlowRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return DescribeFlowOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return DescribeFlowOutcome(DescribeFlowResult(outcome.result())); + else + return DescribeFlowOutcome(outcome.error()); +} + +void FnfClient::describeFlowAsync(const DescribeFlowRequest& request, const DescribeFlowAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, describeFlow(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +FnfClient::DescribeFlowOutcomeCallable FnfClient::describeFlowCallable(const DescribeFlowRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->describeFlow(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + +FnfClient::StopExecutionOutcome FnfClient::stopExecution(const StopExecutionRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return StopExecutionOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return StopExecutionOutcome(StopExecutionResult(outcome.result())); + else + return StopExecutionOutcome(outcome.error()); +} + +void FnfClient::stopExecutionAsync(const StopExecutionRequest& request, const StopExecutionAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, stopExecution(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +FnfClient::StopExecutionOutcomeCallable FnfClient::stopExecutionCallable(const StopExecutionRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->stopExecution(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + +FnfClient::StartExecutionOutcome FnfClient::startExecution(const StartExecutionRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return StartExecutionOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return StartExecutionOutcome(StartExecutionResult(outcome.result())); + else + return StartExecutionOutcome(outcome.error()); +} + +void FnfClient::startExecutionAsync(const StartExecutionRequest& request, const StartExecutionAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, startExecution(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +FnfClient::StartExecutionOutcomeCallable FnfClient::startExecutionCallable(const StartExecutionRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->startExecution(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + +FnfClient::GetExecutionHistoryOutcome FnfClient::getExecutionHistory(const GetExecutionHistoryRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return GetExecutionHistoryOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return GetExecutionHistoryOutcome(GetExecutionHistoryResult(outcome.result())); + else + return GetExecutionHistoryOutcome(outcome.error()); +} + +void FnfClient::getExecutionHistoryAsync(const GetExecutionHistoryRequest& request, const GetExecutionHistoryAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, getExecutionHistory(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +FnfClient::GetExecutionHistoryOutcomeCallable FnfClient::getExecutionHistoryCallable(const GetExecutionHistoryRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->getExecutionHistory(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + +FnfClient::ListExecutionsOutcome FnfClient::listExecutions(const ListExecutionsRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return ListExecutionsOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return ListExecutionsOutcome(ListExecutionsResult(outcome.result())); + else + return ListExecutionsOutcome(outcome.error()); +} + +void FnfClient::listExecutionsAsync(const ListExecutionsRequest& request, const ListExecutionsAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, listExecutions(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +FnfClient::ListExecutionsOutcomeCallable FnfClient::listExecutionsCallable(const ListExecutionsRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->listExecutions(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + +FnfClient::ReportTaskSucceededOutcome FnfClient::reportTaskSucceeded(const ReportTaskSucceededRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return ReportTaskSucceededOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return ReportTaskSucceededOutcome(ReportTaskSucceededResult(outcome.result())); + else + return ReportTaskSucceededOutcome(outcome.error()); +} + +void FnfClient::reportTaskSucceededAsync(const ReportTaskSucceededRequest& request, const ReportTaskSucceededAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, reportTaskSucceeded(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +FnfClient::ReportTaskSucceededOutcomeCallable FnfClient::reportTaskSucceededCallable(const ReportTaskSucceededRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->reportTaskSucceeded(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + +FnfClient::ListFlowsOutcome FnfClient::listFlows(const ListFlowsRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return ListFlowsOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return ListFlowsOutcome(ListFlowsResult(outcome.result())); + else + return ListFlowsOutcome(outcome.error()); +} + +void FnfClient::listFlowsAsync(const ListFlowsRequest& request, const ListFlowsAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, listFlows(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +FnfClient::ListFlowsOutcomeCallable FnfClient::listFlowsCallable(const ListFlowsRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->listFlows(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} +