This commit is contained in:
sdk-team
2025-06-05 12:16:14 +00:00
parent bdba38a5ae
commit 164bc90823
9 changed files with 495 additions and 1 deletions

View File

@@ -1 +1 @@
1.36.2072 1.36.2073

86
dms/CMakeLists.txt Normal file
View File

@@ -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(dms_public_header
include/alibabacloud/dms/DmsClient.h
include/alibabacloud/dms/DmsExport.h )
set(dms_public_header_model
include/alibabacloud/dms/model/CreateAirflowLoginTokenRequest.h
include/alibabacloud/dms/model/CreateAirflowLoginTokenResult.h )
set(dms_src
src/DmsClient.cc
src/model/CreateAirflowLoginTokenRequest.cc
src/model/CreateAirflowLoginTokenResult.cc )
add_library(dms ${LIB_TYPE}
${dms_public_header}
${dms_public_header_model}
${dms_src})
set_target_properties(dms
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}dms
)
if(${LIB_TYPE} STREQUAL "SHARED")
set_target_properties(dms
PROPERTIES
DEFINE_SYMBOL ALIBABACLOUD_DMS_LIBRARY)
endif()
target_include_directories(dms
PRIVATE include
${CMAKE_SOURCE_DIR}/core/include
)
target_link_libraries(dms
core)
if(CMAKE_HOST_WIN32)
ExternalProject_Get_Property(jsoncpp INSTALL_DIR)
set(jsoncpp_install_dir ${INSTALL_DIR})
add_dependencies(dms
jsoncpp)
target_include_directories(dms
PRIVATE ${jsoncpp_install_dir}/include)
target_link_libraries(dms
${jsoncpp_install_dir}/lib/jsoncpp.lib)
set_target_properties(dms
PROPERTIES
COMPILE_OPTIONS "/bigobj")
else()
target_include_directories(dms
PRIVATE /usr/include/jsoncpp)
target_link_libraries(dms
jsoncpp)
endif()
install(FILES ${dms_public_header}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/dms)
install(FILES ${dms_public_header_model}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/dms/model)
install(TARGETS dms
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

View File

@@ -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_DMS_DMSCLIENT_H_
#define ALIBABACLOUD_DMS_DMSCLIENT_H_
#include <future>
#include <alibabacloud/core/AsyncCallerContext.h>
#include <alibabacloud/core/EndpointProvider.h>
#include <alibabacloud/core/RpcServiceClient.h>
#include "DmsExport.h"
#include "model/CreateAirflowLoginTokenRequest.h"
#include "model/CreateAirflowLoginTokenResult.h"
namespace AlibabaCloud
{
namespace Dms
{
class ALIBABACLOUD_DMS_EXPORT DmsClient : public RpcServiceClient
{
public:
typedef Outcome<Error, Model::CreateAirflowLoginTokenResult> CreateAirflowLoginTokenOutcome;
typedef std::future<CreateAirflowLoginTokenOutcome> CreateAirflowLoginTokenOutcomeCallable;
typedef std::function<void(const DmsClient*, const Model::CreateAirflowLoginTokenRequest&, const CreateAirflowLoginTokenOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> CreateAirflowLoginTokenAsyncHandler;
DmsClient(const Credentials &credentials, const ClientConfiguration &configuration);
DmsClient(const std::shared_ptr<CredentialsProvider> &credentialsProvider, const ClientConfiguration &configuration);
DmsClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration);
~DmsClient();
CreateAirflowLoginTokenOutcome createAirflowLoginToken(const Model::CreateAirflowLoginTokenRequest &request)const;
void createAirflowLoginTokenAsync(const Model::CreateAirflowLoginTokenRequest& request, const CreateAirflowLoginTokenAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
CreateAirflowLoginTokenOutcomeCallable createAirflowLoginTokenCallable(const Model::CreateAirflowLoginTokenRequest& request) const;
private:
std::shared_ptr<EndpointProvider> endpointProvider_;
};
}
}
#endif // !ALIBABACLOUD_DMS_DMSCLIENT_H_

View File

@@ -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_DMS_DMSEXPORT_H_
#define ALIBABACLOUD_DMS_DMSEXPORT_H_
#include <alibabacloud/core/Global.h>
#if defined(ALIBABACLOUD_SHARED)
# if defined(ALIBABACLOUD_DMS_LIBRARY)
# define ALIBABACLOUD_DMS_EXPORT ALIBABACLOUD_DECL_EXPORT
# else
# define ALIBABACLOUD_DMS_EXPORT ALIBABACLOUD_DECL_IMPORT
# endif
#else
# define ALIBABACLOUD_DMS_EXPORT
#endif
#endif // !ALIBABACLOUD_DMS_DMSEXPORT_H_

View File

@@ -0,0 +1,42 @@
/*
* 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_DMS_MODEL_CREATEAIRFLOWLOGINTOKENREQUEST_H_
#define ALIBABACLOUD_DMS_MODEL_CREATEAIRFLOWLOGINTOKENREQUEST_H_
#include <alibabacloud/dms/DmsExport.h>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <string>
#include <vector>
#include <map>
namespace AlibabaCloud {
namespace Dms {
namespace Model {
class ALIBABACLOUD_DMS_EXPORT CreateAirflowLoginTokenRequest : public RpcServiceRequest {
public:
CreateAirflowLoginTokenRequest();
~CreateAirflowLoginTokenRequest();
std::string getAirflowId() const;
void setAirflowId(const std::string &airflowId);
private:
std::string airflowId_;
};
} // namespace Model
} // namespace Dms
} // namespace AlibabaCloud
#endif // !ALIBABACLOUD_DMS_MODEL_CREATEAIRFLOWLOGINTOKENREQUEST_H_

View File

@@ -0,0 +1,66 @@
/*
* 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_DMS_MODEL_CREATEAIRFLOWLOGINTOKENRESULT_H_
#define ALIBABACLOUD_DMS_MODEL_CREATEAIRFLOWLOGINTOKENRESULT_H_
#include <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/dms/DmsExport.h>
namespace AlibabaCloud
{
namespace Dms
{
namespace Model
{
class ALIBABACLOUD_DMS_EXPORT CreateAirflowLoginTokenResult : public ServiceResult
{
public:
struct Data
{
std::string token;
std::string host;
};
CreateAirflowLoginTokenResult();
explicit CreateAirflowLoginTokenResult(const std::string &payload);
~CreateAirflowLoginTokenResult();
std::string getMessage()const;
int getHttpStatusCode()const;
Data getData()const;
std::string getErrorCode()const;
std::string getCode()const;
bool getSuccess()const;
protected:
void parse(const std::string &payload);
private:
std::string message_;
int httpStatusCode_;
Data data_;
std::string errorCode_;
std::string code_;
bool success_;
};
}
}
}
#endif // !ALIBABACLOUD_DMS_MODEL_CREATEAIRFLOWLOGINTOKENRESULT_H_

89
dms/src/DmsClient.cc Normal file
View File

@@ -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 <alibabacloud/dms/DmsClient.h>
#include <alibabacloud/core/SimpleCredentialsProvider.h>
using namespace AlibabaCloud;
using namespace AlibabaCloud::Location;
using namespace AlibabaCloud::Dms;
using namespace AlibabaCloud::Dms::Model;
namespace
{
const std::string SERVICE_NAME = "Dms";
}
DmsClient::DmsClient(const Credentials &credentials, const ClientConfiguration &configuration) :
RpcServiceClient(SERVICE_NAME, std::make_shared<SimpleCredentialsProvider>(credentials), configuration)
{
auto locationClient = std::make_shared<LocationClient>(credentials, configuration);
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "");
}
DmsClient::DmsClient(const std::shared_ptr<CredentialsProvider>& credentialsProvider, const ClientConfiguration & configuration) :
RpcServiceClient(SERVICE_NAME, credentialsProvider, configuration)
{
auto locationClient = std::make_shared<LocationClient>(credentialsProvider, configuration);
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "");
}
DmsClient::DmsClient(const std::string & accessKeyId, const std::string & accessKeySecret, const ClientConfiguration & configuration) :
RpcServiceClient(SERVICE_NAME, std::make_shared<SimpleCredentialsProvider>(accessKeyId, accessKeySecret), configuration)
{
auto locationClient = std::make_shared<LocationClient>(accessKeyId, accessKeySecret, configuration);
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "");
}
DmsClient::~DmsClient()
{}
DmsClient::CreateAirflowLoginTokenOutcome DmsClient::createAirflowLoginToken(const CreateAirflowLoginTokenRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return CreateAirflowLoginTokenOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return CreateAirflowLoginTokenOutcome(CreateAirflowLoginTokenResult(outcome.result()));
else
return CreateAirflowLoginTokenOutcome(outcome.error());
}
void DmsClient::createAirflowLoginTokenAsync(const CreateAirflowLoginTokenRequest& request, const CreateAirflowLoginTokenAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, createAirflowLoginToken(request), context);
};
asyncExecute(new Runnable(fn));
}
DmsClient::CreateAirflowLoginTokenOutcomeCallable DmsClient::createAirflowLoginTokenCallable(const CreateAirflowLoginTokenRequest &request) const
{
auto task = std::make_shared<std::packaged_task<CreateAirflowLoginTokenOutcome()>>(
[this, request]()
{
return this->createAirflowLoginToken(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}

View File

@@ -0,0 +1,36 @@
/*
* 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 <alibabacloud/dms/model/CreateAirflowLoginTokenRequest.h>
using AlibabaCloud::Dms::Model::CreateAirflowLoginTokenRequest;
CreateAirflowLoginTokenRequest::CreateAirflowLoginTokenRequest()
: RpcServiceRequest("dms", "2025-04-14", "CreateAirflowLoginToken") {
setMethod(HttpRequest::Method::Post);
}
CreateAirflowLoginTokenRequest::~CreateAirflowLoginTokenRequest() {}
std::string CreateAirflowLoginTokenRequest::getAirflowId() const {
return airflowId_;
}
void CreateAirflowLoginTokenRequest::setAirflowId(const std::string &airflowId) {
airflowId_ = airflowId;
setParameter(std::string("AirflowId"), airflowId);
}

View File

@@ -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 <alibabacloud/dms/model/CreateAirflowLoginTokenResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Dms;
using namespace AlibabaCloud::Dms::Model;
CreateAirflowLoginTokenResult::CreateAirflowLoginTokenResult() :
ServiceResult()
{}
CreateAirflowLoginTokenResult::CreateAirflowLoginTokenResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
CreateAirflowLoginTokenResult::~CreateAirflowLoginTokenResult()
{}
void CreateAirflowLoginTokenResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
auto dataNode = value["Data"];
if(!dataNode["Token"].isNull())
data_.token = dataNode["Token"].asString();
if(!dataNode["Host"].isNull())
data_.host = dataNode["Host"].asString();
if(!value["HttpStatusCode"].isNull())
httpStatusCode_ = std::stoi(value["HttpStatusCode"].asString());
if(!value["Success"].isNull())
success_ = value["Success"].asString() == "true";
if(!value["Message"].isNull())
message_ = value["Message"].asString();
if(!value["ErrorCode"].isNull())
errorCode_ = value["ErrorCode"].asString();
if(!value["Code"].isNull())
code_ = value["Code"].asString();
}
std::string CreateAirflowLoginTokenResult::getMessage()const
{
return message_;
}
int CreateAirflowLoginTokenResult::getHttpStatusCode()const
{
return httpStatusCode_;
}
CreateAirflowLoginTokenResult::Data CreateAirflowLoginTokenResult::getData()const
{
return data_;
}
std::string CreateAirflowLoginTokenResult::getErrorCode()const
{
return errorCode_;
}
std::string CreateAirflowLoginTokenResult::getCode()const
{
return code_;
}
bool CreateAirflowLoginTokenResult::getSuccess()const
{
return success_;
}