Init Cpp sdk.

This commit is contained in:
sdk-team
2023-08-11 02:43:12 +00:00
parent cd34c91d00
commit 76afd2bcdc
14 changed files with 405 additions and 1 deletions

View File

@@ -1 +1 @@
1.36.1718
1.36.1719

View File

@@ -97,6 +97,8 @@ set(datalake_public_header_model
include/alibabacloud/datalake/model/GetDatabaseResult.h
include/alibabacloud/datalake/model/GetFunctionRequest.h
include/alibabacloud/datalake/model/GetFunctionResult.h
include/alibabacloud/datalake/model/GetLifecycleRuleRequest.h
include/alibabacloud/datalake/model/GetLifecycleRuleResult.h
include/alibabacloud/datalake/model/GetLockRequest.h
include/alibabacloud/datalake/model/GetLockResult.h
include/alibabacloud/datalake/model/GetPartitionRequest.h
@@ -282,6 +284,8 @@ set(datalake_src
src/model/GetDatabaseResult.cc
src/model/GetFunctionRequest.cc
src/model/GetFunctionResult.cc
src/model/GetLifecycleRuleRequest.cc
src/model/GetLifecycleRuleResult.cc
src/model/GetLockRequest.cc
src/model/GetLockResult.cc
src/model/GetPartitionRequest.cc

View File

@@ -98,6 +98,8 @@
#include "model/GetDatabaseResult.h"
#include "model/GetFunctionRequest.h"
#include "model/GetFunctionResult.h"
#include "model/GetLifecycleRuleRequest.h"
#include "model/GetLifecycleRuleResult.h"
#include "model/GetLockRequest.h"
#include "model/GetLockResult.h"
#include "model/GetPartitionRequest.h"
@@ -327,6 +329,9 @@ namespace AlibabaCloud
typedef Outcome<Error, Model::GetFunctionResult> GetFunctionOutcome;
typedef std::future<GetFunctionOutcome> GetFunctionOutcomeCallable;
typedef std::function<void(const DataLakeClient*, const Model::GetFunctionRequest&, const GetFunctionOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> GetFunctionAsyncHandler;
typedef Outcome<Error, Model::GetLifecycleRuleResult> GetLifecycleRuleOutcome;
typedef std::future<GetLifecycleRuleOutcome> GetLifecycleRuleOutcomeCallable;
typedef std::function<void(const DataLakeClient*, const Model::GetLifecycleRuleRequest&, const GetLifecycleRuleOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> GetLifecycleRuleAsyncHandler;
typedef Outcome<Error, Model::GetLockResult> GetLockOutcome;
typedef std::future<GetLockOutcome> GetLockOutcomeCallable;
typedef std::function<void(const DataLakeClient*, const Model::GetLockRequest&, const GetLockOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> GetLockAsyncHandler;
@@ -605,6 +610,9 @@ namespace AlibabaCloud
GetFunctionOutcome getFunction(const Model::GetFunctionRequest &request)const;
void getFunctionAsync(const Model::GetFunctionRequest& request, const GetFunctionAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
GetFunctionOutcomeCallable getFunctionCallable(const Model::GetFunctionRequest& request) const;
GetLifecycleRuleOutcome getLifecycleRule(const Model::GetLifecycleRuleRequest &request)const;
void getLifecycleRuleAsync(const Model::GetLifecycleRuleRequest& request, const GetLifecycleRuleAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
GetLifecycleRuleOutcomeCallable getLifecycleRuleCallable(const Model::GetLifecycleRuleRequest& request) const;
GetLockOutcome getLock(const Model::GetLockRequest &request)const;
void getLockAsync(const Model::GetLockRequest& request, const GetLockAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
GetLockOutcomeCallable getLockCallable(const Model::GetLockRequest& request) const;

View File

@@ -30,6 +30,8 @@ class ALIBABACLOUD_DATALAKE_EXPORT DeleteDatabaseRequest : public RoaServiceRequ
public:
DeleteDatabaseRequest();
~DeleteDatabaseRequest();
bool getAsync() const;
void setAsync(bool async);
std::string getCatalogId() const;
void setCatalogId(const std::string &catalogId);
bool getCascade() const;
@@ -38,6 +40,7 @@ public:
void setName(const std::string &name);
private:
bool async_;
std::string catalogId_;
bool cascade_;
std::string name_;

View File

@@ -37,6 +37,7 @@ namespace AlibabaCloud
DeleteDatabaseResult();
explicit DeleteDatabaseResult(const std::string &payload);
~DeleteDatabaseResult();
std::string getTaskId()const;
std::string getMessage()const;
std::string getCode()const;
bool getSuccess()const;
@@ -44,6 +45,7 @@ namespace AlibabaCloud
protected:
void parse(const std::string &payload);
private:
std::string taskId_;
std::string message_;
std::string code_;
bool success_;

View File

@@ -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_DATALAKE_MODEL_GETLIFECYCLERULEREQUEST_H_
#define ALIBABACLOUD_DATALAKE_MODEL_GETLIFECYCLERULEREQUEST_H_
#include <alibabacloud/datalake/DataLakeExport.h>
#include <alibabacloud/core/RoaServiceRequest.h>
#include <string>
#include <vector>
#include <map>
namespace AlibabaCloud {
namespace DataLake {
namespace Model {
class ALIBABACLOUD_DATALAKE_EXPORT GetLifecycleRuleRequest : public RoaServiceRequest {
public:
GetLifecycleRuleRequest();
~GetLifecycleRuleRequest();
std::string getBizId() const;
void setBizId(const std::string &bizId);
std::string getResourceName() const;
void setResourceName(const std::string &resourceName);
private:
std::string bizId_;
std::string resourceName_;
};
} // namespace Model
} // namespace DataLake
} // namespace AlibabaCloud
#endif // !ALIBABACLOUD_DATALAKE_MODEL_GETLIFECYCLERULEREQUEST_H_

View File

@@ -0,0 +1,100 @@
/*
* 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_DATALAKE_MODEL_GETLIFECYCLERULERESULT_H_
#define ALIBABACLOUD_DATALAKE_MODEL_GETLIFECYCLERULERESULT_H_
#include <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/datalake/DataLakeExport.h>
namespace AlibabaCloud
{
namespace DataLake
{
namespace Model
{
class ALIBABACLOUD_DATALAKE_EXPORT GetLifecycleRuleResult : public ServiceResult
{
public:
struct Data
{
struct Workflow
{
std::string latestInstanceStatus;
std::string latestInstanceId;
std::string latestEndTime;
std::string latestStartTime;
};
struct WorkflowInstance
{
struct RuntimeLogsItem
{
std::string logSummary;
std::string gmtCreate;
std::string instanceId;
std::string bizTime;
std::string logContent;
std::string logType;
std::string logId;
};
std::string status;
std::vector<RuntimeLogsItem> runtimeLogs;
long endTime;
std::string externalInstanceId;
long startTime;
int batchProgress;
std::string dlfWorkflowId;
};
std::string description;
int bindCount;
std::string config;
int iaDays;
int coldArchiveDays;
std::string gmtModified;
Workflow workflow;
int archiveDays;
std::string resourceType;
std::string ruleType;
WorkflowInstance workflowInstance;
std::string workflowId;
std::string catalogId;
std::string name;
std::string gmtCreate;
std::string bizId;
std::string scheduleStatus;
};
GetLifecycleRuleResult();
explicit GetLifecycleRuleResult(const std::string &payload);
~GetLifecycleRuleResult();
Data getData()const;
bool getSuccess()const;
protected:
void parse(const std::string &payload);
private:
Data data_;
bool success_;
};
}
}
}
#endif // !ALIBABACLOUD_DATALAKE_MODEL_GETLIFECYCLERULERESULT_H_

View File

@@ -34,14 +34,19 @@ namespace AlibabaCloud
public:
struct TableProfile
{
long objectCnt;
long accessNum;
std::string lastAccessNumTime;
std::string lastDdlTime;
std::string createTime;
long objectSize;
std::string databaseName;
long fileCnt;
bool isPartitioned;
std::string lastModifyTime;
std::string lastAccessTime;
std::string latestDate;
std::string latestAccessNumDate;
std::string tableName;
long recordCnt;
long accessNumMonthly;

View File

@@ -1419,6 +1419,42 @@ DataLakeClient::GetFunctionOutcomeCallable DataLakeClient::getFunctionCallable(c
return task->get_future();
}
DataLakeClient::GetLifecycleRuleOutcome DataLakeClient::getLifecycleRule(const GetLifecycleRuleRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return GetLifecycleRuleOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return GetLifecycleRuleOutcome(GetLifecycleRuleResult(outcome.result()));
else
return GetLifecycleRuleOutcome(outcome.error());
}
void DataLakeClient::getLifecycleRuleAsync(const GetLifecycleRuleRequest& request, const GetLifecycleRuleAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, getLifecycleRule(request), context);
};
asyncExecute(new Runnable(fn));
}
DataLakeClient::GetLifecycleRuleOutcomeCallable DataLakeClient::getLifecycleRuleCallable(const GetLifecycleRuleRequest &request) const
{
auto task = std::make_shared<std::packaged_task<GetLifecycleRuleOutcome()>>(
[this, request]()
{
return this->getLifecycleRule(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
DataLakeClient::GetLockOutcome DataLakeClient::getLock(const GetLockRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();

View File

@@ -26,6 +26,15 @@ DeleteDatabaseRequest::DeleteDatabaseRequest()
DeleteDatabaseRequest::~DeleteDatabaseRequest() {}
bool DeleteDatabaseRequest::getAsync() const {
return async_;
}
void DeleteDatabaseRequest::setAsync(bool async) {
async_ = async;
setParameter(std::string("Async"), async ? "true" : "false");
}
std::string DeleteDatabaseRequest::getCatalogId() const {
return catalogId_;
}

View File

@@ -45,9 +45,16 @@ void DeleteDatabaseResult::parse(const std::string &payload)
message_ = value["Message"].asString();
if(!value["Success"].isNull())
success_ = value["Success"].asString() == "true";
if(!value["TaskId"].isNull())
taskId_ = value["TaskId"].asString();
}
std::string DeleteDatabaseResult::getTaskId()const
{
return taskId_;
}
std::string DeleteDatabaseResult::getMessage()const
{
return message_;

View File

@@ -0,0 +1,46 @@
/*
* 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/datalake/model/GetLifecycleRuleRequest.h>
using AlibabaCloud::DataLake::Model::GetLifecycleRuleRequest;
GetLifecycleRuleRequest::GetLifecycleRuleRequest()
: RoaServiceRequest("datalake", "2020-07-10") {
setResourcePath("/webapi/metastorehouse/lifecycle/rule/getLifecycleRule"};
setMethod(HttpRequest::Method::Get);
}
GetLifecycleRuleRequest::~GetLifecycleRuleRequest() {}
std::string GetLifecycleRuleRequest::getBizId() const {
return bizId_;
}
void GetLifecycleRuleRequest::setBizId(const std::string &bizId) {
bizId_ = bizId;
setParameter(std::string("BizId"), bizId);
}
std::string GetLifecycleRuleRequest::getResourceName() const {
return resourceName_;
}
void GetLifecycleRuleRequest::setResourceName(const std::string &resourceName) {
resourceName_ = resourceName;
setParameter(std::string("ResourceName"), resourceName);
}

View File

@@ -0,0 +1,129 @@
/*
* 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/datalake/model/GetLifecycleRuleResult.h>
#include <json/json.h>
using namespace AlibabaCloud::DataLake;
using namespace AlibabaCloud::DataLake::Model;
GetLifecycleRuleResult::GetLifecycleRuleResult() :
ServiceResult()
{}
GetLifecycleRuleResult::GetLifecycleRuleResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
GetLifecycleRuleResult::~GetLifecycleRuleResult()
{}
void GetLifecycleRuleResult::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["BizId"].isNull())
data_.bizId = dataNode["BizId"].asString();
if(!dataNode["GmtCreate"].isNull())
data_.gmtCreate = dataNode["GmtCreate"].asString();
if(!dataNode["GmtModified"].isNull())
data_.gmtModified = dataNode["GmtModified"].asString();
if(!dataNode["Name"].isNull())
data_.name = dataNode["Name"].asString();
if(!dataNode["ResourceType"].isNull())
data_.resourceType = dataNode["ResourceType"].asString();
if(!dataNode["BindCount"].isNull())
data_.bindCount = std::stoi(dataNode["BindCount"].asString());
if(!dataNode["Description"].isNull())
data_.description = dataNode["Description"].asString();
if(!dataNode["RuleType"].isNull())
data_.ruleType = dataNode["RuleType"].asString();
if(!dataNode["Config"].isNull())
data_.config = dataNode["Config"].asString();
if(!dataNode["IaDays"].isNull())
data_.iaDays = std::stoi(dataNode["IaDays"].asString());
if(!dataNode["ArchiveDays"].isNull())
data_.archiveDays = std::stoi(dataNode["ArchiveDays"].asString());
if(!dataNode["ColdArchiveDays"].isNull())
data_.coldArchiveDays = std::stoi(dataNode["ColdArchiveDays"].asString());
if(!dataNode["ScheduleStatus"].isNull())
data_.scheduleStatus = dataNode["ScheduleStatus"].asString();
if(!dataNode["WorkflowId"].isNull())
data_.workflowId = dataNode["WorkflowId"].asString();
if(!dataNode["CatalogId"].isNull())
data_.catalogId = dataNode["CatalogId"].asString();
auto workflowNode = dataNode["Workflow"];
if(!workflowNode["LatestInstanceId"].isNull())
data_.workflow.latestInstanceId = workflowNode["LatestInstanceId"].asString();
if(!workflowNode["LatestInstanceStatus"].isNull())
data_.workflow.latestInstanceStatus = workflowNode["LatestInstanceStatus"].asString();
if(!workflowNode["LatestStartTime"].isNull())
data_.workflow.latestStartTime = workflowNode["LatestStartTime"].asString();
if(!workflowNode["LatestEndTime"].isNull())
data_.workflow.latestEndTime = workflowNode["LatestEndTime"].asString();
auto workflowInstanceNode = dataNode["WorkflowInstance"];
if(!workflowInstanceNode["DlfWorkflowId"].isNull())
data_.workflowInstance.dlfWorkflowId = workflowInstanceNode["DlfWorkflowId"].asString();
if(!workflowInstanceNode["ExternalInstanceId"].isNull())
data_.workflowInstance.externalInstanceId = workflowInstanceNode["ExternalInstanceId"].asString();
if(!workflowInstanceNode["StartTime"].isNull())
data_.workflowInstance.startTime = std::stol(workflowInstanceNode["StartTime"].asString());
if(!workflowInstanceNode["EndTime"].isNull())
data_.workflowInstance.endTime = std::stol(workflowInstanceNode["EndTime"].asString());
if(!workflowInstanceNode["Status"].isNull())
data_.workflowInstance.status = workflowInstanceNode["Status"].asString();
if(!workflowInstanceNode["BatchProgress"].isNull())
data_.workflowInstance.batchProgress = std::stoi(workflowInstanceNode["BatchProgress"].asString());
auto allRuntimeLogsNode = workflowInstanceNode["RuntimeLogs"]["RuntimeLogsItem"];
for (auto workflowInstanceNodeRuntimeLogsRuntimeLogsItem : allRuntimeLogsNode)
{
Data::WorkflowInstance::RuntimeLogsItem runtimeLogsItemObject;
if(!workflowInstanceNodeRuntimeLogsRuntimeLogsItem["GmtCreate"].isNull())
runtimeLogsItemObject.gmtCreate = workflowInstanceNodeRuntimeLogsRuntimeLogsItem["GmtCreate"].asString();
if(!workflowInstanceNodeRuntimeLogsRuntimeLogsItem["InstanceId"].isNull())
runtimeLogsItemObject.instanceId = workflowInstanceNodeRuntimeLogsRuntimeLogsItem["InstanceId"].asString();
if(!workflowInstanceNodeRuntimeLogsRuntimeLogsItem["BizTime"].isNull())
runtimeLogsItemObject.bizTime = workflowInstanceNodeRuntimeLogsRuntimeLogsItem["BizTime"].asString();
if(!workflowInstanceNodeRuntimeLogsRuntimeLogsItem["LogType"].isNull())
runtimeLogsItemObject.logType = workflowInstanceNodeRuntimeLogsRuntimeLogsItem["LogType"].asString();
if(!workflowInstanceNodeRuntimeLogsRuntimeLogsItem["LogId"].isNull())
runtimeLogsItemObject.logId = workflowInstanceNodeRuntimeLogsRuntimeLogsItem["LogId"].asString();
if(!workflowInstanceNodeRuntimeLogsRuntimeLogsItem["LogSummary"].isNull())
runtimeLogsItemObject.logSummary = workflowInstanceNodeRuntimeLogsRuntimeLogsItem["LogSummary"].asString();
if(!workflowInstanceNodeRuntimeLogsRuntimeLogsItem["LogContent"].isNull())
runtimeLogsItemObject.logContent = workflowInstanceNodeRuntimeLogsRuntimeLogsItem["LogContent"].asString();
data_.workflowInstance.runtimeLogs.push_back(runtimeLogsItemObject);
}
if(!value["Success"].isNull())
success_ = value["Success"].asString() == "true";
}
GetLifecycleRuleResult::Data GetLifecycleRuleResult::getData()const
{
return data_;
}
bool GetLifecycleRuleResult::getSuccess()const
{
return success_;
}

View File

@@ -44,8 +44,12 @@ void GetTableProfileResult::parse(const std::string &payload)
tableProfile_.partitionCnt = std::stol(tableProfileNode["PartitionCnt"].asString());
if(!tableProfileNode["FileCnt"].isNull())
tableProfile_.fileCnt = std::stol(tableProfileNode["FileCnt"].asString());
if(!tableProfileNode["ObjectCnt"].isNull())
tableProfile_.objectCnt = std::stol(tableProfileNode["ObjectCnt"].asString());
if(!tableProfileNode["FileSize"].isNull())
tableProfile_.fileSize = std::stol(tableProfileNode["FileSize"].asString());
if(!tableProfileNode["ObjectSize"].isNull())
tableProfile_.objectSize = std::stol(tableProfileNode["ObjectSize"].asString());
if(!tableProfileNode["RecordCnt"].isNull())
tableProfile_.recordCnt = std::stol(tableProfileNode["RecordCnt"].asString());
if(!tableProfileNode["IsPartitioned"].isNull())
@@ -68,8 +72,14 @@ void GetTableProfileResult::parse(const std::string &payload)
tableProfile_.accessNumWeekly = std::stol(tableProfileNode["AccessNumWeekly"].asString());
if(!tableProfileNode["AccessNumMonthly"].isNull())
tableProfile_.accessNumMonthly = std::stol(tableProfileNode["AccessNumMonthly"].asString());
if(!tableProfileNode["LastAccessNumTime"].isNull())
tableProfile_.lastAccessNumTime = tableProfileNode["LastAccessNumTime"].asString();
if(!tableProfileNode["LatestDate"].isNull())
tableProfile_.latestDate = tableProfileNode["LatestDate"].asString();
if(!tableProfileNode["LatestAccessNumDate"].isNull())
tableProfile_.latestAccessNumDate = tableProfileNode["LatestAccessNumDate"].asString();
if(!tableProfileNode["LastDdlTime"].isNull())
tableProfile_.lastDdlTime = tableProfileNode["LastDdlTime"].asString();
if(!value["Code"].isNull())
code_ = value["Code"].asString();
if(!value["Message"].isNull())