All Projects → aliyun → aliyun-openapi-cpp-sdk

aliyun / aliyun-openapi-cpp-sdk

Licence: other
Alibaba Cloud SDK for C++

Programming Languages

C++
36643 projects - #6 most used programming language
CMake
9771 projects

Projects that are alternatives of or similar to aliyun-openapi-cpp-sdk

Smart Admin
SmartAdmin 使用 SpringBoot和Vue,前后端分离,我们希望用一套漂亮的代码和一套整洁的代码规范,让大家在这浮躁的代码世界里感受到一股把代码写好的清流!同时又让开发者节省大量的时间,减少加班,快乐工作,热爱生活。SmartAdmin 让你从认识到忘不了,绝对是你最想要的!
Stars: ✭ 930 (+944.94%)
Mutual labels:  alibaba
Spring Context Support
An internal support project for spring-context in Alibaba
Stars: ✭ 109 (+22.47%)
Mutual labels:  alibaba
Alibaba Java Style Guide
阿里巴巴JAVA开发手册
Stars: ✭ 193 (+116.85%)
Mutual labels:  alibaba
Openapi Core Ruby Sdk
Alibaba Cloud Core SDK for Ruby
Stars: ✭ 29 (-67.42%)
Mutual labels:  alibaba
Flexvolume
FlexVolume plugin for Alibaba Cloud EBS/NAS/OSS, etc.
Stars: ✭ 95 (+6.74%)
Mutual labels:  alibaba
Hybrid multicloud overlay
MutiCloud_Overlay demonstrates a use case of overlay over one or more clouds such as AWS, Azure, GCP, OCI, Alibaba and a vSphere private infrastructure in Hub and spoke topology, point to point topology and in a Single cloud. Overlay protocols IPv6 and IPv4 are independent of underlying infrastructure. This solution can be integrated with encryption and additional security features.
Stars: ✭ 127 (+42.7%)
Mutual labels:  alibaba
Ng Zorro Antd Mobile
A configurable Mobile UI components based on Ant Design Mobile and Angular. 🐜
Stars: ✭ 709 (+696.63%)
Mutual labels:  alibaba
Komiser
☁️ Cloud Environment Inspector 👮🔒 💰
Stars: ✭ 2,684 (+2915.73%)
Mutual labels:  alibaba
Iot remote access
阿里云IoT远程运维套装之远程访问设备侧源码
Stars: ✭ 108 (+21.35%)
Mutual labels:  alibaba
Compileflow
core business process engine of Alibaba Halo platform. best engine for trade Scenes
Stars: ✭ 179 (+101.12%)
Mutual labels:  alibaba
Compileflow Idea Designer
a good idea-plugin for Alibaba Compileflow engine.
Stars: ✭ 52 (-41.57%)
Mutual labels:  alibaba
Weex Eleme
The best practice of weex development guide, 仿饿了么V7.28
Stars: ✭ 82 (-7.87%)
Mutual labels:  alibaba
Alibaba pic
一款美到不行的极简阿里图床
Stars: ✭ 148 (+66.29%)
Mutual labels:  alibaba
Alibaba Cloud Sdk Go
Alibaba Cloud SDK for Go
Stars: ✭ 876 (+884.27%)
Mutual labels:  alibaba
Openapi Sdk Php Client
Official repository of the Alibaba Cloud Client for PHP
Stars: ✭ 206 (+131.46%)
Mutual labels:  alibaba
Aliyungo
Go SDK for Aliyun (Alibaba Cloud) - Golang API for ECS, OSS, DNS, SLB, RDS, RAM, MNS, STS, SLS, MQ, Push, OpenSearch, DM, Container Service etc.
Stars: ✭ 756 (+749.44%)
Mutual labels:  alibaba
Weex Android Joke
A joke android app,powered by alibaba's weex.
Stars: ✭ 112 (+25.84%)
Mutual labels:  alibaba
cb-spider
CB-Spider provides a unified view and single interface for multi-cloud management.
Stars: ✭ 26 (-70.79%)
Mutual labels:  alibaba
Blog
蚂蚁数据体验技术团队的文章仓库
Stars: ✭ 2,581 (+2800%)
Mutual labels:  alibaba
Alimask
😷 alimask 是一个使用 canvas 生成类似阿里巴巴内部网站水印图片的 JavaScript 库。
Stars: ✭ 163 (+83.15%)
Mutual labels:  alibaba

English | 简体中文

Alibaba Cloud SDK for C++

Travis Build Status codecov

Alibaba Cloud SDK for C++ 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 this SDK.

If you have any problem while using Alibaba Cloud SDK for C++, please submit an issue.

Troubleshoot

Troubleshoot Provide OpenAPI diagnosis service to help developers locate quickly and provide solutions for developers through RequestID or error message.

Requirements

  • To use this 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 this SDK to access the APIs of a product, you must first activate the product on the Alibaba Cloud console if required.

  • C++11 supported compiler installed

    • Windows: Visual Studio 2015 or newer
    • Linux: GCC 4.9 or newer
  • CMake 3.0 or newer

  • 4G memory or more

Installation

Linux

  1. Install third-party libraries on the Linux platform, including libcurl, libopenssl, libuuid, and libjsoncpp.
  • Run the following commands on the Redhat/Fedora system
# 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
  • Run the following commands on the Debian/Ubuntu system
sudo apt-get install libcurl4-openssl-dev libssl-dev uuid-dev libjsoncpp-dev
  1. Run the following commands to clone source codes from GitHub.
git clone https://github.com/aliyun/aliyun-openapi-cpp-sdk.git
  1. Build and install SDK
  • Manually build and install
cd aliyun-openapi-cpp-sdk
mkdir sdk_build
cd sdk_build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr ..
make
sudo make install
  • Or you may do this with easyinstall.sh in the source directory
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

The Alibaba Cloud SDK for C++ will be installed to /usr.

Windows

  1. Install perl.

  2. Run the following command to clone code from Github via git-bash:

git clone https://github.com/aliyun/aliyun-openapi-cpp-sdk.git
  1. Build Visual Studio solution
  • Change directory to source code and make directory sdk_build

  • Open CMake UI and

    • Browse Source to open source code directory.

    • Browse build to open the created sdk_build directory

    • Configure

    • use the lower name of product to set the value of BUILD_PRODUCT

    • Generate

  1. Build and Install C++ SDK
  • Open aliyun-openapi-cpp-sdk\\sdk_build\\alibabacloud-sdk.sln with Visual Studio

  • Select Release

  • Check INSTALL option from Build -> Configuration Manager

  • Build->Build Solutions to build.

Alibaba Cloud SDK for C++ will be installed to C:\Program File (x86)\alibabacloud-sdk


Quick Examples

Before using this SDK, you must first configure the preprocessor to define ALIBABACLOUD_SHARED to achieve dynamic linking with the 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;
}

Copy the above to ecs_test.cc, then build with the following command.

~$ g++ -o ecstest ecs_test.cc --std=c++11 -lalibabacloud-sdk-core -l alibabacloud-sdk-ecs
~$ ./ecstest
# Result or error message will be shown here.
~$

Timeout Configuration

CPP SDK uses libcurl to do HTTP transfer.

  • The following timeout parameters are used to for libcurl.

  • connectTimeout: timeout for the connect phase. Refer.

  • readTimeout: maximum time the request is allowed to take, Refer

  • Default Value

  • connectTimeout: 5000ms

  • readTimeout: 10000ms

  • You may specify timeout parameters when create a client or make a request.

  • Request timeout has higher priority than client timeout.

  • If you want to disable timeout feature, deliver 0 or -1 to setConnectTimeout and setReadTimeout.

The following code shows hot to specify timeout parameters, and the final connectTimeout is 1000ms and readTimeout 6000ms.

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

More examples

Issues

Opening an Issue, Issues not conforming to the guidelines may be closed immediately.

Changelog

Detailed changes for each release are documented in the release notes.

Contribution

Please make sure to read the Contributing Guide before making a pull request.

License

Apache-2.0

Copyright 1999-2019 Alibaba Group Holding Ltd.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].