Alibaba Cloud SDK for Go programming language.
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
sdk-team 7b4dbbec70 Generated 2019-11-11 for nlp-automl. 3 недель назад
.github/ISSUE_TEMPLATE add issue template 11 месяцев назад
docs fix:allow user to print response body to logger 7 месяцев назад
integration addRWMutex 1 месяц назад
sdk addRWMutex 1 месяц назад
services Generated 2019-11-11 for nlp-automl. 3 недель назад
tools fix:update endpoint file 7 месяцев назад
vendor rm oss 4 месяцев назад
.appveyor.yml rm dep ensure 2 месяцев назад
.gitignore Add debug method for display debug info controled under env DEBUG variable 1 год назад
.travis.yml rm dep ensure 2 месяцев назад
CONTRIBUTING.md modify readme Alibaba CLoud Go SDK to Alibaba CLoud SDK for Go 9 месяцев назад
ChangeLog.txt Generated 2019-11-11 for nlp-automl. 3 недель назад
Gopkg.lock rm oss 4 месяцев назад
Gopkg.toml rm oss 4 месяцев назад
LICENSE modify License 2 месяцев назад
Makefile add test cases for signer_ram_role_arn.go 1 год назад
README-CN.md modify Appveyor Status 1 месяц назад
README.md modify Appveyor Status 1 месяц назад
doc.go add empty file for depping 8 месяцев назад
go.mod Remove go directive 2 месяцев назад
go.sum Tidy dependencies 3 месяцев назад

README.md

English | 简体中文

Alibaba Cloud SDK for Go

Latest Stable Version License
codecov Travis Build Status Appveyor Build Status Codacy Badge Go Report Card

Alibaba Cloud SDK for Go 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 SDK for Go.

Online Demo

API Explorer provides the ability to call the cloud product OpenAPI online, and dynamically generate SDK Example code and quick retrieval interface, which can significantly reduce the difficulty of using the cloud API.

Requirements

  • It's necessary for you to make sure your system meet the Requirements, such as installing a Go environment which is new than 1.10.x.

Installation

Use go get to install SDK:

$ go get -u github.com/aliyun/alibaba-cloud-sdk-go/sdk

If you have used glide to manage dependence,you can also use glide to install Alibaba Cloud SDK for Go:

$ glide get github.com/aliyun/alibaba-cloud-sdk-go

Quick Examples

Before you begin, you need to sign up for an Alibaba Cloud account and retrieve your Credentials.

Create Client

package main

import "github.com/aliyun/alibaba-cloud-sdk-go/sdk"

func main() {

	client, err := sdk.NewClientWithAccessKey("REGION_ID", "ACCESS_KEY_ID", "ACCESS_KEY_SECRET")
	if err != nil {
		// Handle exceptions
		panic(err)
	}
}

ROA Request

package main

import "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"

func main() {
	request := requests.NewCommonRequest()        // Make a common request
	request.Method = "GET"                        // Set request method
	request.Product = "CS"                        // Specify product
	request.Domain = "cs.aliyuncs.com"            // Location Service will not be enabled if the host is specified. For example, service with a Certification type-Bearer Token should be specified
	request.Version = "2015-12-15"                // Specify product version
	request.PathPattern = "/clusters/[ClusterId]" // Specify path rule with ROA-style
	request.Scheme = "https"                      // Set request scheme. Default: http
	request.ApiName = "DescribeCluster"           // Specify product interface
	request.QueryParams["ClusterId"] = "123456"   // Assign values to parameters in the path
	request.QueryParams["RegionId"] = "region_id" // Specify the requested regionId, if not specified, use the client regionId, then default regionId
	request.TransToAcsRequest()                   // Trans commonrequest to acsRequest, which is used by client.
}

RPC Request

package main

import "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"

func main() {
	request := requests.NewCommonRequest()                // Make a common request
	request.Method = "POST"                               // Set request method
	request.Product = "Ecs"                               // Specify product
	request.Domain = "ecs.aliyuncs.com"                   // Location Service will not be enabled if the host is specified. For example, service with a Certification type-Bearer Token should be specified
	request.Version = "2014-05-26"                        // Specify product version
	request.Scheme = "https"                              // Set request scheme. Default: http
	request.ApiName = "CreateInstance"                    // Specify product interface
	request.QueryParams["InstanceType"] = "ecs.g5.large"  // Assign values to parameters in the path
	request.QueryParams["RegionId"] = "region_id"         // Specify the requested regionId, if not specified, use the client regionId, then default regionId
	request.TransToAcsRequest()                           // Trans commonrequest to acsRequest, which is used by client.
}

Documentation

Issues

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

Contribution

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

References

License

FOSSA Status