Git Product home page Git Product logo

aliyun-openapi-cpp-sdk's Introduction

Aliyun-Open-Sdk for C++

Build Status

Introduction

This is a c++ implement for aliyun open sdk. The meta data of functions is here: https://github.com/aliyun/openapi-meta.

How to compile

We provide CMakeLists.txt to build.Version

Linux or MacOS or Cygwin

On linux or MacOS, we provide makefie to generate shared library.
If you want to build all projects, just make in sourct root folder like beleow

mkdir build
cmake ..
make

If you just need to build single library, just make the target you need.The rule of library name is aliyun-api-${productname}-${version}. For example to build acs,type command:

mkdir build
cmake ..
make aliyun-api-ecs_2014_05_26

To enable code cover test, add flag COVER_TEST=1

mkdir build
cmake -DCOVER_TEST=1 ..
make

Windows && Visual Studio

Install CMake(version >= 3.0) and Visual Studio,enter the root directory of the code, type commands below:

mkdir build
cmake ..
The Visual Studo solution file will be generated.

How to use

For example we need to use ecs project,we need to: 1, add ecs include folder to project
2, link dynamic library of ecs

here is the sample code:
#include "ali_ecs.h" #include <stdio.h> using namespace aliyun;

void show_regions() {

  EcsDescribeRegionsRequestType req;
  EcsDescribeRegionsResponseType resp;
  EcsErrorInfo error_info;

  int status_code = 0;

  Ecs* ecs = Ecs::CreateEcsClient("cn_shenzhen", "myappid", "mysecret");
  printf(">>>>>>> show regions start >>>>>>>>>>>>\n");
  if(!ecs) {
    printf("error endpoint not found");
    goto out;
  }

  status_code = ecs->DescribeRegions(req, &resp, &error_info);

  if(status_code != 200) {
    printf("status code=%d\n", status_code);
    printf("code = %s\n", error_info.code.c_str());
    printf("message = %s\n", error_info.message.c_str());
    goto out;
  }
  printf("status code=%d\n", status_code);
  for(int i = 0; i < resp.regions.size(); i++) {
    printf("=========\n");
    printf("region_id:%s\n", resp.regions[i].region_id.c_str());
    printf("local_name:%s\n", resp.regions[i].local_name.c_str());
  }
out:
  if(ecs) {
    delete ecs;
  }
  printf(">>>>>>> show regions end >>>>>>>>>>>>\n");
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.