Sen descrición

sdk-team f73358f7e8 Supported ScaleApp totalPartitions. %!s(int64=4) %!d(string=hai) anos
.github ecd09578e8 fix typo in issue template %!s(int64=7) %!d(string=hai) anos
3rdparty ad045aa702 fix build failed %!s(int64=7) %!d(string=hai) anos
acm 30fd9f48a0 Support namespaces. %!s(int64=6) %!d(string=hai) anos
acms-open 54883f36c2 ACM POP SDK. %!s(int64=6) %!d(string=hai) anos
actiontrail ff9366ef41 Support API for Trail. %!s(int64=5) %!d(string=hai) anos
adb 90a140992d fix: clear pop meta files %!s(int64=5) %!d(string=hai) anos
address-purification 8617b6ffe5 Aaaaa. %!s(int64=5) %!d(string=hai) anos
aegis f0c2600a26 regenerate code %!s(int64=6) %!d(string=hai) anos
afs f0c2600a26 regenerate code %!s(int64=6) %!d(string=hai) anos
airec 8ded49c937 Generated 2020-11-26 for Airec. %!s(int64=5) %!d(string=hai) anos
alb cc4070bba3 Support Alb Open API. %!s(int64=5) %!d(string=hai) anos
alidns 7942407bc1 Supported API for GTM. %!s(int64=5) %!d(string=hai) anos
alikafka 90a140992d fix: clear pop meta files %!s(int64=5) %!d(string=hai) anos
alimt 9b90cedcbb Add New BatchTranslate API. %!s(int64=5) %!d(string=hai) anos
alinlp b60a834a97 Generated 2020-06-29 for alinlp. %!s(int64=6) %!d(string=hai) anos
aliyuncvc 648aacf470 Public beta version. %!s(int64=5) %!d(string=hai) anos
amqp-open e065d50def Add API for GetMetadataAmount. %!s(int64=6) %!d(string=hai) anos
appmallsservice f0c2600a26 regenerate code %!s(int64=6) %!d(string=hai) anos
arms f3e060235c Edit ListRetcodeApps. %!s(int64=5) %!d(string=hai) anos
arms4finance f0c2600a26 regenerate code %!s(int64=6) %!d(string=hai) anos
bssopenapi 5df0ee7c86 Supported DescribeSavingsPlansUsageTotal. %!s(int64=5) %!d(string=hai) anos
cams 05785cf5fd ChatApp third version. %!s(int64=6) %!d(string=hai) anos
cas f0c2600a26 regenerate code %!s(int64=6) %!d(string=hai) anos
cassandra 97c5e2c422 Generated 2019-01-01 for Cassandra. %!s(int64=5) %!d(string=hai) anos
cbn 16b816ae59 Support CEN latest Apis. %!s(int64=5) %!d(string=hai) anos
ccc 1862b4677d Add API for predictive dialer. %!s(int64=5) %!d(string=hai) anos
ccs f0c2600a26 regenerate code %!s(int64=6) %!d(string=hai) anos
cdn 59616fc161 Fixed SDK update delay. %!s(int64=5) %!d(string=hai) anos
cdrs 0553d7374d Update Monitor Api. %!s(int64=5) %!d(string=hai) anos
chatbot f0c2600a26 regenerate code %!s(int64=6) %!d(string=hai) anos
cloudapi f0c2600a26 regenerate code %!s(int64=6) %!d(string=hai) anos
cloudauth 5380c7f56e Support crop face image. %!s(int64=5) %!d(string=hai) anos
cloudesl bdb663548a Generated 2020-02-01 for cloudesl. %!s(int64=5) %!d(string=hai) anos
cloudgame 6088526cd8 Supported CloudGame. %!s(int64=6) %!d(string=hai) anos
cloudphoto f0c2600a26 regenerate code %!s(int64=6) %!d(string=hai) anos
cloudwf f0c2600a26 regenerate code %!s(int64=6) %!d(string=hai) anos
cms 1f36d787d0 Createdynamictaggroup increases the filter parameters for TagRegionId. %!s(int64=5) %!d(string=hai) anos
codeup ac11b7e23d Add CreateSshKey OpenAPI. %!s(int64=5) %!d(string=hai) anos
companyreg 351e7765f5 Public version. %!s(int64=5) %!d(string=hai) anos
config 2a0fc860e2 Support event type in timeline of resource properties. %!s(int64=5) %!d(string=hai) anos
core 80acb7552c fix: free list before return #132 %!s(int64=5) %!d(string=hai) anos
cr f0c2600a26 regenerate code %!s(int64=6) %!d(string=hai) anos
crm f0c2600a26 regenerate code %!s(int64=6) %!d(string=hai) anos
cs 9290117d12 Some new parameters are supported. %!s(int64=6) %!d(string=hai) anos
csb b257cba9c3 Add FindServiceList and GetService qps. %!s(int64=6) %!d(string=hai) anos
cusanalytic_sc_online f0c2600a26 regenerate code %!s(int64=6) %!d(string=hai) anos
dataworks-public 920e72f912 Generated 2020-05-18 for dataworks-public. %!s(int64=5) %!d(string=hai) anos
dbfs 835983db86 Support query dbfs specification. %!s(int64=5) %!d(string=hai) anos
dbs 33bddb5fa9 Add CreateAndStartBackupPlan. %!s(int64=5) %!d(string=hai) anos
dcdn a1f3045396 Fixed SDK update delay. %!s(int64=5) %!d(string=hai) anos
ddoscoo d453ae2d7b Generated 2020-01-01 for ddoscoo. %!s(int64=5) %!d(string=hai) anos
dds 66430977aa Update by sdk platform. %!s(int64=5) %!d(string=hai) anos
democenter 56c516a238 Add demo edition auth. %!s(int64=6) %!d(string=hai) anos
devops-rdc 0dc704dbaa Fix ListPIpelineTemplates. %!s(int64=5) %!d(string=hai) anos
dg 31aec3f28f Generated 2019-03-27 for dg. %!s(int64=5) %!d(string=hai) anos
dms-enterprise ec69dc6bc1 Support GetSQLReviewOptimizeDetail,ListSQLReviewOriginSQL Order API. %!s(int64=5) %!d(string=hai) anos
domain a5a5b1c4eb Added audit status. %!s(int64=5) %!d(string=hai) anos
drds 4ff900857e New API- GetDrdsDbRdsRelationInfo, which can get private RDS list under certain DB out of DRDS instance ID and DB name. %!s(int64=5) %!d(string=hai) anos
dts 80e8534b12 Supported etlOperatorColumnReference for ModifyDtsJob. %!s(int64=5) %!d(string=hai) anos
dyplsapi f289e0290b Add AddSecretBlacklist and DeleteSecretBlacklist. %!s(int64=6) %!d(string=hai) anos
dypnsapi 7107481ad3 Generated 2017-05-25 for Dypnsapi. %!s(int64=6) %!d(string=hai) anos
dysmsapi f0c2600a26 regenerate code %!s(int64=6) %!d(string=hai) anos
dyvmsapi 57e4665c5e Update Dyvmsapi SDK. %!s(int64=5) %!d(string=hai) anos
eais 90a140992d fix: clear pop meta files %!s(int64=5) %!d(string=hai) anos
eas f0c2600a26 regenerate code %!s(int64=6) %!d(string=hai) anos
ecs 34093b78ef Adjust ecs openapi endpoint. %!s(int64=5) %!d(string=hai) anos
edas ac628879ee Modify CreateK8sSecret. %!s(int64=5) %!d(string=hai) anos
ehpc 17a1e13ec3 ListAvailableEcsTypes set param ZoneId not required. %!s(int64=5) %!d(string=hai) anos
eipanycast e89b92569f Supported AAA for BBB. %!s(int64=5) %!d(string=hai) anos
elasticsearch 1177c92105 Add private-link support. %!s(int64=5) %!d(string=hai) anos
emap d7a89ac3dc Add isv interface. %!s(int64=6) %!d(string=hai) anos
emr 2a6631ce12 Generated 2016-04-08 for Emr. %!s(int64=5) %!d(string=hai) anos
ess cc8cf316cd Update ScalingConfig parameters. %!s(int64=5) %!d(string=hai) anos
et-industry-openapi 9315d79274 delete invalid api code %!s(int64=6) %!d(string=hai) anos
examples 2e42d8fa7f update readme %!s(int64=7) %!d(string=hai) anos
facebody 5f50d51531 Release SearchFace BatchAddFaces. %!s(int64=5) %!d(string=hai) anos
fnf aca0a3efa8 Support ListExecutions with filter functionality. %!s(int64=5) %!d(string=hai) anos
foas f0c2600a26 regenerate code %!s(int64=6) %!d(string=hai) anos
ft 78e7f635c2 AMP Version Change. %!s(int64=5) %!d(string=hai) anos
ga 99ad81bc82 Generated 2019-11-20 for Ga. %!s(int64=5) %!d(string=hai) anos
geoip 90a140992d fix: clear pop meta files %!s(int64=5) %!d(string=hai) anos
goodstech b5e667c1d7 Update goodstech. %!s(int64=5) %!d(string=hai) anos
gpdb f0c2600a26 regenerate code %!s(int64=6) %!d(string=hai) anos
green f9eb4e30b8 Delete MultiMedia Post Scan API. %!s(int64=5) %!d(string=hai) anos
hbase b3c82e1e45 Fix DescribeInstance EncryptionType. %!s(int64=5) %!d(string=hai) anos
hiknoengine f0c2600a26 regenerate code %!s(int64=6) %!d(string=hai) anos
hitsdb c1730219b4 Create Lindorm Open api. %!s(int64=5) %!d(string=hai) anos
hsm f0c2600a26 regenerate code %!s(int64=6) %!d(string=hai) anos
httpdns c2e912302d Supported multiple Language. %!s(int64=5) %!d(string=hai) anos
idrsservice d28ae22685 Supported OpenAPI for SDK. %!s(int64=5) %!d(string=hai) anos
imageaudit 698f5e96da Update imageaudit. %!s(int64=5) %!d(string=hai) anos
imageenhan 90a140992d fix: clear pop meta files %!s(int64=5) %!d(string=hai) anos
imageprocess 9013d93d95 Update ScreenChestCT. %!s(int64=5) %!d(string=hai) anos
imagerecog 58cbb932cd Update TaggingAdImage. %!s(int64=5) %!d(string=hai) anos
imagesearch f0c2600a26 regenerate code %!s(int64=6) %!d(string=hai) anos
imageseg ec2fdb4ecb Update SegmentAnimal SegmentCommonImage. %!s(int64=5) %!d(string=hai) anos
imgsearch 3a88e60d04 Update SearchImage. %!s(int64=6) %!d(string=hai) anos
imm 90a140992d fix: clear pop meta files %!s(int64=5) %!d(string=hai) anos
industry-brain f82391b140 Add Content. %!s(int64=6) %!d(string=hai) anos
iot 455c5afdaa Update LinkSpeech API, including SpeechByCombination, SyncSpeechByCombination. %!s(int64=5) %!d(string=hai) anos
iqa f0c2600a26 regenerate code %!s(int64=6) %!d(string=hai) anos
ivision f0c2600a26 regenerate code %!s(int64=6) %!d(string=hai) anos
ivpd 4332019dac Supported UpdateUserBucketConfig. %!s(int64=6) %!d(string=hai) anos
jarvis f0c2600a26 regenerate code %!s(int64=6) %!d(string=hai) anos
jarvis-public f0c2600a26 regenerate code %!s(int64=6) %!d(string=hai) anos
kms 3a2b4a3b0a Support key deletion protection. %!s(int64=5) %!d(string=hai) anos
ledgerdb d005611f56 Publish apis for ledger instances. %!s(int64=6) %!d(string=hai) anos
linkface f0c2600a26 regenerate code %!s(int64=6) %!d(string=hai) anos
linkwan 98b1ef2aea Generated 2019-03-01 for LinkWAN. %!s(int64=5) %!d(string=hai) anos
live fcaeaecdf7 Generated 2016-11-01 for live. %!s(int64=5) %!d(string=hai) anos
lubancloud f0c2600a26 regenerate code %!s(int64=6) %!d(string=hai) anos
market f0c2600a26 regenerate code %!s(int64=6) %!d(string=hai) anos
metering 9fd70bc2bf Metering 1019. %!s(int64=6) %!d(string=hai) anos
moguan-sdk 34d72f2b3b Support APP auth. %!s(int64=5) %!d(string=hai) anos
mopen f0c2600a26 regenerate code %!s(int64=6) %!d(string=hai) anos
mts fe6548a733 SubmitURLUploadJob, support S3 Storage. %!s(int64=5) %!d(string=hai) anos
multimediaai 934e283efb Video Content analytics template introduced to this SDK. %!s(int64=5) %!d(string=hai) anos
nlp-automl f9b117f5a6 Add some console API operations. %!s(int64=5) %!d(string=hai) anos
objectdet 90a140992d fix: clear pop meta files %!s(int64=5) %!d(string=hai) anos
ocr fe5bdbf24a Release RecognizeQuotaInvoice RecognizeTicketInvoice RecognizePdf. %!s(int64=5) %!d(string=hai) anos
ons 7035fc5c51 Modify the helpUrl parameter of OnsTopicList and OnsGroupList API to be invisible. %!s(int64=5) %!d(string=hai) anos
onsmqtt 3303c6120d Support device credential for mqtt. %!s(int64=5) %!d(string=hai) anos
oos 90a140992d fix: clear pop meta files %!s(int64=5) %!d(string=hai) anos
openanalytics f0c2600a26 regenerate code %!s(int64=6) %!d(string=hai) anos
openanalytics-open f063a7bdba fix: clear pop meta files %!s(int64=5) %!d(string=hai) anos
opensearch ededc6be9f Add API ListQuotaReviewTasks. %!s(int64=5) %!d(string=hai) anos
ots f0c2600a26 regenerate code %!s(int64=6) %!d(string=hai) anos
outboundbot 4fc4cdd7b8 Supported new features for outbound. %!s(int64=5) %!d(string=hai) anos
polardb e2b6c81588 Supports the purchase of polardb storage packages. %!s(int64=5) %!d(string=hai) anos
polardbx 8f21fa7c59 Supported all language sdk. %!s(int64=5) %!d(string=hai) anos
privatelink 5ce3266e7f Add CheckProductOpen. %!s(int64=5) %!d(string=hai) anos
push b8ca7e85aa Supported SendChannels, AndroidMessageHuaweiUrgency, AndroidMessageHuaweiCategory for Push and MassPush. %!s(int64=5) %!d(string=hai) anos
pvtz 6217773578 Update new version. %!s(int64=5) %!d(string=hai) anos
qualitycheck bd94cb0b25 Update API. %!s(int64=5) %!d(string=hai) anos
quotas 900bb894d0 Support query quota. %!s(int64=5) %!d(string=hai) anos
r-kvstore 109a880552 DescirbeAvailableResource add NodeId input parameter. %!s(int64=5) %!d(string=hai) anos
ram f0c2600a26 regenerate code %!s(int64=6) %!d(string=hai) anos
rds 8502ce8db8 Support interface DescribeDBInstanceEncryptionKey for DB Instance Cloud Disk Encryption. %!s(int64=5) %!d(string=hai) anos
reid b5c0b83b02 ListActionData add parameters. %!s(int64=6) %!d(string=hai) anos
reid_cloud 211ad2244b Supported cro algorithm. %!s(int64=5) %!d(string=hai) anos
retailcloud f73358f7e8 Supported ScaleApp totalPartitions. %!s(int64=4) %!d(string=hai) anos
ros f0c2600a26 regenerate code %!s(int64=6) %!d(string=hai) anos
rsimganalys 40d1ce44af Public V430. %!s(int64=5) %!d(string=hai) anos
rtc c68f639be4 Generated 2018-01-11 for rtc. %!s(int64=5) %!d(string=hai) anos
sae 90a140992d fix: clear pop meta files %!s(int64=5) %!d(string=hai) anos
saf 86f01c44a8 Support sg for ml region. %!s(int64=6) %!d(string=hai) anos
safconsole fb12252d2d Supported console. %!s(int64=5) %!d(string=hai) anos
sas 056354a86e Support DescribeInstallCaptcha API. %!s(int64=5) %!d(string=hai) anos
sas-api f0c2600a26 regenerate code %!s(int64=6) %!d(string=hai) anos
scdn 0fe872d573 Fixed SDK update delay. %!s(int64=5) %!d(string=hai) anos
schedulerx2 7bde7a21f4 Supported List Namespaces. %!s(int64=5) %!d(string=hai) anos
scsp cfd8b7cb85 Publish multi language sdk. %!s(int64=5) %!d(string=hai) anos
sddp 4c50775cc9 Supported sdk for sddp. %!s(int64=5) %!d(string=hai) anos
servicemesh 82cfdabb16 Generated 2020-01-11 for servicemesh. %!s(int64=5) %!d(string=hai) anos
sgw a85bc74388 Add TriggerRemoteSync api. %!s(int64=5) %!d(string=hai) anos
slb edbe01d364 Support HealthCheckMethod for HTTP and HTTPS listener. %!s(int64=5) %!d(string=hai) anos
smartag c40875737f Support sts. %!s(int64=5) %!d(string=hai) anos
smarthosting 9693807164 Generated 2020-08-01 for SmartHosting. %!s(int64=6) %!d(string=hai) anos
smc 90a140992d fix: clear pop meta files %!s(int64=5) %!d(string=hai) anos
snsuapi f0c2600a26 regenerate code %!s(int64=6) %!d(string=hai) anos
sts bb60ca8fb6 Supported AssumeRoleWithOIDC. %!s(int64=5) %!d(string=hai) anos
tag 243879b17f Generated 2018-08-28 for Tag. %!s(int64=6) %!d(string=hai) anos
tdsr 565bfada36 Supported backend interface for ICBU. %!s(int64=6) %!d(string=hai) anos
teambition-aliyun 78ca57fe3d Fix create project task. %!s(int64=6) %!d(string=hai) anos
tesladam f0c2600a26 regenerate code %!s(int64=6) %!d(string=hai) anos
teslamaxcompute f0c2600a26 regenerate code %!s(int64=6) %!d(string=hai) anos
teslastream f0c2600a26 regenerate code %!s(int64=6) %!d(string=hai) anos
test d7f985a33b Adding some request header %!s(int64=6) %!d(string=hai) anos
tools c17dc7c79a refactor endpoints implementation %!s(int64=7) %!d(string=hai) anos
trademark f0c2600a26 regenerate code %!s(int64=6) %!d(string=hai) anos
ubsms f0c2600a26 regenerate code %!s(int64=6) %!d(string=hai) anos
vcs 1908e64fa6 Change Configuration. %!s(int64=5) %!d(string=hai) anos
videoenhan 90a140992d fix: clear pop meta files %!s(int64=5) %!d(string=hai) anos
videorecog 5590f7808b Release UnderstandVideoContent. %!s(int64=5) %!d(string=hai) anos
videosearch 5b5f0128c9 API GetTaskStatus return task detail. %!s(int64=6) %!d(string=hai) anos
videoseg df825120f3 Release SegmentGreenScreenVideo. %!s(int64=5) %!d(string=hai) anos
visionai-poc d7e14e0c1b Vision-poc response modified. %!s(int64=6) %!d(string=hai) anos
vod e690260627 Add copyright invasion detection APIs. %!s(int64=5) %!d(string=hai) anos
voicenavigator 969a4a2631 Update version. %!s(int64=5) %!d(string=hai) anos
vpc a3a8fed5ec Generated 2016-04-28 for Vpc. %!s(int64=5) %!d(string=hai) anos
vs 4edd799a79 Support odcap device. %!s(int64=5) %!d(string=hai) anos
waf-openapi 23c07a12a3 Generated 2019-09-10, 2018-01-17 for waf-openapi. %!s(int64=4) %!d(string=hai) anos
workorder c99e90b98e Encrypt Dialog Content. %!s(int64=5) %!d(string=hai) anos
xspace f0c2600a26 regenerate code %!s(int64=6) %!d(string=hai) anos
xtrace 4f16d1bd02 Add result value spanId for GetTrace api. %!s(int64=5) %!d(string=hai) anos
yundun f0c2600a26 regenerate code %!s(int64=6) %!d(string=hai) anos
yundun-ds f0c2600a26 regenerate code %!s(int64=6) %!d(string=hai) anos
.clang-format a57f6ec422 fix code style %!s(int64=6) %!d(string=hai) anos
.gitignore 175996b239 supported request headers operation %!s(int64=6) %!d(string=hai) anos
.travis.yml 4262cf11c8 fix travis ci config %!s(int64=7) %!d(string=hai) anos
CHANGELOG f73358f7e8 Supported ScaleApp totalPartitions. %!s(int64=4) %!d(string=hai) anos
CMakeLists.txt 8bed6eecc7 improve CmakeLists file %!s(int64=6) %!d(string=hai) anos
CONTRIBUTING.md fe958d3794 refactor readme %!s(int64=7) %!d(string=hai) anos
Doxyfile f6db1a27e4 Init commit %!s(int64=8) %!d(string=hai) anos
LICENSE 1ee62b8677 update license year %!s(int64=7) %!d(string=hai) anos
README-CN.md 40170293c2 chore: patch readme %!s(int64=5) %!d(string=hai) anos
README.md 40170293c2 chore: patch readme %!s(int64=5) %!d(string=hai) anos
VERSION f73358f7e8 Supported ScaleApp totalPartitions. %!s(int64=4) %!d(string=hai) anos
easyinstall.sh 31f2c5d410 improve cmake compile %!s(int64=6) %!d(string=hai) anos
function_test.sh 619a7827de timeout support when create client or make request %!s(int64=7) %!d(string=hai) anos
generate_code_cov.sh 21edc7f283 fix unit test build failed %!s(int64=7) %!d(string=hai) anos
unit_test.sh c99809b8e4 support http put and delete %!s(int64=7) %!d(string=hai) anos

README-CN.md

English | 简体中文

Alibaba Cloud SDK for C++

Travis Build Status codecov

Alibaba Cloud SDK for C++ 让您不用复杂编程即可访问云服务器、负载均衡、云监控等阿里云服务。这里向您介绍如何获取 Alibaba Cloud SDK for C++ 并开始调用。

如果您在使用的过程中遇到任何问题,欢迎前往阿里云SDK问答社区提问,提问前请阅读提问引导。亦可在当前 GitHub 提交 Issues

使用诊断

Troubleshoot 提供 OpenAPI 使用诊断服务,通过 RequestID报错信息 ,帮助开发者快速定位,为开发者提供解决方案。

环境要求

在使用 Alibaba Cloud SDK for C++ 前,确保您已经:

  • 注册了阿里云账号并获取了访问密钥(AccessKey)。

说明: 为了保证您的账号安全,建议您使用RAM账号来访问阿里云服务。阿里云账号对拥有的资源有全部权限。RAM账号由阿里云账号授权创建,仅有对特定资源限定的操作权限。详情参见RAM

  • 开通了云产品服务。有些云产品如对象存储(OSS)需要先在阿里云控制台开通服务。

  • 安装支持 C++ 11 或更高版本的编译器:

    • Windows: Visual Studio 2015 或以上版本
    • Linux: GCC 4.9 或以上版本
  • 安装 CMake 3.0 或以上版本

  • 建议 4G 或以上内存

安装 (从源代码构建)

Linux

  1. 要在 Linux 平台进行编译, 您必须安装依赖的外部库文件 libcurl、libopenssl、libuuid、libjsoncpp, 通常情况下,系统的包管理器中的会有提供。
  • 例如:在基于 Redhat / Fedora 的系统上安装这些软件包

    # use yum
    yum install jsoncpp-devel openssl-devel uuid-devel libcurl-devel
    
    # use dnf
    sudo dnf install libcurl-devel openssl-devel libuuid-devel libjsoncpp-devel
    
  • 在基于 Debian/Ubuntu 的系统

    sudo apt-get install libcurl4-openssl-dev libssl-dev uuid-dev libjsoncpp-dev
    
  1. 执行以下命令,从 Github 克隆源码

    git clone https://github.com/aliyun/aliyun-openapi-cpp-sdk.git
    
  2. 编译安装

  • 手动编译安装

    cd aliyun-openapi-cpp-sdk
    mkdir sdk_build
    cd sdk_build
    cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr ..
    make
    sudo make install
    
  • 或者通过 easyinstall.sh一键式安装

    cd aliyun-openapi-cpp-sdk
    sudo sh easyinstall.sh <lower name of product (like 'ecs')>
    
    # example
    sudo sh easyinstall.sh core
    sudo sh easyinstall.sh ecs
    

Alibaba Cloud SDK for C++ 将被安装在 /usr .

Windows

  1. 安装 perl

  2. 使用 git-bash 执行以下命令,从 Github 克隆源码

    git clone https://github.com/aliyun/aliyun-openapi-cpp-sdk.git
    
  3. 使用 Visual Studio 进行编译:

  • 在 aliyun-openapi-cpp-sdk 下创建 sdk_build 目录
  • 打开 cmake-gui , 然后进行以下操作
    • 选择 Browse Source源代码目录(aliyun-openapi-cpp-sdk)
    • 选择 Browse build构建目录(sdk_build)
    • 点击 configure
    • 使用小写的产品名称,设置 BUILD_PRODUCT 参数的值
    • 点击 generate, 构建 VS 解决方案。
  1. 编译安装 C++ SDK
  • 进入 sdk_build 目录,使用 Visual Studio 打开 alibabacloud-sdk.sln 解决方案
  • 选择构建 Release 输出
  • 并打开配置管理器勾选 INSTALL
  • 构建 -> 生成解决方案

Alibaba Cloud SDK for C++ 将安装在 C:\Program File (x86)\alibabacloud-sdk 目录

注意:请以管理员身份运行 Visual Studio 和 cmake-gui,否则无法安装 SDK


快速使用

在调用 Alibaba Cloud SDK for C++ 时,您首先需要配置预处理器定义 ALIBABACLOUD_SHARED 以引用阿里云 C++ SDK 的共享库,然后通过创建 Client 实例提供身份验证,并指定云服务的地域,然后发送API请求。

以下代码展示了如何调用 DescribeInstancesAPI 查询指定地域所有 ECS 实例的详细信息。

说明: 您需要替换示例中的 your-region-id、your-access-key-id 和 your-access-key-secret 的值。

#include <iostream>
#include <alibabacloud/core/AlibabaCloud.h>
#include <alibabacloud/ecs/EcsClient.h>

using namespace AlibabaCloud;
using namespace AlibabaCloud::Ecs;

int main(int argc, char** argv) {
  // 初始化 SDK
  AlibabaCloud::InitializeSdk();

  // 配置 ecs 实例
  ClientConfiguration configuration("<your-region-id>");
  EcsClient client("<your-access-key-id>", "<your-access-key-secret>", configuration);

  // 创建API请求并设置参数
  Model::DescribeInstancesRequest request;
  request.setPageSize(10);

  auto outcome = client.describeInstances(request);
  if (!outcome.isSuccess()) {
    // 异常处理
    std::cout << outcome.error().errorCode() << std::endl;
    AlibabaCloud::ShutdownSdk();
    return -1;
  }

  std::cout << "totalCount: " << outcome.result().getTotalCount() << std::endl;

  // 关闭 SDK
  AlibabaCloud::ShutdownSdk();
  return 0;
}

复制上述文件到 ecs_test.cc。

Linux 下

~$ g++ -o ecstest ecs_test.cc --std=c++11 -lalibabacloud-sdk-core -l alibabacloud-sdk-ecs
~$ ./ecstest
# 结果或错误返回将在此展示
~$

Timeout 设置

CPP SDK 使用 libcurl 作为底层 HTTP 传输库。

  • 下面两个参数用来传递超时参数到 libcurl。

    • connectTimeout: 连接超时设置。 参考.
    • readTimeout: 传输超时设置。参考
  • 默认值

    • connectTimeout: 5000ms
    • readTimeout: 10000ms
  • 可以在创建 Client 或者发 Requst 设置超时参数。

  • Requst 设置优先级高于 Client 设置。

  • 输入 0 或者 -1 到 setConnectTimeoutsetReadTimeout 可以禁用此功能。

下面代码是设置超时参数的例子,由于 Request 优先级高于 Client,所以最终 ConnectTimeout1000msreadTimeout6000ms

#include <iostream>
#include <alibabacloud/core/AlibabaCloud.h>
#include <alibabacloud/ecs/EcsClient.h>

using namespace AlibabaCloud;
using namespace AlibabaCloud::Ecs;

int main(int argc, char** argv) {
  // Initialize the SDK
  AlibabaCloud::InitializeSdk();

  // Configure the ECS instance
  ClientConfiguration configuration("<your-region-id>");
  // specify timeout when create client.
  configuration.setConnectTimeout(1500);
  configuration.setReadTimeout(4000);

  EcsClient client("<your-access-key-id>", "<your-access-key-secret>", configuration);

  // Create an API request and set parameters
  Model::DescribeInstancesRequest request;
  request.setPageSize(10);
  // specify timeout when request
  request.setConnectTimeout(1000);
  request.setReadTimeout(6000);

  auto outcome = client.describeInstances(request);
  if (!outcome.isSuccess()) {
    // Handle exceptions
    std::cout << outcome.error().errorCode() << std::endl;
    AlibabaCloud::ShutdownSdk();
    return -1;
  }

  std::cout << "totalCount: " << outcome.result().getTotalCount() << std::endl;

  // Close the SDK
  AlibabaCloud::ShutdownSdk();
  return 0;
}


更多 例程

问题

提交 Issue, 不符合指南的问题可能会立即关闭。

发行说明

每个版本的详细更改记录在发行说明中。

贡献

提交 Pull Request 之前请阅读贡献指南

许可证

Apache-2.0

版权所有 1999-2019 阿里巴巴集团