README.md
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/gn17u48i53ktblfp/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## Troubleshoot
27[Troubleshoot](https://troubleshoot.api.aliyun.com/?source=github_sdk) Provide OpenAPI diagnosis service to help developers locate quickly and provide solutions for developers through `RequestID` or `error message`.
28
29## Online Demo
30[Alibaba Cloud OpenAPI Developer Portal][open-api-portal] 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.
31
32
33## Requirements
34- 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.
35
36## Installation
37Use `go get` to install SDK:
38
39```sh
40$ go get -u github.com/aliyun/alibaba-cloud-sdk-go/sdk
41```
42
43## Quick Examples
44Before you begin, you need to sign up for an Alibaba Cloud account and retrieve your [Credentials](https://usercenter.console.aliyun.com/#/manage/ak).
45
46### Create Client
47```go
48package main
49
50import "github.com/aliyun/alibaba-cloud-sdk-go/sdk"
51
52func main() {
53
54 client, err := sdk.NewClientWithAccessKey("REGION_ID", "ACCESS_KEY_ID", "ACCESS_KEY_SECRET")
55 if err != nil {
56 // Handle exceptions
57 panic(err)
58 }
59}
60```
61
62### ROA Request
63```go
64package main
65
66import "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
67
68func main() {
69 request := requests.NewCommonRequest() // Make a common request
70 request.Method = "GET" // Set request method
71 request.Product = "CS" // Specify product
72 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
73 request.Version = "2015-12-15" // Specify product version
74 request.PathPattern = "/clusters/[ClusterId]" // Specify path rule with ROA-style
75 request.Scheme = "https" // Set request scheme. Default: http
76 request.ApiName = "DescribeCluster" // Specify product interface
77 request.QueryParams["ClusterId"] = "123456" // Assign values to parameters in the path
78 request.QueryParams["RegionId"] = "region_id" // Specify the requested regionId, if not specified, use the client regionId, then default regionId
79 request.TransToAcsRequest() // Trans commonrequest to acsRequest, which is used by client.
80}
81```
82
83### RPC Request
84```go
85package main
86
87import "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
88
89func main() {
90 request := requests.NewCommonRequest() // Make a common request
91 request.Method = "POST" // Set request method
92 request.Product = "Ecs" // Specify product
93 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
94 request.Version = "2014-05-26" // Specify product version
95 request.Scheme = "https" // Set request scheme. Default: http
96 request.ApiName = "CreateInstance" // Specify product interface
97 request.QueryParams["InstanceType"] = "ecs.g5.large" // Assign values to parameters in the path
98 request.QueryParams["RegionId"] = "region_id" // Specify the requested regionId, if not specified, use the client regionId, then default regionId
99 request.TransToAcsRequest() // Trans commonrequest to acsRequest, which is used by client.
100}
101```
102
103
104## Documentation
105* [Requirements](docs/0-Requirements-EN.md)
106* [Installation](docs/1-Installation-EN.md)
107* [Client & Credentials](docs/2-Client-EN.md)
108* [SSL Verify](docs/3-Verify-EN.md)
109* [Proxy](docs/4-Proxy-EN.md)
110* [Timeout](docs/5-Timeout-EN.md)
111* [Debug](docs/6-Debug-EN.md)
112* [Logger](docs/7-Logger-EN.md)
113* [Concurrent](docs/8-Concurrent-EN.md)
114* [Asynchronous Call](docs/9-Asynchronous-EN.md)
115* [Package Management](docs/10-Package-Management-EN.md)
116* [Endpoint](docs/11-Endpoint-EN.md)
117
118
119## Issues
120[Opening an Issue][issue], Issues not conforming to the guidelines may be closed immediately.
121
122
123## Contribution
124Please make sure to read the [Contributing Guide](CONTRIBUTING.md) before making a pull request.
125
126
127## References
128* [Alibaba Cloud Regions & Endpoints][endpoints]
129* [Alibaba Cloud OpenAPI Developer Portal][open-api-portal]
130* [Go][go]
131* [Latest Release][latest-release]
132
133
134## License
135[![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)
136
137[SDK]: https://github.com/aliyun/alibaba-cloud-sdk-go
138[issue]: https://github.com/aliyun/alibaba-cloud-sdk-go/issues/new
139[open-api-portal]: https://next.api.aliyun.com/
140[latest-release]: https://github.com/aliyun/alibaba-cloud-sdk-go/releases
141[go]: https://golang.org/dl/
142[endpoints]: https://developer.aliyun.com/endpoints
143[Requirements]: docs/0-Requirements-EN.md
144