1English | [简体中文](README-CN.md) 2 3 4<p align="center"> 5<a href=" https://www.alibabacloud.com"><img src="https://aliyunsdk-pages.alicdn.com/icons/AlibabaCloud.svg"></a> 6</p> 7 8<h1 align="center">Alibaba Cloud SDK for Go</h1> 9 10<p align="center"> 11<a href="https://badge.fury.io/gh/aliyun%2Falibaba-cloud-sdk-go"><img src="https://badge.fury.io/gh/aliyun%2Falibaba-cloud-sdk-go.svg" alt="Latest Stable Version"></a> 12<a href="https://app.fossa.io/projects/git%2Bgithub.com%2Faliyun%2Falibaba-cloud-sdk-go?ref=badge_shield"><img src="https://app.fossa.io/api/projects/git%2Bgithub.com%2Faliyun%2Falibaba-cloud-sdk-go.svg?type=shield" alt="License"></a> 13<br/> 14<a href="https://codecov.io/gh/aliyun/alibaba-cloud-sdk-go"><img src="https://codecov.io/gh/aliyun/alibaba-cloud-sdk-go/branch/master/graph/badge.svg" alt="codecov"></a> 15<a href="https://travis-ci.org/aliyun/alibaba-cloud-sdk-go"><img src="https://travis-ci.org/aliyun/alibaba-cloud-sdk-go.svg?branch=master" alt="Travis Build Status"></a> 16<a href="https://ci.appveyor.com/project/aliyun/alibaba-cloud-sdk-go/branch/master"><img src="https://ci.appveyor.com/api/projects/status/1hiuo3ppx5j49psv/branch/master?svg=true" alt="Appveyor Build Status"></a> 17<a href="https://app.codacy.com/app/aliyun/alibaba-cloud-sdk-go?utm_source=github.com&utm_medium=referral&utm_content=aliyun/alibaba-cloud-sdk-go&utm_campaign=Badge_Grade_Dashboard"><img src="https://api.codacy.com/project/badge/Grade/291a39e242364b04ad442f0cce0e30d5" alt="Codacy Badge"></a> 18<a href="https://goreportcard.com/report/github.com/aliyun/alibaba-cloud-sdk-go"><img src="https://goreportcard.com/badge/github.com/aliyun/alibaba-cloud-sdk-go" alt="Go Report Card"></a> 19</p> 20 21 22Alibaba 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. 23 24This document introduces how to obtain and call [Alibaba Cloud SDK for Go][SDK]. 25 26## Online Demo 27[API Explorer][open-api] 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. 28 29 30## Requirements 31- It's necessary for you to make sure your system meet the [Requirements][Requirements], such as installing a Go environment which is new than 1.10.x. 32 33## Installation 34Use `go get` to install SDK: 35 36```sh 37$ go get -u github.com/aliyun/alibaba-cloud-sdk-go/sdk 38``` 39 40If you have used glide to manage dependence,you can also use glide to install Alibaba Cloud SDK for Go: 41 42```sh 43$ glide get github.com/aliyun/alibaba-cloud-sdk-go 44``` 45 46## Quick Examples 47Before you begin, you need to sign up for an Alibaba Cloud account and retrieve your [Credentials](https://usercenter.console.aliyun.com/#/manage/ak). 48 49### Create Client 50```go 51package main 52 53import "github.com/aliyun/alibaba-cloud-sdk-go/sdk" 54 55func main() { 56 57 client, err := sdk.NewClientWithAccessKey("REGION_ID", "ACCESS_KEY_ID", "ACCESS_KEY_SECRET") 58 if err != nil { 59 // Handle exceptions 60 panic(err) 61 } 62} 63``` 64 65### ROA Request 66```go 67package main 68 69import "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" 70 71func main() { 72 request := requests.NewCommonRequest() // Make a common request 73 request.Method = "GET" // Set request method 74 request.Product = "CS" // Specify product 75 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 76 request.Version = "2015-12-15" // Specify product version 77 request.PathPattern = "/clusters/[ClusterId]" // Specify path rule with ROA-style 78 request.Scheme = "https" // Set request scheme. Default: http 79 request.ApiName = "DescribeCluster" // Specify product interface 80 request.QueryParams["ClusterId"] = "123456" // Assign values to parameters in the path 81 request.QueryParams["RegionId"] = "region_id" // Specify the requested regionId, if not specified, use the client regionId, then default regionId 82 request.TransToAcsRequest() // Trans commonrequest to acsRequest, which is used by client. 83} 84``` 85 86### RPC Request 87```go 88package main 89 90import "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" 91 92func main() { 93 request := requests.NewCommonRequest() // Make a common request 94 request.Method = "POST" // Set request method 95 request.Product = "Ecs" // Specify product 96 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 97 request.Version = "2014-05-26" // Specify product version 98 request.Scheme = "https" // Set request scheme. Default: http 99 request.ApiName = "CreateInstance" // Specify product interface 100 request.QueryParams["InstanceType"] = "ecs.g5.large" // Assign values to parameters in the path 101 request.QueryParams["RegionId"] = "region_id" // Specify the requested regionId, if not specified, use the client regionId, then default regionId 102 request.TransToAcsRequest() // Trans commonrequest to acsRequest, which is used by client. 103} 104``` 105 106 107## Documentation 108* [Requirements](docs/0-Requirements-EN.md) 109* [Installation](docs/1-Installation-EN.md) 110* [Client](docs/2-Client-EN.md) 111* [SSL Verify](docs/3-Verify-EN.md) 112* [Proxy](docs/4-Proxy-EN.md) 113* [Timeout](docs/5-Timeout-EN.md) 114* [Debug](docs/6-Debug-EN.md) 115* [Logger](docs/7-Logger-EN.md) 116* [Concurrent](docs/8-Concurrent-EN.md) 117* [Asynchronous Call](docs/9-Asynchronous-EN.md) 118* [Package Management](docs/10-Package-Management-EN.md) 119 120 121## Issues 122[Opening an Issue][issue], Issues not conforming to the guidelines may be closed immediately. 123 124 125## Contribution 126Please make sure to read the [Contributing Guide](CONTRIBUTING.md) before making a pull request. 127 128 129## References 130* [Alibaba Cloud Regions & Endpoints][endpoints] 131* [OpenAPI Explorer][open-api] 132* [Go][go] 133* [Latest Release][latest-release] 134 135 136## License 137[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Faliyun%2Falibaba-cloud-sdk-go.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Faliyun%2Falibaba-cloud-sdk-go?ref=badge_large) 138 139[SDK]: https://github.com/aliyun/alibaba-cloud-sdk-go 140[issue]: https://github.com/aliyun/alibaba-cloud-sdk-go/issues/new 141[open-api]: https://api.aliyun.com/#/ 142[latest-release]: https://github.com/aliyun/alibaba-cloud-sdk-go/releases 143[go]: https://golang.org/dl/ 144[endpoints]: https://developer.aliyun.com/endpoints 145[Requirements]: docs/0-Requirements-EN.md 146