From d0b781c4c519d4103196795ab37154f8aaedb03d Mon Sep 17 00:00:00 2001 From: sdk-team Date: Mon, 20 Nov 2023 02:41:36 +0000 Subject: [PATCH] GetDomainFields add request field --- VERSION | 2 +- oms/CMakeLists.txt | 86 ++++++++++++++++++ oms/include/alibabacloud/oms/OmsClient.h | 54 +++++++++++ oms/include/alibabacloud/oms/OmsExport.h | 32 +++++++ .../oms/model/GetDomainFieldsRequest.h | 45 ++++++++++ .../oms/model/GetDomainFieldsResult.h | 53 +++++++++++ oms/src/OmsClient.cc | 89 +++++++++++++++++++ oms/src/model/GetDomainFieldsRequest.cc | 45 ++++++++++ oms/src/model/GetDomainFieldsResult.cc | 58 ++++++++++++ 9 files changed, 463 insertions(+), 1 deletion(-) create mode 100644 oms/CMakeLists.txt create mode 100644 oms/include/alibabacloud/oms/OmsClient.h create mode 100644 oms/include/alibabacloud/oms/OmsExport.h create mode 100644 oms/include/alibabacloud/oms/model/GetDomainFieldsRequest.h create mode 100644 oms/include/alibabacloud/oms/model/GetDomainFieldsResult.h create mode 100644 oms/src/OmsClient.cc create mode 100644 oms/src/model/GetDomainFieldsRequest.cc create mode 100644 oms/src/model/GetDomainFieldsResult.cc diff --git a/VERSION b/VERSION index b033bf97f..73bffb837 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.1806 \ No newline at end of file +1.36.1807 \ No newline at end of file diff --git a/oms/CMakeLists.txt b/oms/CMakeLists.txt new file mode 100644 index 000000000..7c9e2474d --- /dev/null +++ b/oms/CMakeLists.txt @@ -0,0 +1,86 @@ +# +# 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(oms_public_header + include/alibabacloud/oms/OmsClient.h + include/alibabacloud/oms/OmsExport.h ) + +set(oms_public_header_model + include/alibabacloud/oms/model/GetDomainFieldsRequest.h + include/alibabacloud/oms/model/GetDomainFieldsResult.h ) + +set(oms_src + src/OmsClient.cc + src/model/GetDomainFieldsRequest.cc + src/model/GetDomainFieldsResult.cc ) + +add_library(oms ${LIB_TYPE} + ${oms_public_header} + ${oms_public_header_model} + ${oms_src}) + +set_target_properties(oms + 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}oms + ) + +if(${LIB_TYPE} STREQUAL "SHARED") + set_target_properties(oms + PROPERTIES + DEFINE_SYMBOL ALIBABACLOUD_OMS_LIBRARY) +endif() + +target_include_directories(oms + PRIVATE include + ${CMAKE_SOURCE_DIR}/core/include + ) +target_link_libraries(oms + core) + +if(CMAKE_HOST_WIN32) + ExternalProject_Get_Property(jsoncpp INSTALL_DIR) + set(jsoncpp_install_dir ${INSTALL_DIR}) + add_dependencies(oms + jsoncpp) + target_include_directories(oms + PRIVATE ${jsoncpp_install_dir}/include) + target_link_libraries(oms + ${jsoncpp_install_dir}/lib/jsoncpp.lib) + set_target_properties(oms + PROPERTIES + COMPILE_OPTIONS "/bigobj") +else() + target_include_directories(oms + PRIVATE /usr/include/jsoncpp) + target_link_libraries(oms + jsoncpp) +endif() + +install(FILES ${oms_public_header} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/oms) +install(FILES ${oms_public_header_model} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/oms/model) +install(TARGETS oms + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ) \ No newline at end of file diff --git a/oms/include/alibabacloud/oms/OmsClient.h b/oms/include/alibabacloud/oms/OmsClient.h new file mode 100644 index 000000000..7120b9da0 --- /dev/null +++ b/oms/include/alibabacloud/oms/OmsClient.h @@ -0,0 +1,54 @@ +/* + * 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_OMS_OMSCLIENT_H_ +#define ALIBABACLOUD_OMS_OMSCLIENT_H_ + +#include +#include +#include +#include +#include "OmsExport.h" +#include "model/GetDomainFieldsRequest.h" +#include "model/GetDomainFieldsResult.h" + + +namespace AlibabaCloud +{ + namespace Oms + { + class ALIBABACLOUD_OMS_EXPORT OmsClient : public RpcServiceClient + { + public: + typedef Outcome GetDomainFieldsOutcome; + typedef std::future GetDomainFieldsOutcomeCallable; + typedef std::function&)> GetDomainFieldsAsyncHandler; + + OmsClient(const Credentials &credentials, const ClientConfiguration &configuration); + OmsClient(const std::shared_ptr &credentialsProvider, const ClientConfiguration &configuration); + OmsClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration); + ~OmsClient(); + GetDomainFieldsOutcome getDomainFields(const Model::GetDomainFieldsRequest &request)const; + void getDomainFieldsAsync(const Model::GetDomainFieldsRequest& request, const GetDomainFieldsAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + GetDomainFieldsOutcomeCallable getDomainFieldsCallable(const Model::GetDomainFieldsRequest& request) const; + + private: + std::shared_ptr endpointProvider_; + }; + } +} + +#endif // !ALIBABACLOUD_OMS_OMSCLIENT_H_ diff --git a/oms/include/alibabacloud/oms/OmsExport.h b/oms/include/alibabacloud/oms/OmsExport.h new file mode 100644 index 000000000..94d81adaf --- /dev/null +++ b/oms/include/alibabacloud/oms/OmsExport.h @@ -0,0 +1,32 @@ +/* + * 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_OMS_OMSEXPORT_H_ +#define ALIBABACLOUD_OMS_OMSEXPORT_H_ + +#include + +#if defined(ALIBABACLOUD_SHARED) +# if defined(ALIBABACLOUD_OMS_LIBRARY) +# define ALIBABACLOUD_OMS_EXPORT ALIBABACLOUD_DECL_EXPORT +# else +# define ALIBABACLOUD_OMS_EXPORT ALIBABACLOUD_DECL_IMPORT +# endif +#else +# define ALIBABACLOUD_OMS_EXPORT +#endif + +#endif // !ALIBABACLOUD_OMS_OMSEXPORT_H_ \ No newline at end of file diff --git a/oms/include/alibabacloud/oms/model/GetDomainFieldsRequest.h b/oms/include/alibabacloud/oms/model/GetDomainFieldsRequest.h new file mode 100644 index 000000000..4d015da64 --- /dev/null +++ b/oms/include/alibabacloud/oms/model/GetDomainFieldsRequest.h @@ -0,0 +1,45 @@ +/* + * 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_OMS_MODEL_GETDOMAINFIELDSREQUEST_H_ +#define ALIBABACLOUD_OMS_MODEL_GETDOMAINFIELDSREQUEST_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud { +namespace Oms { +namespace Model { +class ALIBABACLOUD_OMS_EXPORT GetDomainFieldsRequest : public RpcServiceRequest { +public: + GetDomainFieldsRequest(); + ~GetDomainFieldsRequest(); + std::string getDomainCode() const; + void setDomainCode(const std::string &domainCode); + bool getUseCache() const; + void setUseCache(bool useCache); + +private: + std::string domainCode_; + bool useCache_; +}; +} // namespace Model +} // namespace Oms +} // namespace AlibabaCloud +#endif // !ALIBABACLOUD_OMS_MODEL_GETDOMAINFIELDSREQUEST_H_ diff --git a/oms/include/alibabacloud/oms/model/GetDomainFieldsResult.h b/oms/include/alibabacloud/oms/model/GetDomainFieldsResult.h new file mode 100644 index 000000000..867586f5b --- /dev/null +++ b/oms/include/alibabacloud/oms/model/GetDomainFieldsResult.h @@ -0,0 +1,53 @@ +/* + * 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_OMS_MODEL_GETDOMAINFIELDSRESULT_H_ +#define ALIBABACLOUD_OMS_MODEL_GETDOMAINFIELDSRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Oms + { + namespace Model + { + class ALIBABACLOUD_OMS_EXPORT GetDomainFieldsResult : public ServiceResult + { + public: + + + GetDomainFieldsResult(); + explicit GetDomainFieldsResult(const std::string &payload); + ~GetDomainFieldsResult(); + std::string getDomainCode()const; + std::string getData()const; + + protected: + void parse(const std::string &payload); + private: + std::string domainCode_; + std::string data_; + + }; + } + } +} +#endif // !ALIBABACLOUD_OMS_MODEL_GETDOMAINFIELDSRESULT_H_ \ No newline at end of file diff --git a/oms/src/OmsClient.cc b/oms/src/OmsClient.cc new file mode 100644 index 000000000..ceeef1a50 --- /dev/null +++ b/oms/src/OmsClient.cc @@ -0,0 +1,89 @@ +/* + * 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::Oms; +using namespace AlibabaCloud::Oms::Model; + +namespace +{ + const std::string SERVICE_NAME = "Oms"; +} + +OmsClient::OmsClient(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, ""); +} + +OmsClient::OmsClient(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, ""); +} + +OmsClient::OmsClient(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, ""); +} + +OmsClient::~OmsClient() +{} + +OmsClient::GetDomainFieldsOutcome OmsClient::getDomainFields(const GetDomainFieldsRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return GetDomainFieldsOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return GetDomainFieldsOutcome(GetDomainFieldsResult(outcome.result())); + else + return GetDomainFieldsOutcome(outcome.error()); +} + +void OmsClient::getDomainFieldsAsync(const GetDomainFieldsRequest& request, const GetDomainFieldsAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, getDomainFields(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +OmsClient::GetDomainFieldsOutcomeCallable OmsClient::getDomainFieldsCallable(const GetDomainFieldsRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->getDomainFields(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + diff --git a/oms/src/model/GetDomainFieldsRequest.cc b/oms/src/model/GetDomainFieldsRequest.cc new file mode 100644 index 000000000..8b121cf6c --- /dev/null +++ b/oms/src/model/GetDomainFieldsRequest.cc @@ -0,0 +1,45 @@ +/* + * 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 + +using AlibabaCloud::Oms::Model::GetDomainFieldsRequest; + +GetDomainFieldsRequest::GetDomainFieldsRequest() + : RpcServiceRequest("oms", "2019-05-27", "GetDomainFields") { + setMethod(HttpRequest::Method::Get); +} + +GetDomainFieldsRequest::~GetDomainFieldsRequest() {} + +std::string GetDomainFieldsRequest::getDomainCode() const { + return domainCode_; +} + +void GetDomainFieldsRequest::setDomainCode(const std::string &domainCode) { + domainCode_ = domainCode; + setParameter(std::string("DomainCode"), domainCode); +} + +bool GetDomainFieldsRequest::getUseCache() const { + return useCache_; +} + +void GetDomainFieldsRequest::setUseCache(bool useCache) { + useCache_ = useCache; + setParameter(std::string("UseCache"), useCache ? "true" : "false"); +} + diff --git a/oms/src/model/GetDomainFieldsResult.cc b/oms/src/model/GetDomainFieldsResult.cc new file mode 100644 index 000000000..5ac26ef43 --- /dev/null +++ b/oms/src/model/GetDomainFieldsResult.cc @@ -0,0 +1,58 @@ +/* + * 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::Oms; +using namespace AlibabaCloud::Oms::Model; + +GetDomainFieldsResult::GetDomainFieldsResult() : + ServiceResult() +{} + +GetDomainFieldsResult::GetDomainFieldsResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +GetDomainFieldsResult::~GetDomainFieldsResult() +{} + +void GetDomainFieldsResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + if(!value["Data"].isNull()) + data_ = value["Data"].asString(); + if(!value["DomainCode"].isNull()) + domainCode_ = value["DomainCode"].asString(); + +} + +std::string GetDomainFieldsResult::getDomainCode()const +{ + return domainCode_; +} + +std::string GetDomainFieldsResult::getData()const +{ + return data_; +} +