Aucune description

sdk-team 12a2e32e06 Support new feature. il y a 3 ans
.github ecd09578e8 fix typo in issue template il y a 7 ans
3rdparty ad045aa702 fix build failed il y a 7 ans
acm 30fd9f48a0 Support namespaces. il y a 6 ans
acms-open 54883f36c2 ACM POP SDK. il y a 6 ans
actiontrail 015109df88 Support AK Audit API. il y a 4 ans
adb 7a7f0e03f4 Support resoruce group id. il y a 3 ans
address-purification 8617b6ffe5 Aaaaa. il y a 5 ans
aegis f0c2600a26 regenerate code il y a 6 ans
afs f0c2600a26 regenerate code il y a 6 ans
airec 8ded49c937 Generated 2020-11-26 for Airec. il y a 5 ans
alb d54cb68653 Support Latest APIs. il y a 3 ans
alidns 1b1720464f Supported sorting for DescribeDnsProduceInstances. il y a 3 ans
alikafka 93a074e698 Add UpdateConsumerOffset api. il y a 3 ans
alimt 297be84e79 Add image batch translate API. il y a 3 ans
alinlp aab920ef80 Supported more api for user. il y a 3 ans
aliyuncvc 648aacf470 Public beta version. il y a 5 ans
amqp-open e065d50def Add API for GetMetadataAmount. il y a 6 ans
antiddos-public 98aeacc7c2 Init amp. il y a 4 ans
apds a54f4e6f8d CreateMigrationJob SDK. il y a 4 ans
appmallsservice f0c2600a26 regenerate code il y a 6 ans
appstream-center dbaa86de9e Add ListAppInstances Open API. il y a 3 ans
arms 15ad2ff078 Update sdk. il y a 4 ans
arms4finance f0c2600a26 regenerate code il y a 6 ans
avatar eb44ad4062 -2d create il y a 3 ans
bssopenapi 5d8069b2ae DescribeInstanceAmortizedCostByAmortizationPeriodDate il y a 3 ans
btripopen f9cb2e2167 Test. il y a 4 ans
cams 3dad76444f whatsapp 修改Authentication类型的模板 il y a 3 ans
cas 5ca855fea0 Support certFilter for getUserCertificateDetail API. il y a 3 ans
cassandra 97c5e2c422 Generated 2019-01-01 for Cassandra. il y a 5 ans
cbn a63623d1a9 Update API ListTransitRouterRouteEntries to support PathAttributes. il y a 3 ans
cc5g a6ee7a24dc Cc5g. il y a 3 ans
ccc 00eafdf174 Supported BreakCodeDetails,FirstCheckInTime, LastCheckoutTime . il y a 3 ans
ccs f0c2600a26 regenerate code il y a 6 ans
cdn 6f27a24f42 Support STS. il y a 4 ans
cdrs 0553d7374d Update Monitor Api. il y a 5 ans
chatbot f0c2600a26 regenerate code il y a 6 ans
cloud-siem 159a3aa236 Get the capicity which cloud siem user used until yesterday. il y a 3 ans
cloudapi 8966bab292 Modify DescribeApis. il y a 3 ans
cloudauth 89a2517800 Add AuthId. il y a 4 ans
cloudauth-console fa0fe1ae07 SDK. il y a 4 ans
cloudesl 6f86a0ac33 Add Mutimedia Screen API Support. il y a 4 ans
cloudgame 6088526cd8 Supported CloudGame. il y a 6 ans
cloudphoto f0c2600a26 regenerate code il y a 6 ans
cloudwf f0c2600a26 regenerate code il y a 6 ans
cms 63135520bc CreateContact API Add ContactGroupName. il y a 4 ans
codeup ac11b7e23d Add CreateSshKey OpenAPI. il y a 5 ans
companyreg 351e7765f5 Public version. il y a 5 ans
computenest a91b82458d Generate SDK for service instance APIs. il y a 3 ans
computenestsupplier ebee82abfa Add UpdateService GetService DeleteService. il y a 3 ans
config 99c7c0b611 Fix ListManagedRules bugs. il y a 4 ans
core 1f6051b3b3 fix roarequest query parameters il y a 4 ans
cr f0c2600a26 regenerate code il y a 6 ans
crm f0c2600a26 regenerate code il y a 6 ans
cs 9290117d12 Some new parameters are supported. il y a 6 ans
csb b257cba9c3 Add FindServiceList and GetService qps. il y a 6 ans
cusanalytic_sc_online f0c2600a26 regenerate code il y a 6 ans
datalake 3d20963438 Build c sdk. il y a 3 ans
dataworks-public 045dcc9fa9 Generated 2020-05-18 for dataworks-public. il y a 3 ans
dbfs a22a0c32f6 Increase flow control value for ListDbfs. il y a 3 ans
dbs cebe31f0f4 Generated 2019-03-06 for Dbs. il y a 3 ans
dcdn d1bab4fe11 Add ListDcdnEsTemplateInfo. il y a 4 ans
ddosbgp e7391bcf60 Update sdk. il y a 3 ans
ddoscoo 1f7b94e379 Update sdk. il y a 4 ans
dds f566854e2d Update by SDK platform. il y a 3 ans
democenter 56c516a238 Add demo edition auth. il y a 6 ans
devops-rdc 0dc704dbaa Fix ListPIpelineTemplates. il y a 5 ans
dg 31aec3f28f Generated 2019-03-27 for dg. il y a 5 ans
dms-enterprise 861a684089 Change API CreateDataArchiveOrder and GetDataArchiveCount to public. il y a 3 ans
documentautoml 8eda6c1cc6 DocumentInit. il y a 3 ans
domain 53badb17c1 Ram action config. il y a 4 ans
drds 4ff900857e New API- GetDrdsDbRdsRelationInfo, which can get private RDS list under certain DB out of DRDS instance ID and DB name. il y a 5 ans
dt-oc-info f10a2a333b Supported GetQccSearchCertification and GetQccCertificationDetailById Api For Zhimaxinyong. il y a 3 ans
dts 1dddf4ace0 Update SDK version. il y a 3 ans
dyplsapi 8bc204572b Add new API. il y a 3 ans
dypnsapi a4d37e4317 Support New API for Dypnsapi. il y a 4 ans
dypnsapi-intl bdeb75c7ee Deploy for Dypnsapi-intl. il y a 3 ans
dysmsapi c2bfeb1216 Upgrade Service for SMS. il y a 4 ans
dytnsapi 34607b9120 Support better trace logging for error locating. il y a 3 ans
dyvmsapi e6902accf9 Update Dyvmsapi SDK. il y a 4 ans
eais 9454f4754b Add openapi CreateEaisEi. il y a 3 ans
eas 9db0b784a4 Add service label api. il y a 3 ans
ecd 93f7addccc Support desktop group auto scale. il y a 3 ans
ecs f0a60662c9 CreateLaunchTemplate, CreateLaunchTemplateVersion, DescribeLaunchTemplateVersions support DeletionProtection. il y a 3 ans
edas ac628879ee Modify CreateK8sSecret. il y a 5 ans
eflo dabca8e080 First publish. il y a 3 ans
eflo-controller cbcd585696 Lingjun Controller Initial Version Released. il y a 3 ans
ehpc 7a982f08e6 Parameter changes in SubmitServerlessJob. il y a 3 ans
eipanycast 5fb8057a45 Add UpdateAnycastEipAddressAssociations Interface. il y a 4 ans
elasticsearch b9383c3ee7 Complete Request Body. il y a 3 ans
emap d7a89ac3dc Add isv interface. il y a 6 ans
emr 73610fe6e9 ReleaseClusterHostGroup add support for ReleaseNumber. il y a 4 ans
ens d17a79e8b6 Support clouddisk API. il y a 3 ans
es-serverless 3300b8de84 Added ElasticSearch Serverless SDK. il y a 3 ans
ess cc8cf316cd Update ScalingConfig parameters. il y a 5 ans
et-industry-openapi 9315d79274 delete invalid api code il y a 6 ans
examples 2e42d8fa7f update readme il y a 7 ans
facebody 12ce668e31 Release MergeImageFace. il y a 3 ans
fnf aca0a3efa8 Support ListExecutions with filter functionality. il y a 5 ans
foas 5f1578fdbe Support multi language. il y a 4 ans
ft 4840d6ca87 AMP version. il y a 4 ans
ga 33322a0330 Add something for ga. il y a 3 ans
geoip 90a140992d fix: clear pop meta files il y a 5 ans
goodstech b5e667c1d7 Update goodstech. il y a 5 ans
gpdb feb2350da9 Openapi support querydisplay. il y a 4 ans
grace bce94a0fa4 Initialize SDK. il y a 3 ans
green f9eb4e30b8 Delete MultiMedia Post Scan API. il y a 5 ans
hbase 213faf8f4f Add event tasks. il y a 4 ans
hiknoengine f0c2600a26 regenerate code il y a 6 ans
hitsdb 57a114d7ef Add renew and modify instance pay type api. il y a 3 ans
hsm f0c2600a26 regenerate code il y a 6 ans
httpdns c2e912302d Supported multiple Language. il y a 5 ans
ice cc4191005a Add api called SubmitAvatarVideoJob, which render virtual human videos. il y a 3 ans
idaas-doraemon 2864623659 Support all language. il y a 4 ans
idrsservice d28ae22685 Supported OpenAPI for SDK. il y a 5 ans
imageaudit 675df848ba Update imageaudit. il y a 3 ans
imageenhan ecf1fc42a2 Release GenerateSuperResolutionImage. il y a 3 ans
imageprocess 38f1feda73 Release ScreenGC. il y a 3 ans
imagerecog 45ae211126 Update sdk. il y a 3 ans
imagesearch f0c2600a26 regenerate code il y a 6 ans
imageseg e4a8dc8cd4 Generated 2019-12-30 for imageseg. il y a 3 ans
imgsearch e9b7f9a589 Update imgsearch. il y a 3 ans
imm ba9b236957 Support new api about model training. il y a 3 ans
industry-brain f82391b140 Add Content. il y a 6 ans
iot da6add49af Iot_20180120 TeaDSL SDK. il y a 3 ans
iqa f0c2600a26 regenerate code il y a 6 ans
ivision f0c2600a26 regenerate code il y a 6 ans
ivpd 4332019dac Supported UpdateUserBucketConfig. il y a 6 ans
jarvis f0c2600a26 regenerate code il y a 6 ans
jarvis-public f0c2600a26 regenerate code il y a 6 ans
kms 5e1ff681ee Add Tag Open API. il y a 3 ans
ledgerdb d005611f56 Publish apis for ledger instances. il y a 6 ans
linkface f0c2600a26 regenerate code il y a 6 ans
linkwan 98b1ef2aea Generated 2019-03-01 for LinkWAN. il y a 5 ans
live 25cf7939ec Live sdk update. il y a 3 ans
ltl 8871ba8a2c Generated 2019-05-10 for ltl. il y a 3 ans
lto 4838a80585 Release. il y a 3 ans
lubancloud f0c2600a26 regenerate code il y a 6 ans
market ecee6ebdcf Add DistributionProducts API. il y a 3 ans
metering 9fd70bc2bf Metering 1019. il y a 6 ans
mns-open b2feb38de2 Remove some useless response parameters. il y a 3 ans
moguan-sdk 34d72f2b3b Support APP auth. il y a 5 ans
mopen f0c2600a26 regenerate code il y a 6 ans
mse 61af8db794 Public API ListAppBySwimmingLaneGroupTags. il y a 3 ans
mts fe6548a733 SubmitURLUploadJob, support S3 Storage. il y a 5 ans
multimediaai 934e283efb Video Content analytics template introduced to this SDK. il y a 5 ans
nas e4a6e73946 Support Elastic Desktop Service. il y a 4 ans
nlp-automl 5e93a9b21f 新增模型预测高性能版本 il y a 3 ans
objectdet 2a254b88e0 Update DetectVehicleICongestion DetectVehicleIllegalParking. il y a 3 ans
ocr ece2943ddb Update TrimDocument. il y a 3 ans
ons 84f0671771 Add OnsMessageDetail for query message body. il y a 3 ans
onsmqtt 3303c6120d Support device credential for mqtt. il y a 5 ans
oos e660f66f68 PatchBaseline Support Tags. il y a 3 ans
openanalytics f0c2600a26 regenerate code il y a 6 ans
openanalytics-open f063a7bdba fix: clear pop meta files il y a 5 ans
opensearch 623a29292c update. il y a 3 ans
ots f0c2600a26 regenerate code il y a 6 ans
outboundbot a8f72c5f44 Supported new features for outbound. il y a 3 ans
polardb 2d217f2e0a Support new feature. il y a 3 ans
polardbx 8f21fa7c59 Supported all language sdk. il y a 5 ans
privatelink f699392896 Add latest update. il y a 3 ans
pts 077d8093c7 Add new API for querying the sample logs of PTS debug plan. il y a 3 ans
push 7a240d684e Supported AndroidMessageVivoCategory for Push and MassPush. il y a 3 ans
pvtz 6217773578 Update new version. il y a 5 ans
qualitycheck 422f236430 Add Api. il y a 4 ans
quickbi-public 0ed45d0a71 Add QueryCubePerformance, QueryComponentPerformance, QueryCubeOptimization, and QueryReportPerformance APIs. il y a 3 ans
quotas 900bb894d0 Support query quota. il y a 5 ans
r-kvstore a514d1586b Update by sdk platform. il y a 4 ans
ram f0c2600a26 regenerate code il y a 6 ans
rds 627569cd6f Fix bug ram. il y a 3 ans
reid b5c0b83b02 ListActionData add parameters. il y a 6 ans
reid_cloud 211ad2244b Supported cro algorithm. il y a 5 ans
resourcecenter 50542d3a96 Supported GetResourceCounts for Resourcecenter. il y a 3 ans
resourcemanager 0dc755cf75 Generated 2020-03-31 for ResourceManager. il y a 3 ans
retailcloud f73358f7e8 Supported ScaleApp totalPartitions. il y a 4 ans
ros f0c2600a26 regenerate code il y a 6 ans
rsimganalys 40d1ce44af Public V430. il y a 5 ans
rtc db5500f960 Add DescribeAppKey interface. il y a 4 ans
sae fa4f475079 Add support for secret. il y a 3 ans
saf e2a8813a1b Supported RequestDecision For YN. il y a 4 ans
safconsole fb12252d2d Supported console. il y a 5 ans
sas 0efc4956ec Support rd sdk. il y a 3 ans
sas-api f0c2600a26 regenerate code il y a 6 ans
sasti 00e697671e Add GetGraphQueryTemplates. il y a 3 ans
scdn 665991c212 Update PreloadScdnObjectCaches. il y a 3 ans
schedulerx2 1bf5fe98af Get Workflow Instance Add Node Field. il y a 3 ans
scsp cfd8b7cb85 Publish multi language sdk. il y a 5 ans
sddp 42f2dbf095 CreateDataLimit add enable filed. il y a 4 ans
servicemesh 82cfdabb16 Generated 2020-01-11 for servicemesh. il y a 5 ans
sgw 15e8858e41 Supported CheckBlockVolumeName api for Checking the volume name has been already used by the OSS bucket folder. il y a 4 ans
slb edbe01d364 Support HealthCheckMethod for HTTP and HTTPS listener. il y a 5 ans
smartag c40875737f Support sts. il y a 5 ans
smarthosting 9693807164 Generated 2020-08-01 for SmartHosting. il y a 6 ans
smartsales 852d78709b SmartSales-OpenAPI. il y a 4 ans
smc 90a140992d fix: clear pop meta files il y a 5 ans
snsuapi f0c2600a26 regenerate code il y a 6 ans
sts e54d97e987 Publish AssumeRole API With ExternalId Parameter. il y a 3 ans
swas-open 410b5a1a3e Add new apis. il y a 3 ans
tag fe60cca404 Add MetaTag APIs. il y a 4 ans
tdsr 565bfada36 Supported backend interface for ICBU. il y a 6 ans
teambition-aliyun 78ca57fe3d Fix create project task. il y a 6 ans
tesladam f0c2600a26 regenerate code il y a 6 ans
teslamaxcompute f0c2600a26 regenerate code il y a 6 ans
teslastream f0c2600a26 regenerate code il y a 6 ans
test 1f6051b3b3 fix roarequest query parameters il y a 4 ans
threedvision dce3c27547 Release EstimateMonocularVideoDepth. il y a 3 ans
tingwu fb4f6ae3b1 Init. il y a 4 ans
tools c17dc7c79a refactor endpoints implementation il y a 7 ans
trademark f0c2600a26 regenerate code il y a 6 ans
ubsms f0c2600a26 regenerate code il y a 6 ans
vcs 1908e64fa6 Change Configuration. il y a 5 ans
ververica 385caac18e Public release. il y a 3 ans
viapi 53da02f63b Support for deploy. il y a 3 ans
viapi-regen 8de0b02bda Release CustomizeClassifyImage. il y a 3 ans
videoenhan e5892aafb1 Update AddFaceVideoTemplate and MergeVideoModelFace. il y a 3 ans
videorecog a657203073 Update SplitVideoParts. il y a 3 ans
videosearch 5b5f0128c9 API GetTaskStatus return task detail. il y a 6 ans
videoseg 2f4689f88a Update videoseg. il y a 3 ans
visionai-poc d7e14e0c1b Vision-poc response modified. il y a 6 ans
vod e9912734b2 Api add media storage class. il y a 3 ans
voicenavigator 8ec9faabe1 Supported new features etc. il y a 4 ans
vpc 262fc718c8 Support create default VPC and create default vSwitch . il y a 3 ans
vs 4edd799a79 Support odcap device. il y a 5 ans
waf-openapi 8ca3ea3fdf Upgrade SDK. il y a 4 ans
wfts 6f08307187 Automatically generate sdk tasks. il y a 4 ans
workorder c99e90b98e Encrypt Dialog Content. il y a 5 ans
xspace f0c2600a26 regenerate code il y a 6 ans
xtrace 4f16d1bd02 Add result value spanId for GetTrace api. il y a 5 ans
yundun f0c2600a26 regenerate code il y a 6 ans
yundun-ds f0c2600a26 regenerate code il y a 6 ans
.clang-format a57f6ec422 fix code style il y a 6 ans
.gitignore 175996b239 supported request headers operation il y a 6 ans
.travis.yml 4262cf11c8 fix travis ci config il y a 7 ans
CHANGELOG 99c7c0b611 Fix ListManagedRules bugs. il y a 4 ans
CHANGELOG.md 3e81be19ef AMP version. il y a 4 ans
CMakeLists.txt 8bed6eecc7 improve CmakeLists file il y a 6 ans
CONTRIBUTING.md fe958d3794 refactor readme il y a 7 ans
Doxyfile f6db1a27e4 Init commit il y a 8 ans
LICENSE 1ee62b8677 update license year il y a 7 ans
README-CN.md 40170293c2 chore: patch readme il y a 5 ans
README.md 40170293c2 chore: patch readme il y a 5 ans
VERSION 12a2e32e06 Support new feature. il y a 3 ans
easyinstall.sh 31f2c5d410 improve cmake compile il y a 6 ans
function_test.sh 619a7827de timeout support when create client or make request il y a 7 ans
generate_code_cov.sh 21edc7f283 fix unit test build failed il y a 7 ans
unit_test.sh c99809b8e4 support http put and delete il y a 7 ans

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 阿里巴巴集团