Нема описа

yixiong.jxy 6443abbf11 пре 8 година
.idea d29cf439dd add readme пре 8 година
3rdparty b61a72e58e Fix build failed пре 8 година
aegis 7be1f34dae Fix build failed on windows пре 8 година
afs 7be1f34dae Fix build failed on windows пре 8 година
ccc 7be1f34dae Fix build failed on windows пре 8 година
cdn 134bd61cdc 由智久发起的CDN SDK自动发布, 版本号:1.9.1 пре 8 година
chatbot 0880c7f722 CHATBOT SDK Auto Released By yanke.yk,Version:1.19.0 пре 8 година
cloudauth a9f8d260ed CLOUDAUTH SDK Auto Released By zhongdong.pzd,Version:1.19.2 пре 8 година
cloudphoto 1c441b53f5 由廷诚发起的CLOUDPHOTO SDK自动发布, 版本号:1.6.5 пре 8 година
cms 7be1f34dae Fix build failed on windows пре 8 година
core b87f210c4c Fix setEndpoint bug пре 8 година
core-tests f6db1a27e4 Init commit пре 8 година
cs 7be1f34dae Fix build failed on windows пре 8 година
csb 7f8b47c92f 由颍川发起的CSB SDK自动发布, 版本号:1.5.1 пре 8 година
dcdn 76c5ad81b7 由智久发起的DCDN SDK自动发布, 版本号:1.7.2 пре 8 година
domain c64664f7bb DOMAIN SDK Auto Released By huizeng.zh,Version:1.18.0 пре 8 година
drds 6d41511442 由燧木发起的DRDS SDK自动发布, 版本号:1.12.0 пре 8 година
dyvmsapi 02c620b5a5 由峰远发起的DYVMSAPI SDK自动发布, 版本号:1.10.3 пре 8 година
ecs 9d5cbb556b ECS SDK Auto Released By hongsong.shs,Version:1.17.10 пре 8 година
ehpc 33d0687c01 EHPC SDK Auto Released By qianzheng.llc,Version:1.20.0 пре 8 година
ess fb82ffd6b1 ESS SDK Auto Released By kangning.tkn,Version:1.19.3 пре 8 година
green b333d4f03c GREEN SDK Auto Released By Alibaba Cloud,Version:1.15.0 пре 8 година
hsm 339cf28edd 由鸿逸发起的HSM SDK自动发布, 版本号:1.7.1 пре 8 година
jarvis 8eb39b6f8f JARVIS SDK Auto Released By mainri.mxy,Version:1.17.6 пре 8 година
live a6256086a8 LIVE SDK Auto Released By renrang.yl,Version:1.17.4 пре 8 година
push c3ff60fd73 由释一发起的PUSH SDK自动发布, BUILD_ID=490, 版本号:1.3.0 пре 8 година
pvtz 62e3b9762a 由空木发起的PVTZ SDK自动发布, 版本号:1.10.0 пре 8 година
rds 459c875c7d 由秒本发起的RDS SDK自动发布, 版本号:1.10.2 пре 8 година
rtc 32f06474af RTC SDK Auto Released By renrang.yl,Version:1.17.9 пре 8 година
scdn 87f2db5065 SCDN SDK Auto Released By xiaoyao,Version:1.17.2 пре 8 година
slb 4a15d5788a 由温仰发起的SLB SDK自动发布, BUILD_ID=467, 版本号:1.2.14 пре 8 година
tesladam 7be1f34dae Fix build failed on windows пре 8 година
teslamaxcompute d63881daa0 由荣旸发起的TESLAMAXCOMPUTE SDK自动发布, 版本号:1.8.2 пре 8 година
vpc 85da4ff587 由温仰发起的VPC SDK自动发布, BUILD_ID=466, 版本号:1.2.13 пре 8 година
CHANGELOG 33d0687c01 EHPC SDK Auto Released By qianzheng.llc,Version:1.20.0 пре 8 година
CMakeLists.txt 0880c7f722 CHATBOT SDK Auto Released By yanke.yk,Version:1.19.0 пре 8 година
Doxyfile f6db1a27e4 Init commit пре 8 година
LICENSE f6db1a27e4 Init commit пре 8 година
README.md d29cf439dd add readme пре 8 година
README_zh.md 07e2b81c13 add readme пре 8 година
VERSION 33d0687c01 EHPC SDK Auto Released By qianzheng.llc,Version:1.20.0 пре 8 година

README.md

Alibaba Cloud C++ Software Development Kit

中文文档

The Alibaba Cloud C++ Software Development Kit (SDK) allows you to access Alibaba Cloud services such as Elastic Compute Service (ECS), Server Load Balancer (SLB), and CloudMonitor. You can access Alibaba Cloud services without the need to handle API related tasks, such as signing and constructing your requests.

This document introduces how to obtain and call Alibaba Cloud C++ SDK.

If you have any problem while using C++ SDK, please join the DingTalk group: 11771185 (the official SDK customer service group of Alibaba Cloud) for consultation.

Prerequisites

  • To use Alibaba Cloud C++ SDK, you must have an Alibaba Cloud account and an AccessKey.

    The AccessKey is required when initializing the client. You can create an AccessKey in the Alibaba Cloud console. For more information, see Create an AccessKey.

    Note: To increase the security of your account, we recommend that you use the AccessKey of the RAM user to access Alibaba Cloud services.

  • To use Alibaba Cloud C++ SDK to access the APIs of a product, you must first activate the product on the Alibaba Cloud console if required.

Install C++ SDK

  1. Install third-party libraries on the Linux platform, including libcurl, libopenssl, libuuid, and libjsoncpp.

    • Run the following commands on the Redhat/Fedora system to install third-party libraries.

      sudo dnf install libcurl-devel openssl-devel libuuid-devel libjsoncpp-devel
      
    • Run the following commands on the Debian/Ubuntu system to install third-party libraries.

      sudo apt-get install libcurl4-openssl-dev libssl-dev uuid-dev libjsoncpp-dev
      
  2. Run the following commands to clone source codes from GitHub.

    git clone https://github.com/aliyun/aliyun-openapi-cpp-sdk.git
    

Use the C++ SDK

Before using C++ SDK, you must first configure the preprocessor to define ALIBABACLOUD_SHARED to achieve dynamic linking with Alibaba Cloud C++ SDK shared libraries. Then you must create a client instance, specify the region of cloud services and provide authentication parameters before sending API requests.

The following code shows how to call the DescribeInstances API of ECS to query detailed information of all ECS instances in a specific region.

#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>");
	EcsClient client("<your-access-key-id>", "<your-access-key-secret>", configuration);

	// Create an API request and set parameters
	Model::DescribeInstancesRequest request;
	request.setPageSize(10);

	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;
}