diff --git a/VERSION b/VERSION index a0b2be3b4..289bdd350 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.1959 \ No newline at end of file +1.36.1960 \ No newline at end of file diff --git a/dybaseapi/CMakeLists.txt b/dybaseapi/CMakeLists.txt new file mode 100644 index 000000000..eebd517fa --- /dev/null +++ b/dybaseapi/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(dybaseapi_public_header + include/alibabacloud/dybaseapi/DybaseapiClient.h + include/alibabacloud/dybaseapi/DybaseapiExport.h ) + +set(dybaseapi_public_header_model + include/alibabacloud/dybaseapi/model/QueryTokenForMnsQueueRequest.h + include/alibabacloud/dybaseapi/model/QueryTokenForMnsQueueResult.h ) + +set(dybaseapi_src + src/DybaseapiClient.cc + src/model/QueryTokenForMnsQueueRequest.cc + src/model/QueryTokenForMnsQueueResult.cc ) + +add_library(dybaseapi ${LIB_TYPE} + ${dybaseapi_public_header} + ${dybaseapi_public_header_model} + ${dybaseapi_src}) + +set_target_properties(dybaseapi + 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}dybaseapi + ) + +if(${LIB_TYPE} STREQUAL "SHARED") + set_target_properties(dybaseapi + PROPERTIES + DEFINE_SYMBOL ALIBABACLOUD_DYBASEAPI_LIBRARY) +endif() + +target_include_directories(dybaseapi + PRIVATE include + ${CMAKE_SOURCE_DIR}/core/include + ) +target_link_libraries(dybaseapi + core) + +if(CMAKE_HOST_WIN32) + ExternalProject_Get_Property(jsoncpp INSTALL_DIR) + set(jsoncpp_install_dir ${INSTALL_DIR}) + add_dependencies(dybaseapi + jsoncpp) + target_include_directories(dybaseapi + PRIVATE ${jsoncpp_install_dir}/include) + target_link_libraries(dybaseapi + ${jsoncpp_install_dir}/lib/jsoncpp.lib) + set_target_properties(dybaseapi + PROPERTIES + COMPILE_OPTIONS "/bigobj") +else() + target_include_directories(dybaseapi + PRIVATE /usr/include/jsoncpp) + target_link_libraries(dybaseapi + jsoncpp) +endif() + +install(FILES ${dybaseapi_public_header} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/dybaseapi) +install(FILES ${dybaseapi_public_header_model} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/dybaseapi/model) +install(TARGETS dybaseapi + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ) \ No newline at end of file diff --git a/dybaseapi/include/alibabacloud/dybaseapi/DybaseapiClient.h b/dybaseapi/include/alibabacloud/dybaseapi/DybaseapiClient.h new file mode 100644 index 000000000..60bbf1c1b --- /dev/null +++ b/dybaseapi/include/alibabacloud/dybaseapi/DybaseapiClient.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_DYBASEAPI_DYBASEAPICLIENT_H_ +#define ALIBABACLOUD_DYBASEAPI_DYBASEAPICLIENT_H_ + +#include +#include +#include +#include +#include "DybaseapiExport.h" +#include "model/QueryTokenForMnsQueueRequest.h" +#include "model/QueryTokenForMnsQueueResult.h" + + +namespace AlibabaCloud +{ + namespace Dybaseapi + { + class ALIBABACLOUD_DYBASEAPI_EXPORT DybaseapiClient : public RpcServiceClient + { + public: + typedef Outcome QueryTokenForMnsQueueOutcome; + typedef std::future QueryTokenForMnsQueueOutcomeCallable; + typedef std::function&)> QueryTokenForMnsQueueAsyncHandler; + + DybaseapiClient(const Credentials &credentials, const ClientConfiguration &configuration); + DybaseapiClient(const std::shared_ptr &credentialsProvider, const ClientConfiguration &configuration); + DybaseapiClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration); + ~DybaseapiClient(); + QueryTokenForMnsQueueOutcome queryTokenForMnsQueue(const Model::QueryTokenForMnsQueueRequest &request)const; + void queryTokenForMnsQueueAsync(const Model::QueryTokenForMnsQueueRequest& request, const QueryTokenForMnsQueueAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + QueryTokenForMnsQueueOutcomeCallable queryTokenForMnsQueueCallable(const Model::QueryTokenForMnsQueueRequest& request) const; + + private: + std::shared_ptr endpointProvider_; + }; + } +} + +#endif // !ALIBABACLOUD_DYBASEAPI_DYBASEAPICLIENT_H_ diff --git a/dybaseapi/include/alibabacloud/dybaseapi/DybaseapiExport.h b/dybaseapi/include/alibabacloud/dybaseapi/DybaseapiExport.h new file mode 100644 index 000000000..045ef3baa --- /dev/null +++ b/dybaseapi/include/alibabacloud/dybaseapi/DybaseapiExport.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_DYBASEAPI_DYBASEAPIEXPORT_H_ +#define ALIBABACLOUD_DYBASEAPI_DYBASEAPIEXPORT_H_ + +#include + +#if defined(ALIBABACLOUD_SHARED) +# if defined(ALIBABACLOUD_DYBASEAPI_LIBRARY) +# define ALIBABACLOUD_DYBASEAPI_EXPORT ALIBABACLOUD_DECL_EXPORT +# else +# define ALIBABACLOUD_DYBASEAPI_EXPORT ALIBABACLOUD_DECL_IMPORT +# endif +#else +# define ALIBABACLOUD_DYBASEAPI_EXPORT +#endif + +#endif // !ALIBABACLOUD_DYBASEAPI_DYBASEAPIEXPORT_H_ \ No newline at end of file diff --git a/dybaseapi/include/alibabacloud/dybaseapi/model/QueryTokenForMnsQueueRequest.h b/dybaseapi/include/alibabacloud/dybaseapi/model/QueryTokenForMnsQueueRequest.h new file mode 100644 index 000000000..8ce159f9a --- /dev/null +++ b/dybaseapi/include/alibabacloud/dybaseapi/model/QueryTokenForMnsQueueRequest.h @@ -0,0 +1,57 @@ +/* + * 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_DYBASEAPI_MODEL_QUERYTOKENFORMNSQUEUEREQUEST_H_ +#define ALIBABACLOUD_DYBASEAPI_MODEL_QUERYTOKENFORMNSQUEUEREQUEST_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud { +namespace Dybaseapi { +namespace Model { +class ALIBABACLOUD_DYBASEAPI_EXPORT QueryTokenForMnsQueueRequest : public RpcServiceRequest { +public: + QueryTokenForMnsQueueRequest(); + ~QueryTokenForMnsQueueRequest(); + std::string getQueueName() const; + void setQueueName(const std::string &queueName); + long getResourceOwnerId() const; + void setResourceOwnerId(long resourceOwnerId); + std::string getResourceOwnerAccount() const; + void setResourceOwnerAccount(const std::string &resourceOwnerAccount); + std::string getMessageType() const; + void setMessageType(const std::string &messageType); + long getOwnerId() const; + void setOwnerId(long ownerId); + std::string getAccessKeyId() const; + void setAccessKeyId(const std::string &accessKeyId); + +private: + std::string queueName_; + long resourceOwnerId_; + std::string resourceOwnerAccount_; + std::string messageType_; + long ownerId_; + std::string accessKeyId_; +}; +} // namespace Model +} // namespace Dybaseapi +} // namespace AlibabaCloud +#endif // !ALIBABACLOUD_DYBASEAPI_MODEL_QUERYTOKENFORMNSQUEUEREQUEST_H_ diff --git a/dybaseapi/include/alibabacloud/dybaseapi/model/QueryTokenForMnsQueueResult.h b/dybaseapi/include/alibabacloud/dybaseapi/model/QueryTokenForMnsQueueResult.h new file mode 100644 index 000000000..2abb70240 --- /dev/null +++ b/dybaseapi/include/alibabacloud/dybaseapi/model/QueryTokenForMnsQueueResult.h @@ -0,0 +1,63 @@ +/* + * 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_DYBASEAPI_MODEL_QUERYTOKENFORMNSQUEUERESULT_H_ +#define ALIBABACLOUD_DYBASEAPI_MODEL_QUERYTOKENFORMNSQUEUERESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Dybaseapi + { + namespace Model + { + class ALIBABACLOUD_DYBASEAPI_EXPORT QueryTokenForMnsQueueResult : public ServiceResult + { + public: + struct MessageTokenDTO + { + std::string securityToken; + std::string accessKeyId; + std::string accessKeySecret; + std::string createTime; + std::string expireTime; + }; + + + QueryTokenForMnsQueueResult(); + explicit QueryTokenForMnsQueueResult(const std::string &payload); + ~QueryTokenForMnsQueueResult(); + MessageTokenDTO getMessageTokenDTO()const; + std::string getMessage()const; + std::string getCode()const; + + protected: + void parse(const std::string &payload); + private: + MessageTokenDTO messageTokenDTO_; + std::string message_; + std::string code_; + + }; + } + } +} +#endif // !ALIBABACLOUD_DYBASEAPI_MODEL_QUERYTOKENFORMNSQUEUERESULT_H_ \ No newline at end of file diff --git a/dybaseapi/src/DybaseapiClient.cc b/dybaseapi/src/DybaseapiClient.cc new file mode 100644 index 000000000..7f1c6c9e6 --- /dev/null +++ b/dybaseapi/src/DybaseapiClient.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::Dybaseapi; +using namespace AlibabaCloud::Dybaseapi::Model; + +namespace +{ + const std::string SERVICE_NAME = "Dybaseapi"; +} + +DybaseapiClient::DybaseapiClient(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, ""); +} + +DybaseapiClient::DybaseapiClient(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, ""); +} + +DybaseapiClient::DybaseapiClient(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, ""); +} + +DybaseapiClient::~DybaseapiClient() +{} + +DybaseapiClient::QueryTokenForMnsQueueOutcome DybaseapiClient::queryTokenForMnsQueue(const QueryTokenForMnsQueueRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return QueryTokenForMnsQueueOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return QueryTokenForMnsQueueOutcome(QueryTokenForMnsQueueResult(outcome.result())); + else + return QueryTokenForMnsQueueOutcome(outcome.error()); +} + +void DybaseapiClient::queryTokenForMnsQueueAsync(const QueryTokenForMnsQueueRequest& request, const QueryTokenForMnsQueueAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, queryTokenForMnsQueue(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +DybaseapiClient::QueryTokenForMnsQueueOutcomeCallable DybaseapiClient::queryTokenForMnsQueueCallable(const QueryTokenForMnsQueueRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->queryTokenForMnsQueue(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + diff --git a/dybaseapi/src/model/QueryTokenForMnsQueueRequest.cc b/dybaseapi/src/model/QueryTokenForMnsQueueRequest.cc new file mode 100644 index 000000000..dd5456c95 --- /dev/null +++ b/dybaseapi/src/model/QueryTokenForMnsQueueRequest.cc @@ -0,0 +1,81 @@ +/* + * 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::Dybaseapi::Model::QueryTokenForMnsQueueRequest; + +QueryTokenForMnsQueueRequest::QueryTokenForMnsQueueRequest() + : RpcServiceRequest("dybaseapi", "2017-05-25", "QueryTokenForMnsQueue") { + setMethod(HttpRequest::Method::Post); +} + +QueryTokenForMnsQueueRequest::~QueryTokenForMnsQueueRequest() {} + +std::string QueryTokenForMnsQueueRequest::getQueueName() const { + return queueName_; +} + +void QueryTokenForMnsQueueRequest::setQueueName(const std::string &queueName) { + queueName_ = queueName; + setParameter(std::string("QueueName"), queueName); +} + +long QueryTokenForMnsQueueRequest::getResourceOwnerId() const { + return resourceOwnerId_; +} + +void QueryTokenForMnsQueueRequest::setResourceOwnerId(long resourceOwnerId) { + resourceOwnerId_ = resourceOwnerId; + setParameter(std::string("ResourceOwnerId"), std::to_string(resourceOwnerId)); +} + +std::string QueryTokenForMnsQueueRequest::getResourceOwnerAccount() const { + return resourceOwnerAccount_; +} + +void QueryTokenForMnsQueueRequest::setResourceOwnerAccount(const std::string &resourceOwnerAccount) { + resourceOwnerAccount_ = resourceOwnerAccount; + setParameter(std::string("ResourceOwnerAccount"), resourceOwnerAccount); +} + +std::string QueryTokenForMnsQueueRequest::getMessageType() const { + return messageType_; +} + +void QueryTokenForMnsQueueRequest::setMessageType(const std::string &messageType) { + messageType_ = messageType; + setParameter(std::string("MessageType"), messageType); +} + +long QueryTokenForMnsQueueRequest::getOwnerId() const { + return ownerId_; +} + +void QueryTokenForMnsQueueRequest::setOwnerId(long ownerId) { + ownerId_ = ownerId; + setParameter(std::string("OwnerId"), std::to_string(ownerId)); +} + +std::string QueryTokenForMnsQueueRequest::getAccessKeyId() const { + return accessKeyId_; +} + +void QueryTokenForMnsQueueRequest::setAccessKeyId(const std::string &accessKeyId) { + accessKeyId_ = accessKeyId; + setParameter(std::string("AccessKeyId"), accessKeyId); +} + diff --git a/dybaseapi/src/model/QueryTokenForMnsQueueResult.cc b/dybaseapi/src/model/QueryTokenForMnsQueueResult.cc new file mode 100644 index 000000000..77dddc4e8 --- /dev/null +++ b/dybaseapi/src/model/QueryTokenForMnsQueueResult.cc @@ -0,0 +1,74 @@ +/* + * 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::Dybaseapi; +using namespace AlibabaCloud::Dybaseapi::Model; + +QueryTokenForMnsQueueResult::QueryTokenForMnsQueueResult() : + ServiceResult() +{} + +QueryTokenForMnsQueueResult::QueryTokenForMnsQueueResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +QueryTokenForMnsQueueResult::~QueryTokenForMnsQueueResult() +{} + +void QueryTokenForMnsQueueResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + auto messageTokenDTONode = value["MessageTokenDTO"]; + if(!messageTokenDTONode["AccessKeySecret"].isNull()) + messageTokenDTO_.accessKeySecret = messageTokenDTONode["AccessKeySecret"].asString(); + if(!messageTokenDTONode["ExpireTime"].isNull()) + messageTokenDTO_.expireTime = messageTokenDTONode["ExpireTime"].asString(); + if(!messageTokenDTONode["SecurityToken"].isNull()) + messageTokenDTO_.securityToken = messageTokenDTONode["SecurityToken"].asString(); + if(!messageTokenDTONode["AccessKeyId"].isNull()) + messageTokenDTO_.accessKeyId = messageTokenDTONode["AccessKeyId"].asString(); + if(!messageTokenDTONode["CreateTime"].isNull()) + messageTokenDTO_.createTime = messageTokenDTONode["CreateTime"].asString(); + if(!value["Code"].isNull()) + code_ = value["Code"].asString(); + if(!value["Message"].isNull()) + message_ = value["Message"].asString(); + +} + +QueryTokenForMnsQueueResult::MessageTokenDTO QueryTokenForMnsQueueResult::getMessageTokenDTO()const +{ + return messageTokenDTO_; +} + +std::string QueryTokenForMnsQueueResult::getMessage()const +{ + return message_; +} + +std::string QueryTokenForMnsQueueResult::getCode()const +{ + return code_; +} +