0 Star 0 Fork 0

哆啦安梦/C++编写的基于阿里云的DDNS

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
records.h 2.76 KB
一键复制 编辑 原始数据 按行查看 历史
哆啦安梦 提交于 2021-01-19 23:52 . Commit
#ifndef __RECORDS_H__
#define __RECORDS_H__
// 获取域名解析记录用这个
//DescribeDomainRecordsOutcome describeDomainRecords(const Model::DescribeDomainRecordsRequest &request)const;
//void describeDomainRecordsAsync(const Model::DescribeDomainRecordsRequest& request, const DescribeDomainRecordsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
//DescribeDomainRecordsOutcomeCallable describeDomainRecordsCallable(const Model::DescribeDomainRecordsRequest& request) const;
// 获取子域名解析记录用这个
//DescribeSubDomainRecordsOutcome describeSubDomainRecords(const Model::DescribeSubDomainRecordsRequest &request)const;
//void describeSubDomainRecordsAsync(const Model::DescribeSubDomainRecordsRequest& request, const DescribeSubDomainRecordsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
//DescribeSubDomainRecordsOutcomeCallable describeSubDomainRecordsCallable(const Model::DescribeSubDomainRecordsRequest& request) const;
//更新域名解析记录
//UpdateDomainRecordOutcome updateDomainRecord(const Model::UpdateDomainRecordRequest &request)const;
//void updateDomainRecordAsync(const Model::UpdateDomainRecordRequest& request, const UpdateDomainRecordAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
//UpdateDomainRecordOutcomeCallable updateDomainRecordCallable(const Model::UpdateDomainRecordRequest& request) const;
#include <alibabacloud/core/AlibabaCloud.h>
#include <alibabacloud/alidns/AlidnsClient.h>
#include <string>
#include <vector>
using namespace AlibabaCloud;
using namespace AlibabaCloud::Alidns;
bool getRecordFromAlidns(const AlidnsClient& client, const std::string& domainName, const std::string& type, const std::string& subDomainName, std::string& ipv6Record, std::string& rr, std::string& id)
{
Model::DescribeSubDomainRecordsRequest dsdrr;
dsdrr.setDomainName(domainName);
dsdrr.setType(type);
dsdrr.setSubDomain(subDomainName);
AlidnsClient::DescribeSubDomainRecordsOutcome outcome = client.describeSubDomainRecords(dsdrr);
Model::DescribeSubDomainRecordsResult dsdrs = outcome.result();
if(!outcome.isSuccess())
{
return false;
}
auto vc = dsdrs.getDomainRecords();
for(auto i : vc)
{
ipv6Record = i.value;
rr = i.rR;
id = i.recordId;
}
return true;
}
void updateRecordToAlidns(const AlidnsClient& client, const std::string& rr, const std::string& value, const std::string& id, const std::string& type)
{
Model::UpdateDomainRecordRequest udrr;
udrr.setRR(rr);
udrr.setValue(value);
udrr.setRecordId(id);
udrr.setType(type);
client.updateDomainRecord(udrr);
}
#endif
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/doraenmon/alicloud-ddns-based-cpp.git
git@gitee.com:doraenmon/alicloud-ddns-based-cpp.git
doraenmon
alicloud-ddns-based-cpp
C++编写的基于阿里云的DDNS
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385